From patchwork Fri Jul 28 07:55:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 13331337 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4A02C0015E for ; Fri, 28 Jul 2023 07:55:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230128AbjG1Hzn (ORCPT ); Fri, 28 Jul 2023 03:55:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234489AbjG1Hzn (ORCPT ); Fri, 28 Jul 2023 03:55:43 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36B9E3580 for ; Fri, 28 Jul 2023 00:55:41 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230728075539epoutp043e6cec199733d493c1e93fb3aa8223e0~1_O6zPOLp2199021990epoutp04Y for ; Fri, 28 Jul 2023 07:55:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230728075539epoutp043e6cec199733d493c1e93fb3aa8223e0~1_O6zPOLp2199021990epoutp04Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1690530939; bh=yUpcGFL91ifhUTlYDbflLFZWGIFU3cqbPQ0gntPnnws=; h=Subject:Reply-To:From:To:Date:References:From; b=sEm+KUr0/EH2VM/Vba+UHITaNHG6jgJePErXX/O5ZP2jaePAccdYNVAXGF7ChmEia l+H10U1COujtbnYqsgTaEDJQjCKSnvt3VGFKPCXSzyOmuVXEFyKbyGcWSvIlCGjFjj nqvHZzhGMPSu5QbOAMGhhfxH1SlIktTuPfseJqhk= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230728075538epcas2p4eb05711ca66a592463cce43b3f885deb~1_O6MzqiS2694026940epcas2p4E; Fri, 28 Jul 2023 07:55:38 +0000 (GMT) Received: from epsmgec2p1.samsung.com (unknown [182.195.36.92]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4RC0LL0ZZJz4x9QK; Fri, 28 Jul 2023 07:55:38 +0000 (GMT) X-AuditID: b6c32a43-2f3ff7000001d7ef-8e-64c3747909ff Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmgec2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 7E.D1.55279.97473C46; Fri, 28 Jul 2023 16:55:37 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH 0/2] multi-page bvec configuration for integrity payload Reply-To: j-young.choi@samsung.com Sender: Jinyoung Choi From: Jinyoung Choi To: "hch@lst.de" , "martin.petersen@oracle.com" , "axboe@kernel.dk" , "sagi@grimberg.me" , "kbusch@kernel.org" , "chaitanya.kulkarni@wdc.com" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20230728075537epcms2p194154023a4cdbe37c0346ef1102d1d63@epcms2p1> Date: Fri, 28 Jul 2023 16:55:37 +0900 X-CMS-MailID: 20230728075537epcms2p194154023a4cdbe37c0346ef1102d1d63 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHJsWRmVeSWpSXmKPExsWy7bCmqW5lyeEUg2fNlhar7/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hp ikvv8d3vBXqi+mfauMyQXrTR/szfvWZz7xqdy0tmntb90HDJFE7eaMfjc/c4FF09eM64NzF9 Bz+Hi8iykNK9lj+Ea46+3zrR0FJy8UMlluKMREMt5qLiRABojWzqMQQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230728075537epcms2p194154023a4cdbe37c0346ef1102d1d63 References: Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org In the case of NVMe, it has an integrity payload consisting of one segment. So, rather than configuring SG_LIST, it was changed by direct DMA mapping. The page-merge is not performed for the struct bio_vec when creating a integrity payload in block. As a result, when creating an integrity paylaod beyond one page, each struct bio_vec is generated, and its bv_len does not exceed the PAGESIZE. To solve it, bio_integrity_add_page() should just add to the existing bvec, similar to bio_add_page() and friends. As the bip configuration changed, the code related to sg_list was also modified. (ref: https://lore.kernel.org/linux-nvme/yq18rewbmay.fsf@ca-mkp.ca.oracle.com/T/#t) Tested like this: - Format (support pi) $ sudo nvme format /dev/nvme2n1 --force -n 1 -i 1 -p 0 -m 0 -l 1 -r - Run FIO [global] ioengine=libaio group_reporting [job] bs=512k iodepth=256 rw=write numjobs=8 direct=1 runtime=10s filename=/dev/nvme2n1 - Result ... [ 93.496218] nvme2n1: I/O Cmd(0x1) @ LBA 62464, 1024 blocks, I/O Error (sct 0x2 / sc 0x82) MORE [ 93.496227] protection error, dev nvme2n1, sector 62464 op 0x1:(WRITE) flags 0x18800 phys_seg 3 prio class 2 [ 93.538788] nvme2n1: I/O Cmd(0x1) @ LBA 6144, 1024 blocks, I/O Error (sct 0x2 / sc 0x82) MORE [ 93.538798] protection error, dev nvme2n1, sector 6144 op 0x1:(WRITE) flags 0x18800 phys_seg 3 prio class 2 [ 93.566231] nvme2n1: I/O Cmd(0x1) @ LBA 124928, 1024 blocks, I/O Error (sct 0x0 / sc 0x4) [ 93.566241] I/O error, dev nvme2n1, sector 124928 op 0x1:(WRITE) flags 0x18800 phys_seg 3 prio class 2 [ 93.694147] nvme2n1: I/O Cmd(0x1) @ LBA 64512, 1024 blocks, I/O Error (sct 0x2 / sc 0x82) MORE [ 93.694155] protection error, dev nvme2n1, sector 64512 op 0x1:(WRITE) flags 0x18800 phys_seg 3 prio class 2 [ 93.694299] nvme2n1: I/O Cmd(0x1) @ LBA 5120, 1024 blocks, I/O Error (sct 0x2 / sc 0x82) MORE [ 93.694305] protection error, dev nvme2n1, sector 5120 op 0x1:(WRITE) flags 0x18800 phys_seg 3 prio class 2 ... Jinyoung Choi (2): block: make bvec_try_merge_hw_page() non-static bio-integrity: create multi-page bvecs in bio_integrity_add_page() block/bio-integrity.c | 50 ++++++++++++++++++++++++------------------- block/bio.c | 2 +- block/blk.h | 4 ++++ 3 files changed, 33 insertions(+), 23 deletions(-)