From patchwork Thu Aug 3 02:46:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 13339179 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 0EF1CC001DE for ; Thu, 3 Aug 2023 02:47:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233659AbjHCCrL (ORCPT ); Wed, 2 Aug 2023 22:47:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233665AbjHCCrG (ORCPT ); Wed, 2 Aug 2023 22:47:06 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 186812719 for ; Wed, 2 Aug 2023 19:46:59 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230803024657epoutp018b560c128518e09e9e436d26156f69e8~3v5GlNpNP2754527545epoutp01U for ; Thu, 3 Aug 2023 02:46:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230803024657epoutp018b560c128518e09e9e436d26156f69e8~3v5GlNpNP2754527545epoutp01U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1691030817; bh=PwO6EleDN2/9BZS0MgsO4FzRedJIuZjGAgP/GjGmsxM=; h=Subject:Reply-To:From:To:Date:References:From; b=ra7AdzDDRLI4/Hz9IZOsl3RVZm1PeV0qE8UeMShoWLh7/mr/uoH8GGCVaGH3w4QWI 0ZRTnKjMNNodawEmPbMQE7IqzhGwemsd60iDyUh6yFOYRGhtDL83k5QynMTHWIfWZa rQy85oiVH6HJrSZr/+64GXGQ3P+lTyEUL45SP0XE= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230803024656epcas2p21235592e87f645b38610e486af8f4979~3v5GKuIWJ1584415844epcas2p2V; Thu, 3 Aug 2023 02:46:56 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.92]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4RGYCN2wlrz4x9Pv; Thu, 3 Aug 2023 02:46:56 +0000 (GMT) X-AuditID: b6c32a46-6fdfa70000009cc5-80-64cb15201a31 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 66.A1.40133.0251BC46; Thu, 3 Aug 2023 11:46:56 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v3 0/4] multi-page bvec configuration for integrity payload Reply-To: j-young.choi@samsung.com Sender: Jinyoung Choi From: Jinyoung Choi To: Christoph Hellwig , "axboe@kernel.dk" , "kbusch@kernel.org" , "chaitanya.kulkarni@wdc.com" , "sagi@grimberg.me" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "martin.petersen@oracle.com" 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: <20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524@epcms2p4> Date: Thu, 03 Aug 2023 11:46:56 +0900 X-CMS-MailID: 20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJJsWRmVeSWpSXmKPExsWy7bCmha6C6OkUg65mUYvVd/vZ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j4HaPj6 xbQHzLrdukyhyed4RG7BztNNwV1HdvdOUlWwq7l0Lqzzs0h87UvNfKZdMu+KPPSeHnEQLNh2 JLy3/XHP3Ezf748FL+1SYinOSDTUYi4qTgQACBWlaywEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230803024656epcms2p4da6defb8e1e9b050fe2fbd52cb2e9524 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. (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 ... Changes to v2: - apply review related to comment (by Christoph) Changes to v1: - add a patch to modify the location of the bi_size update code. - split a patch (create multi-page bvecs in bio_integirty_add_page()). Jinyoung Choi (4): block: make bvec_try_merge_hw_page() non-static bio-integrity: update the payload size in bio_integrity_add_page() bio-integrity: cleanup adding integrity pages to bip's bvec. bio-integrity: create multi-page bvecs in bio_integrity_add_page() block/bio-integrity.c | 49 ++++++++++++++++------------- block/bio.c | 2 +- block/blk.h | 4 +++ drivers/md/dm-crypt.c | 1 - drivers/nvme/host/ioctl.c | 1 - drivers/nvme/target/io-cmd-bdev.c | 3 +- drivers/target/target_core_iblock.c | 3 +- 7 files changed, 35 insertions(+), 28 deletions(-) Reviewed-by: Martin K. Petersen Tested-by: Martin K. Petersen