From patchwork Wed Nov 6 12:18:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13864983 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD66120110E for ; Wed, 6 Nov 2024 14:28:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903318; cv=none; b=Cjv8y+RTcjeAdUspv7Y+Gi2njJOjOiDu7H4ra4ybcMpjIEx+ft++UWQ8y2VTW5w7RqfJFT3uPEqaQqh83GvcsRwAxc5MrDKa9L92Gxf/SbBwU5bOhBPr55cumi68SUXxMsMDlz3kic1MKQc4FHOzAMrzt5mgH3Tl9uFwMGgkKOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903318; c=relaxed/simple; bh=z3oZCEUpNWP6ssVVNnvaEMGwTgZ5HxAO2xsIC7OVOu8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=uRK6syw5dcai7f3diysT+pM2Ilcdn2vp/Dz96zPVr9zLBApMqIgjxUN7R4UssRoryQ+bUXMdStXGd66rTun3yjIg4DpfgzVy4sFsiUUBHNQkMdwME0hYrYRxxNEfZ98qQkYY7xJJmxEN3rdUMP7ZzNTOB6wFDeNYOXC+GRX6+Ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=ZsWKY+Lt; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="ZsWKY+Lt" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241106142833epoutp04a4eaf179e617c8083db9dc04e131e190~FZ2StCtne0693406934epoutp04J for ; Wed, 6 Nov 2024 14:28:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241106142833epoutp04a4eaf179e617c8083db9dc04e131e190~FZ2StCtne0693406934epoutp04J DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903313; bh=n6LNHR2UxOEOGCqUSfrJ4D/dcAXYHqklNM5hsVN/lLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZsWKY+Lt9PpUDRxrn3BelXKNZf6eTdHyECHUaHjOE+wV3Gq6Y2YEFcAKI6NTO/uP1 CBNt82jpReMVCeOHNPlpDAJZX4vgcH8+uH401uZx+ZaRhrdPVkKJceHTJEMeMiLGfq XRjuXkQE4iV3Rp9bvVDa4HKcg5V+6yfe8QgZHUzM= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241106142833epcas5p4ec41e3f4046880d717c7eaead6e5c3bd~FZ2R8pyL31567015670epcas5p4B; Wed, 6 Nov 2024 14:28:33 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.180]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Xk6y736Qyz4x9Pp; Wed, 6 Nov 2024 14:28:31 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 79.2F.09420.F0D7B276; Wed, 6 Nov 2024 23:28:31 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241106122656epcas5p2aa5c312dd186b125b7c3f1af199b46d8~FYMGkhdTq3036530365epcas5p2l; Wed, 6 Nov 2024 12:26:56 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241106122656epsmtrp104fdee9b354f8a312a6b861c083ace4a~FYMGiFpe51944919449epsmtrp1V; Wed, 6 Nov 2024 12:26:56 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-0d-672b7d0fce31 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 66.75.18937.0906B276; Wed, 6 Nov 2024 21:26:56 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122653epsmtip1199a2b710a75c14bba0affe9f37bdabc~FYMEG0B3U0722607226epsmtip1h; Wed, 6 Nov 2024 12:26:53 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta Subject: [PATCH v8 01/10] block: define set of integrity flags to be inherited by cloned bip Date: Wed, 6 Nov 2024 17:48:33 +0530 Message-Id: <20241106121842.5004-2-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Br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siGt+g6/wH8r1WPRVX2vC0KW7Znge/bnXWXTo8uTeJOPHOiZ9fUoj4/ZpSPf4h1m Sge/X6W3izuQU+WRylHZc/k3phjUKX13Unx/WnSjlubnuLqejZHVP7lyV953aZ7WdzxW/bzC PnchpdqmHrsFVY07/y4xuMq7XJbNtbZvikrD1jouyX+7U41l7NOK9m9cGBT1aMUcm8NbeJ6k TZ1XVymWO63/Q3j3K9/rCvxWc+//uWbdF+MudlrMyCjUy27jJXWGs6rzyvecFGgxOCLu8FuJ pTgj0VCLuag4EQA5U+F2HwMAAA== X-CMS-MailID: 20241106122656epcas5p2aa5c312dd186b125b7c3f1af199b46d8 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122656epcas5p2aa5c312dd186b125b7c3f1af199b46d8 References: <20241106121842.5004-1-anuj20.g@samsung.com> Introduce BIP_CLONE_FLAGS describing integrity flags that should be inherited in the cloned bip from the parent. Suggested-by: Christoph Hellwig Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Reviewed-by: Keith Busch --- block/bio-integrity.c | 2 +- include/linux/bio-integrity.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 2a4bd6611692..a448a25d13de 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -559,7 +559,7 @@ int bio_integrity_clone(struct bio *bio, struct bio *bio_src, bip->bip_vec = bip_src->bip_vec; bip->bip_iter = bip_src->bip_iter; - bip->bip_flags = bip_src->bip_flags & ~BIP_BLOCK_INTEGRITY; + bip->bip_flags = bip_src->bip_flags & BIP_CLONE_FLAGS; return 0; } diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index dbf0f74c1529..0f0cf10222e8 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -30,6 +30,9 @@ struct bio_integrity_payload { struct bio_vec bip_inline_vecs[];/* embedded bvec array */ }; +#define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_CTRL_NOCHECK | \ + BIP_DISK_NOCHECK | BIP_IP_CHECKSUM) + #ifdef CONFIG_BLK_DEV_INTEGRITY #define bip_for_each_vec(bvl, bip, iter) \ From patchwork Wed Nov 6 12:18:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13864984 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DCDC1DFE10 for ; Wed, 6 Nov 2024 14:28:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903326; cv=none; b=U/zIdtwC5M8Shd99+C58SUk1YU1W02hCRuXI/0nlNm3pbVs5xGLVZNIJNXs35bxSE62NW1sXqsQ+P8lkLrG+VK4PG947qYfpI8paeE1DFa41YXHI0FY5K50gvmBghyAjYON2wXNihaw2XshBqXSvUs8CfygGaCeYussl/q0Hsnc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903326; c=relaxed/simple; bh=g2fp64Elfp9R80cl3zu6i89Ehrxw1OCNHe/eXuK93qM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=D+0WI282TDem/mcmyEqScdjIRwif2UQlE6tU/M56MyD7Unx5w3vFxRIjAngGbUGB4SzgWIQQ0Q5dxeipCoAtnpoUvYXOhLwfXmrJp5oa2YqqKhJTnkKHY1nnwwCv5sowwy9EcjXy5R12Dd0avhDCdBHI/irPO7VXXcg96QIL0Kw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=ebHZSSZV; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="ebHZSSZV" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241106142842epoutp0336e594ca141b88065d75e5eff3f0c694~FZ2a0ui5j2080220802epoutp03o for ; Wed, 6 Nov 2024 14:28:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241106142842epoutp0336e594ca141b88065d75e5eff3f0c694~FZ2a0ui5j2080220802epoutp03o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903322; bh=FQM1oME+yjLcszh/NNdlGeevLgEVh+e4WfItNIpaOVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ebHZSSZVpOVFzERRI/pT63le5Mxuhzazucfl39ecFWd9wowRzJRFLWDfaRYQKgsrw vxZ0MGrB4wzgN//ZrRRqmm+aCZHOPA7+jhNBXlMvwF0vtrqTRD/+kS+h7W1v0Rh3/3 +a7tlXHcb8exou7Cb/+4p9gh6FnhPUnVNfje8YfA= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241106142841epcas5p4c14347e219d955ba91889adee9e17d87~FZ2aOjGTs1566915669epcas5p43; Wed, 6 Nov 2024 14:28:41 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.175]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Xk6yJ1g9bz4x9Pv; Wed, 6 Nov 2024 14:28:40 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id DF.D2.09800.81D7B276; Wed, 6 Nov 2024 23:28:40 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241106122659epcas5p28505a2288f3ac24408aaf138ac053793~FYMI9TjDC0502105021epcas5p2B; Wed, 6 Nov 2024 12:26:59 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241106122659epsmtrp25d9dbd51809b4af77c8f8fd43592fb90~FYMI7psJw2560925609epsmtrp27; Wed, 6 Nov 2024 12:26:59 +0000 (GMT) X-AuditID: b6c32a4b-4a7fa70000002648-14-672b7d189239 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id D6.26.07371.2906B276; Wed, 6 Nov 2024 21:26:59 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122656epsmtip15daa342826f8e12932f9a06f871347b8~FYMGmHqSV0829608296epsmtip1p; Wed, 6 Nov 2024 12:26:56 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta Subject: [PATCH v8 02/10] block: copy back bounce buffer to user-space correctly in case of split Date: Wed, 6 Nov 2024 17:48:34 +0530 Message-Id: <20241106121842.5004-3-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNJsWRmVeSWpSXmKPExsWy7bCmpq5ErXa6wbGTHBYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJotJh64xWuy9pW2xZ+9JFov5 y56yW3Rf38Fmsfz4PyaL83+Ps1qcnzWH3UHQY+esu+wel8+Wemxa1cnmsXlJvcfumw1sHh+f 3mLx6NuyitHjzIIj7B6fN8l5bHrylimAKyrbJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ 19DSwlxJIS8xN9VWycUnQNctMwfoHSWFssScUqBQQGJxsZK+nU1RfmlJqkJGfnGJrVJqQUpO gUmBXnFibnFpXrpeXmqJlaGBgZEpUGFCdsbn2U1MBav5KlY1TGNrYJzE08XIySEhYCLRMHsr YxcjF4eQwG5GiUlPPkI5nxglfs67ygzhfGOUWHR6CRtMy5oLa1khEnsZJdbf+8gO4XxmlHg7 bSYjSBWbgLrEkeetYLNEBPYwSvQuPM0C4jALvGSUWLpqEQtIlbBAssTvf3/AOlgEVCVubJzH BGLzClhI3Py+hAVin7zEzEvf2UFsTgFLibOftzFC1AhKnJz5BKyGGaimeetssGMlBC5wSDz/ cxnqWBeJa+d3M0LYwhKvjm9hh7ClJD6/2wtVky7x4/JTJgi7QKL52D6oenuJ1lP9QEM5gBZo SqzfpQ8RlpWYemodE8RePone30+gWnkldsyDsZUk2lfOgbIlJPaea4CyPSRunGhmggRXD6PE nueXWCcwKsxC8s8sJP/MQli9gJF5FaNkakFxbnpqsWmBcV5qOTyik/NzNzGCU7mW9w7GRw8+ 6B1iZOJgPMQowcGsJMLrH6WdLsSbklhZlVqUH19UmpN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xJuSWFmVWpQfX1Sak1p8iFGag0VJnNdwxuwUIYH0xJLU7NTUgtQimCwT B6dUA1PwK7FrMzrjHZkk23aqRClUnHgwvXMPz+SspQeUE1fKRyYzKMnyHvT3nr1jNnsnL/P6 tUvCpZcURrddXLo34u7j11G2s7sel+/8vqJhcRyXsdyrTa+vvKrbuM1XUCNMOLng0OOumA9N PAtbUsSn/hU3vSsRsHDt3CVV+RfnL8nhYQsy+ffs362XBwXnax9IUr3fKyXaY/Pioa/yy+Jo YYeipgvNipyv1MunifCLfy1qPJ7/yf1eLJPKzEPy/1iV7GpXe/n55Thdlp297rpE3JfQJ2mO 24zaNime0Hs3kcWzoOThypTd0w7aOeYZf5hrkFnk8ePBth8h7x53/+gOS93QPbdxwpakr9xa tbZPtJRYijMSDbWYi4oTAVSSS2ojAwAA X-CMS-MailID: 20241106122659epcas5p28505a2288f3ac24408aaf138ac053793 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122659epcas5p28505a2288f3ac24408aaf138ac053793 References: <20241106121842.5004-1-anuj20.g@samsung.com> From: Christoph Hellwig Copy back the bounce buffer to user-space in entirety when the parent bio completes. The existing code uses bip_iter.bi_size for sizing the copy, which can be modified. So move away from that and fetch it from the vector passed to the block layer. While at it, switch to using better variable names. Fixes: 492c5d455969f ("block: bio-integrity: directly map user buffers") Signed-off-by: Christoph Hellwig Signed-off-by: Anuj Gupta Reviewed-by: Keith Busch --- block/bio-integrity.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index a448a25d13de..4341b0d4efa1 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -118,17 +118,18 @@ static void bio_integrity_unpin_bvec(struct bio_vec *bv, int nr_vecs, static void bio_integrity_uncopy_user(struct bio_integrity_payload *bip) { - unsigned short nr_vecs = bip->bip_max_vcnt - 1; - struct bio_vec *copy = &bip->bip_vec[1]; - size_t bytes = bip->bip_iter.bi_size; - struct iov_iter iter; + unsigned short orig_nr_vecs = bip->bip_max_vcnt - 1; + struct bio_vec *orig_bvecs = &bip->bip_vec[1]; + struct bio_vec *bounce_bvec = &bip->bip_vec[0]; + size_t bytes = bounce_bvec->bv_len; + struct iov_iter orig_iter; int ret; - iov_iter_bvec(&iter, ITER_DEST, copy, nr_vecs, bytes); - ret = copy_to_iter(bvec_virt(bip->bip_vec), bytes, &iter); + iov_iter_bvec(&orig_iter, ITER_DEST, orig_bvecs, orig_nr_vecs, bytes); + ret = copy_to_iter(bvec_virt(bounce_bvec), bytes, &orig_iter); WARN_ON_ONCE(ret != bytes); - bio_integrity_unpin_bvec(copy, nr_vecs, true); + bio_integrity_unpin_bvec(orig_bvecs, orig_nr_vecs, true); } /** From patchwork Wed Nov 6 12:18:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13864985 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5449201102 for ; Wed, 6 Nov 2024 14:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903333; cv=none; b=J7cy85QAypD+uH1xBxUfLxr2u9JH1+2s+bQW7BGAE0LemWdSh04icMrEzSUPsL6/zkRxzDAuZJL2S6hIRYuvkqeG495F2ywzOiZ33FGpLzhZ80tYhHoFKClCDnJ5B5eXeZT8xTFfHHobpCPGZGPY57iAcPQrPYfzFJ0wcKVWzT0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903333; c=relaxed/simple; bh=ZIkdyJlOm3c2bE0cQ6pelSYB5Gra8HNzZg1GmGSloUY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=AR7XW18Ab/1+U4aUie3ulxmRAcV+s0MUH1JycpApvvghZOnsllVfsdr+Ifuf/ZGQUz184EwCcrZolmabsNUMKslYTdV0cAps0QcQjaeFXszof5oUjUWyzhcA2o/OmkthdX7SOocupRdXk9eSBJD3PypbgFslgFc4L4u9ykFeZRQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=izWXT6m/; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="izWXT6m/" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241106142850epoutp03b177f3fff587bc6f5c83b659abf1e335~FZ2h5phFm2018720187epoutp03- for ; Wed, 6 Nov 2024 14:28:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241106142850epoutp03b177f3fff587bc6f5c83b659abf1e335~FZ2h5phFm2018720187epoutp03- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903330; bh=r23oSTZl50mKsH838ytL5lDlNxkmkMYy4oR7U1Ruz2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=izWXT6m/j7bjz4bbCiKBp3/SoKkzYaK/Rwzc5mocpOrtqEEGc/oujyVbNWGnKkYzl faaAjxYT3cVRIljGl20zvR5bxhWJEgdDU+uQtBvUGssqRlWxc9e+qEIPK0DGeJFCTY Tf5cbR5GfTQTJhU5BuNIREdUNseyXRBE4ZrMPG28= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241106142849epcas5p1fbedcaf95bf53370a654c2aa2d912273~FZ2hKvYXv0161501615epcas5p14; Wed, 6 Nov 2024 14:28:49 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.177]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Xk6yR6C4Jz4x9Pw; Wed, 6 Nov 2024 14:28:47 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 83.E2.09800.F1D7B276; Wed, 6 Nov 2024 23:28:47 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241106122701epcas5p379d6d2c0f7a758f959e02a363ee6871d~FYMLk5-SO1171911719epcas5p35; Wed, 6 Nov 2024 12:27:01 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241106122701epsmtrp1d7f3354d925114851ccbf887ce199279~FYMLjGU311944919449epsmtrp1e; Wed, 6 Nov 2024 12:27:01 +0000 (GMT) X-AuditID: b6c32a4b-23fff70000002648-25-672b7d1fdee6 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 56.23.08227.5906B276; Wed, 6 Nov 2024 21:27:01 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122659epsmtip1aa1deea918526cf1b43e53f0fdc85e6f~FYMJA3akm0722607226epsmtip1i; Wed, 6 Nov 2024 12:26:59 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta , Kanchan Joshi Subject: [PATCH v8 03/10] block: modify bio_integrity_map_user to accept iov_iter as argument Date: Wed, 6 Nov 2024 17:48:35 +0530 Message-Id: <20241106121842.5004-4-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLJsWRmVeSWpSXmKPExsWy7bCmpq58rXa6wftvehYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJouj/9+yWUw6dI3RYu8tbYs9 e0+yWMxf9pTdovv6DjaL5cf/MVmc/3uc1eL8rDnsDkIeO2fdZfe4fLbUY9OqTjaPzUvqPXbf bGDz+Pj0FotH35ZVjB5nFhxh9/i8Sc5j05O3TAFcUdk2GamJKalFCql5yfkpmXnptkrewfHO 8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6ZOUA/KSmUJeaUAoUCEouLlfTtbIryS0tSFTLyi0ts lVILUnIKTAr0ihNzi0vz0vXyUkusDA0MjEyBChOyM56++MxUsEeuYvdljwbGbZJdjJwcEgIm Eh/u/2TrYuTiEBLYzSixrmsjlPOJUaL5wkYmkCohgW+MEl9eVMJ0PLnUyApRtJdR4tP2XVDO Z0aJppbXjCBVbALqEkeetzKCJEQE9jBK9C48zQLiMAtMYJJonziHHaRKWCBe4s7ymcwgNouA qsSCa31Ayzk4eAUsJE7MMoNYJy8x89J3sHJOAUuJs5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PBsZtkl2MnBwSAiYSTy41snYxcnEICexmlOg/so0VIiEhcerlMkYIW1hi5b/n7CC2kMBH RonJF6JBbDYBdYkjz1vBakQETjBKzJ/oBjKIWWAGk0TPrxVsIAlhgViJZ3M/s4DYLAKqEguu 9QHFOTh4BSwkTswyg5gvLzHz0new+ZwClhJnP29jhNhlIfFnQR8ziM0rIChxcuYTsDHMQPXN W2czT2AUmIUkNQtJagEj0ypGydSC4tz03GLDAqO81HK94sTc4tK8dL3k/NxNjOBo09Lawbhn 1Qe9Q4xMHIyHGCU4mJVEeP2jtNOFeFMSK6tSi/Lji0pzUosPMUpzsCiJ83573ZsiJJCeWJKa nZpakFoEk2Xi4JRqYPKYGvRl6bS7Bv+Me4UETaUqnopd2P/088kyI8Hcs0bbDomsUvqdIMb3 /UVI+N/Phzz3vRO772GqlelfV6McL2y+TdtC/NKJ1csWl4ddWvXz38I4teb3HnptoRw2S4Om CTaHfiu5vGmKgfSO4pUGzp7JFx7a/drzreCg+KZ+DlnWgEkv8lzefzp/1nSec1D2/kVVSRK7 bm28yv6TVV/usfA34y+h0xOfvGLrcXCx2fd3Ls8D8eVnu1ff534fwfJv+4/YhQZs0q1xvS7c 15dwZt3IiWCIWvu7YaL3gYfSlSdr1Fap33yu5nJ2+m02xhr/Vq8T914oPL3lNnmm+p40a4vT 7zSEPr1VEn6/8uuL70xKLMUZiYZazEXFiQAKivRLJQMAAA== X-CMS-MailID: 20241106122701epcas5p379d6d2c0f7a758f959e02a363ee6871d X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122701epcas5p379d6d2c0f7a758f959e02a363ee6871d References: <20241106121842.5004-1-anuj20.g@samsung.com> This patch refactors bio_integrity_map_user to accept iov_iter as argument. This is a prep patch. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Christoph Hellwig Reviewed-by: Keith Busch --- block/bio-integrity.c | 12 +++++------- block/blk-integrity.c | 10 +++++++++- include/linux/bio-integrity.h | 5 ++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 4341b0d4efa1..f56d01cec689 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -302,16 +302,15 @@ static unsigned int bvec_from_pages(struct bio_vec *bvec, struct page **pages, return nr_bvecs; } -int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t bytes) +int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter) { struct request_queue *q = bdev_get_queue(bio->bi_bdev); unsigned int align = blk_lim_dma_alignment_and_pad(&q->limits); struct page *stack_pages[UIO_FASTIOV], **pages = stack_pages; struct bio_vec stack_vec[UIO_FASTIOV], *bvec = stack_vec; + size_t offset, bytes = iter->count; unsigned int direction, nr_bvecs; - struct iov_iter iter; int ret, nr_vecs; - size_t offset; bool copy; if (bio_integrity(bio)) @@ -324,8 +323,7 @@ int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t bytes) else direction = ITER_SOURCE; - iov_iter_ubuf(&iter, direction, ubuf, bytes); - nr_vecs = iov_iter_npages(&iter, BIO_MAX_VECS + 1); + nr_vecs = iov_iter_npages(iter, BIO_MAX_VECS + 1); if (nr_vecs > BIO_MAX_VECS) return -E2BIG; if (nr_vecs > UIO_FASTIOV) { @@ -335,8 +333,8 @@ int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t bytes) pages = NULL; } - copy = !iov_iter_is_aligned(&iter, align, align); - ret = iov_iter_extract_pages(&iter, &pages, bytes, nr_vecs, 0, &offset); + copy = !iov_iter_is_aligned(iter, align, align); + ret = iov_iter_extract_pages(iter, &pages, bytes, nr_vecs, 0, &offset); if (unlikely(ret < 0)) goto free_bvec; diff --git a/block/blk-integrity.c b/block/blk-integrity.c index b180cac61a9d..4a29754f1bc2 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -115,8 +115,16 @@ EXPORT_SYMBOL(blk_rq_map_integrity_sg); int blk_rq_integrity_map_user(struct request *rq, void __user *ubuf, ssize_t bytes) { - int ret = bio_integrity_map_user(rq->bio, ubuf, bytes); + int ret; + struct iov_iter iter; + unsigned int direction; + if (op_is_write(req_op(rq))) + direction = ITER_DEST; + else + direction = ITER_SOURCE; + iov_iter_ubuf(&iter, direction, ubuf, bytes); + ret = bio_integrity_map_user(rq->bio, &iter); if (ret) return ret; diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index 0f0cf10222e8..58ff9988433a 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -75,7 +75,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, gfp_t gfp, unsigned int nr); int bio_integrity_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset); -int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t len); +int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter); void bio_integrity_unmap_user(struct bio *bio); bool bio_integrity_prep(struct bio *bio); void bio_integrity_advance(struct bio *bio, unsigned int bytes_done); @@ -101,8 +101,7 @@ static inline void bioset_integrity_free(struct bio_set *bs) { } -static inline int bio_integrity_map_user(struct bio *bio, void __user *ubuf, - ssize_t len) +static int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter) { return -EINVAL; } From patchwork Wed Nov 6 12:18:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13864986 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A03A32022EE for ; Wed, 6 Nov 2024 14:28:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903341; cv=none; b=rl3bolze8ePcIGgSUqZz3ch8Ir2ICWg0QO7adWVorBWg+DM/8QdNCpWxA5bsRwJVyNHVBZCh8r2yzVbLCAE3EhGcuJx76SL6nZumQ6/FtSKulTIZWH7/OfugdBmTK+z8x8AJaWyFi6sY6ecnln4lajpmsEpp4J8pDQ4YCZIe7tg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903341; c=relaxed/simple; bh=uDUb87C52DXoVA3KvOoAoNEyjHqrw30MJR/Iqxaidaw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=IrTlUoQsf8hHBiVpU6Bw4Ygu22ODg2uCEcPgK+FN8qnxCwtYnzJBDUDQWY5fXwLiWezj6IVDZgU8N9UU80Em+gRLCCOJh6PFOy8F72XGDQu1fMhIjHFoLXbKy3nWbmIUG5YaxYOFph+udEwrBmSZF/Mw6r2BdzByV7jhIdeqAro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=gbg5JLxy; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="gbg5JLxy" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241106142857epoutp03b9eef060b0838716bc05d7a1be729715~FZ2pHxEVH2018720187epoutp03C for ; Wed, 6 Nov 2024 14:28:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241106142857epoutp03b9eef060b0838716bc05d7a1be729715~FZ2pHxEVH2018720187epoutp03C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903338; bh=sPCiH7C8otAPeKBQxafGfpBc//4CVwTtOappMXTNYFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gbg5JLxy/xiTiY9CuIiwgTmSAQOcbuN/Ud63w2R7VlT4/1GVgD7RL9mt0ufzemj3Y hnq3uR4bSXQWmPkDAneWxqWQ9b32gKU8/GgRd5G2pj8g9KNjLv009F7kdA1Hc/p5no 9Rb3+9ULk1qnq95VfOvwLvcRrlJpKXOnWiP+nep0= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241106142857epcas5p263a7bc31e0dbaab8e5a1cba44ac3d8d6~FZ2oU87bL1484514845epcas5p2Z; Wed, 6 Nov 2024 14:28:57 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.181]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Xk6yb2jBpz4x9Pp; Wed, 6 Nov 2024 14:28:55 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id BB.44.37975.72D7B276; Wed, 6 Nov 2024 23:28:55 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241106122704epcas5p37a156fb2738c3b8194e8f81c26a07878~FYMOMslh43242132421epcas5p33; Wed, 6 Nov 2024 12:27:04 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241106122704epsmtrp200a3457ab68e63807ffbfa37626d1ccf~FYMOL2gb62562525625epsmtrp2O; Wed, 6 Nov 2024 12:27:04 +0000 (GMT) X-AuditID: b6c32a50-085ff70000049457-2d-672b7d27f000 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F6.01.35203.8906B276; Wed, 6 Nov 2024 21:27:04 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122702epsmtip1ef7339d3a33088bb9e994ec2c051e80a~FYMLqURmC0829608296epsmtip19; Wed, 6 Nov 2024 12:27:01 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta , Kanchan Joshi Subject: [PATCH v8 04/10] fs, iov_iter: define meta io descriptor Date: Wed, 6 Nov 2024 17:48:36 +0530 Message-Id: <20241106121842.5004-5-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPJsWRmVeSWpSXmKPExsWy7bCmhq56rXa6wZRTAhYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJouj/9+yWUw6dI3RYu8tbYs9 e0+yWMxf9pTdovv6DjaL5cf/MVmc/3uc1eL8rDnsDkIeO2fdZfe4fLbUY9OqTjaPzUvqPXbf bGDz+Pj0FotH35ZVjB5nFhxh9/i8Sc5j05O3TAFcUdk2GamJKalFCql5yfkpmXnptkrewfHO 8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6ZOUA/KSmUJeaUAoUCEouLl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g-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122704epcas5p37a156fb2738c3b8194e8f81c26a07878 References: <20241106121842.5004-1-anuj20.g@samsung.com> Add flags to describe checks for integrity meta buffer. Also, introduce a new 'uio_meta' structure that upper layer can use to pass the meta/integrity information. Signed-off-by: Kanchan Joshi Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- include/linux/uio.h | 9 +++++++++ include/uapi/linux/fs.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 853f9de5aa05..8ada84e85447 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -82,6 +82,15 @@ struct iov_iter { }; }; +typedef __u16 uio_meta_flags_t; + +struct uio_meta { + uio_meta_flags_t flags; + u16 app_tag; + u64 seed; + struct iov_iter iter; +}; + static inline const struct iovec *iter_iov(const struct iov_iter *iter) { if (iter->iter_type == ITER_UBUF) diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 753971770733..9070ef19f0a3 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -40,6 +40,15 @@ #define BLOCK_SIZE_BITS 10 #define BLOCK_SIZE (1< X-Patchwork-Id: 13864987 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED13F201116 for ; Wed, 6 Nov 2024 14:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903354; cv=none; b=OiwsWSDh64Gje19TyNT1UT4W+omiLOhTdOsA79efo1eQTAKFsnGoi8ifukOsvyAzVGyTTWoeHlM2ETmKF/oddgnzo6KKfrr16n5kKXqE6cTRyMM3Syuz/CVOr36pZ5BjzA/mQCI5Vz6hJ0MD9RDWa8HFdSxHBl2YhbPYImmZmDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903354; c=relaxed/simple; bh=PPDNMGOuEvkJDIU7LllEytV2427zo9AzbP3ebXn9pJ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=KAkRT4/PKtk0IqeZQiyD1AePLJLURMtisv8EZTgCa3Hik3esrWKSGNSJB2Ixp52ZavWeVyRVTy7xJNe7TedibyqF/l1J+dEQtftk17U6smQPtoRV/JESxWROZaCaVXYk/ES7h4H88xlWQ2Yo5OHdKhwi0RdIL2yzFBhsNLIvH5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=FAzQbwKs; arc=none smtp.client-ip=203.254.224.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="FAzQbwKs" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20241106142909epoutp02c45497475df2cc703d9ebb71399b4edd~FZ2zynde_1336813368epoutp02D for ; Wed, 6 Nov 2024 14:29:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20241106142909epoutp02c45497475df2cc703d9ebb71399b4edd~FZ2zynde_1336813368epoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903349; bh=0Qev84oB/WNNKAORKgHjGWYS6Jca41BG3ZIzsvdmNNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FAzQbwKsTwvoJdhonO9VuNhMcbkLg2c8cKJVpdNlQ6CoscdrPap/OTJzYL5KiunFC mZxwbMrEcYhjBLYrsHY9WG9ACUJqnQakqfp1wSzWA1F0e1pV9LlvACotab+GoEtB8t NqbHHkFujtnpoqxbQ39h4UVzI6n3q4Kw4OV14Kyw= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241106142907epcas5p4cd812cc8e7fc11874341fdc6f71c87ad~FZ2yc_mFs2211422114epcas5p43; Wed, 6 Nov 2024 14:29:07 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.182]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Xk6yp2rNJz4x9Pp; Wed, 6 Nov 2024 14:29:06 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id C2.3F.09420.23D7B276; Wed, 6 Nov 2024 23:29:06 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241106122707epcas5p4569e1ddc2ded4de5da6663fb7ffc9464~FYMQt5zRh2745227452epcas5p4C; Wed, 6 Nov 2024 12:27:07 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241106122707epsmtrp2d7c95e110d83e1218218e7b8efeebd69~FYMQtC4LE2560925609epsmtrp2X; Wed, 6 Nov 2024 12:27:07 +0000 (GMT) X-AuditID: b6c32a49-33dfa700000024cc-44-672b7d3224ca Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 28.01.35203.B906B276; Wed, 6 Nov 2024 21:27:07 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122704epsmtip17756c41bf463aa6063af90bb7e9c5a3f~FYMORbEts0844908449epsmtip1b; Wed, 6 Nov 2024 12:27:04 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta Subject: [PATCH v8 05/10] fs: introduce IOCB_HAS_METADATA for metadata Date: Wed, 6 Nov 2024 17:48:37 +0530 Message-Id: <20241106121842.5004-6-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJJsWRmVeSWpSXmKPExsWy7bCmlq5RrXa6wYLbIhYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJotJh64xWuy9pW2xZ+9JFov5 y56yW3Rf38Fmsfz4PyaL83+Ps1qcnzWH3UHQY+esu+wel8+Wemxa1cnmsXlJvcfumw1sHh+f 3mLx6NuyitHjzIIj7B6fN8l5bHrylimAKyrbJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ 19DSwlxJIS8xN9VWycUnQNctMwfoHSWFssScUqBQQGJxsZK+nU1RfmlJqkJGfnGJrVJqQUpO gUmBXnFibnFpXrpeXmqJlaGBgZEpUGFCdsba02sYC66wVqy/1cLYwHiNpYuRg0NCwETi6SPm LkYuDiGB3YwSP7o/MkI4nxgl+v93sUI43xglWs4vZe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y56yW3Rf38Fmsfz4PyaL83+Ps1qcnzWH3UHQY+esu+wel8+Wemxa1cnmsXlJvcfumw1sHh+f 3mLx6NuyitHjzIIj7B6fN8l5bHrylimAK4rLJiU1J7MstUjfLoErY+3pNYwFV1gr1t9qYWxg vMbSxcjJISFgIrH72jTmLkYuDiGB3YwS5yc/ZIRISEicerkMyhaWWPnvOTtE0UdGiZVn54B1 swmoSxx53gpWJCJwglFi/kQ3kCJmkKIJX2aDFQkLuEnc7J/EBGKzCKhK3NnSygxi8wpYSLx4 s5sVYoO8xMxL39lBbE4BS4mzn7eBDRUCqvmzoA+qXlDi5MwnYDOZgeqbt85mnsAoMAtJahaS 1AJGplWMkqkFxbnpucWGBYZ5qeV6xYm5xaV56XrJ+bmbGMGRpqW5g3H7qg96hxiZOBgPMUpw MCuJ8PpHaacL8aYkVlalFuXHF5XmpBYfYpTmYFES5xV/0ZsiJJCeWJKanZpakFoEk2Xi4JRq YCr8OanVlt/IluWG8vHrUn9nib493fUz5EzNK7kPDd379rXP//Va6vnSLsHgDLb9vze+m/tR Yerfa4pqF27t2GP1yK7r8a/K2HbhI1wp6ik5m5o9nd8tk/t40M+k9VhHmWKzUuCajgz2WxIK 0tnqb95smaWQ4TMlfN22tr1ZN/s2F9ze8GLOG/snav/jCpozn/rJTk9+pzTXrmpPoCznwSbv P+8PXwr2MfD6Oi+8yMVoYmlyqKhReYOQMecD3ZQu1Q1KN2W+vAyxaVHY/GVhJWP+vz++Yjai 09cq3ziSPF1B7ld34gUF1bp6m1llpezXf9kUJSdzqeSev6Mjk1NpVtBV9b9t+5Pkj5fUDcV3 KLEUZyQaajEXFScCAEUlpbcjAwAA X-CMS-MailID: 20241106122707epcas5p4569e1ddc2ded4de5da6663fb7ffc9464 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122707epcas5p4569e1ddc2ded4de5da6663fb7ffc9464 References: <20241106121842.5004-1-anuj20.g@samsung.com> Introduce an IOCB_HAS_METADATA flag for the kiocb struct, for handling requests containing meta payload. Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- include/linux/fs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/fs.h b/include/linux/fs.h index 4b5cad44a126..7f14675b02df 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -346,6 +346,7 @@ struct readahead_control; #define IOCB_DIO_CALLER_COMP (1 << 22) /* kiocb is a read or write operation submitted by fs/aio.c. */ #define IOCB_AIO_RW (1 << 23) +#define IOCB_HAS_METADATA (1 << 24) /* for use in trace events */ #define TRACE_IOCB_STRINGS \ From patchwork Wed Nov 6 12:18:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13864988 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E73B204089 for ; Wed, 6 Nov 2024 14:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903360; cv=none; b=M3pBsfxJpK36adiUV7PMWqHSygkZK8kjqw26AZ1A8lp5uoDGlGnvtzvDp2SS7k+UwE4IVweodk5PFsE1xgo1q/n+oeGOy+gE8EzRZ7DQgpQHuSnpiJs9twYsK7X/KL0bGnWtltVAWiWB8NeA4E3sNf6bOQo0hpBG6iOYl6bhvsI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903360; c=relaxed/simple; bh=vjxdBdp64rm8RjorcVn2hOzHxOGxKLwK2a0ZXuTRBZs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=FXCN/zOkmerGnGMfy+XXiJa9kSM8i51PGetYQb3hShU3sOHXsW17u99bZgDa6lzJ2EYHd4rm1MzMboaa1wlcRWASLVLb9mwKQoHd6S4YuKdGTXDGAEaZSaBnmIug03tGqrajblLL4unKQd9U+uMpNRACwwD6X1wWCu8pOzGo9zo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=CfFSniI9; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="CfFSniI9" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241106142916epoutp01a5e72dbef334792c271ddd346feaa544~FZ26iIhyE1768117681epoutp01h for ; Wed, 6 Nov 2024 14:29:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241106142916epoutp01a5e72dbef334792c271ddd346feaa544~FZ26iIhyE1768117681epoutp01h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903356; bh=IxUlGcaj6NqxOHXfHU9yU0+wSoAwPoFgg7rzz4PBUT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CfFSniI9eiUp3YwMEf0moYv5oSFUJTcab7ougKl2X3MuYkcQXuQxn1IfqTa33h5K5 L7PKtvK5CvznHy9427PLmpzNqmgs2UzYHO3+4qHcXjUzRhXbX1oOLTuM96x9rXyHMd qPe4C/o2hs/XaiTMJTg9Byvv8PlhyVGNn26qycKc= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241106142915epcas5p36b0274ba7970aba75b9bbbc1914447ec~FZ25oIHmk2414024140epcas5p3W; Wed, 6 Nov 2024 14:29:15 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.183]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Xk6yx6XpVz4x9Pt; Wed, 6 Nov 2024 14:29:13 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 0E.EC.08574.93D7B276; Wed, 6 Nov 2024 23:29:13 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241106122710epcas5p2b314c865f8333c890dd6f22cf2edbe2f~FYMTUFsua1874618746epcas5p23; Wed, 6 Nov 2024 12:27:10 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241106122710epsmtrp242b0e382b2244a9243bc06d80c9a88d1~FYMTTS-BB2560925609epsmtrp2a; Wed, 6 Nov 2024 12:27:10 +0000 (GMT) X-AuditID: b6c32a44-93ffa7000000217e-cc-672b7d392eb3 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 4B.75.18937.E906B276; Wed, 6 Nov 2024 21:27:10 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122707epsmtip1075b119a12728ffebf749e14a016be02~FYMQwKDe70829608296epsmtip1_; Wed, 6 Nov 2024 12:27:07 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta , Kanchan Joshi Subject: [PATCH v8 06/10] io_uring/rw: add support to send metadata along with read/write Date: Wed, 6 Nov 2024 17:48:38 +0530 Message-Id: <20241106121842.5004-7-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01Tf0xTVxj1vvd8LRjms7Bw7aY2z6EDBrRaulsibNkIPJxRkm0uIgYrfSkI tLWvRXEhogyJDiw/Yhg/HN0kInTBrSDCoGYBlIgDJ6AVlYUZ6pwIjoJxGQPW9sHmf+fce853 7vfde4W46CEpFqZrjaxBq8qkSV+itTs4OEyZG6qRFlfI0PSLOQKdKJnHUU1jK0DWUTOJJrpd AI381I6hBus1DE0VDBCouiIfQ9cWJ0lU1nUXIPv9UNRpv0Gg2gtOAfrS0Uai+t4FDN2a712J blXVCN4XMe1VowJmqN/E2BpPkUxz3TGmYySPZKad9wnmTEsjYH629AiYGdt6xjY+iSX6JmVs S2NVatYgYbWpOnW6VhNNf/RxyocpkQqpLEymRO/SEq0qi42mY3ckhsWlZ7p7oiXZqkyTeylR xXF0RMw2g85kZCVpOs4YTbN6daZerg/nVFmcSasJ17LGKJlUuiXSLdyfkXanI1d/mzniuncZ 5AFn1GngI4SUHDqmG/DTwFcoojoAXFiwYzxxAThW+ivhUXlJS5P/sqPO/ouAF7UDODv4dInM AGh+/szrIKnNsOf3AuDZCKA6ASz+5ibhIThVgsHC0hqBR+VP7YXHrX3AgwkqCDq7yzEP9qMQ HLO4MD5vA6wcfOnV+1BK2D/TCnjNGnijctybhrs1+ZervV1AalgIux//7RYJ3SQW/nN9JV/H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YJLo+bWCDSQhLBAp8WfzAbAiFgFViaeHJzOB 2LwCFhIPFnxigtggLzHz0nd2EJtTwFLi7OdtYPVCQDV/FvQxQ9QLSpyc+YQFxGYGqm/eOpt5 AqPALCSpWUhSCxiZVjGKphYU56bnJhcY6hUn5haX5qXrJefnbmIER5pW0A7GZev/6h1iZOJg PMQowcGsJMLrH6WdLsSbklhZlVqUH19UmpNafIhRmoNFSZxXOaczRUggPbEkNTs1tSC1CCbL xMEp1cC0zGVLbaKYyt/f297H3ruSp1YcynjH65ph2C62SPEJl440mQofOxYby//He4d5xImu 9VcCt+zly2aTl2pdJD7NgLVv5uopysefuzy+s/KNkOcTtmxtw39iukGWaStnSXWWqbBFSK76 2rPTI33jAx5H4YmV2ZfVdtxQ2tiREBWw5+nvrQee1R/vkE5ysk2/1KDDVrs94vyV9zum7jL+ zGi15HrN+0xRy7VsnNpnJ/PPfldrO7NzMs+dvzeql15PvpGVMTX1kHcI2x3RplsLnzGcmbpg StXPzX6OArl/H5zn4lPTczBSKckwVLl8XCF8+tsD7Lv3f14oWiISE2LrbOX1+t3DY30M95l2 bK0QuxSqxFKckWioxVxUnAgA9/SX5iMDAAA= X-CMS-MailID: 20241106122710epcas5p2b314c865f8333c890dd6f22cf2edbe2f X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122710epcas5p2b314c865f8333c890dd6f22cf2edbe2f References: <20241106121842.5004-1-anuj20.g@samsung.com> This patch adds the capability of passing integrity metadata along with read/write. A new ext_cap (extended_capability) field is introduced in SQE which indicates the type of extra information being sent. A new 'struct io_uring_sqe_ext' represents the secondary SQE space for read/write. In future if another extension needs to be added, then one needs to: 1. Add extra fields in the sqe/secondary-sqe 2. Introduce a ext_cap flag indicating additional values that have been passed The last 32 bytes of secondary SQE is used to pass following PI related information: - flags: integrity check flags namely IO_INTEGRITY_CHK_{GUARD/APPTAG/REFTAG} - len: length of the pi/metadata buffer - buf: address of the metadata buffer - seed: seed value for reftag remapping - app_tag: application defined 16b value Application sets up a SQE128 ring, prepares PI information within the second SQE and sets the ext_cap field to EXT_CAP_PI. The patch processes this information to prepare uio_meta descriptor and passes it down using kiocb->private. Meta exchange is supported only for direct IO. Also vectored read/write operations with meta are not supported currently. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi --- include/uapi/linux/io_uring.h | 34 ++++++++++++++ io_uring/io_uring.c | 8 ++++ io_uring/rw.c | 88 ++++++++++++++++++++++++++++++++++- io_uring/rw.h | 14 +++++- 4 files changed, 141 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 56cf30b49ef5..449e7627b1b5 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -92,6 +92,11 @@ struct io_uring_sqe { __u16 addr_len; __u16 __pad3[1]; }; + struct { + /* flags indicating additional information being passed */ + __u16 ext_cap; + __u16 __pad4[1]; + }; }; union { struct { @@ -107,6 +112,35 @@ struct io_uring_sqe { }; }; +enum io_uring_sqe_ext_cap_bits { + EXT_CAP_PI_BIT, + /* + * not a real extended capability; just to make sure that we don't + * overflow + */ + EXT_CAP_LAST_BIT, +}; + +/* extended capability flags */ +#define EXT_CAP_PI (1U << EXT_CAP_PI_BIT) + +/* Second half of SQE128 for IORING_OP_READ/WRITE */ +struct io_uring_sqe_ext { + __u64 rsvd0[4]; + /* if sqe->ext_cap is EXT_CAP_PI, last 32 bytes are for PI */ + union { + __u64 rsvd1[4]; + struct { + __u16 flags; + __u16 app_tag; + __u32 len; + __u64 addr; + __u64 seed; + __u64 rsvd; + } rw_pi; + }; +}; + /* * If sqe->file_index is set to this for opcodes that instantiate a new * direct descriptor (like openat/openat2/accept), then io_uring will allocate diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index b590e50f09e7..6e582fe93bc4 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -4165,7 +4165,9 @@ static int __init io_uring_init(void) BUILD_BUG_SQE_ELEM(44, __s32, splice_fd_in); BUILD_BUG_SQE_ELEM(44, __u32, file_index); BUILD_BUG_SQE_ELEM(44, __u16, addr_len); + BUILD_BUG_SQE_ELEM(44, __u16, ext_cap); BUILD_BUG_SQE_ELEM(46, __u16, __pad3[0]); + BUILD_BUG_SQE_ELEM(46, __u16, __pad4[0]); BUILD_BUG_SQE_ELEM(48, __u64, addr3); BUILD_BUG_SQE_ELEM_SIZE(48, 0, cmd); BUILD_BUG_SQE_ELEM(56, __u64, __pad2); @@ -4192,6 +4194,12 @@ static int __init io_uring_init(void) /* top 8bits are for internal use */ BUILD_BUG_ON((IORING_URING_CMD_MASK & 0xff000000) != 0); + BUILD_BUG_ON(sizeof(struct io_uring_sqe_ext) != + sizeof(struct io_uring_sqe)); + + BUILD_BUG_ON(EXT_CAP_LAST_BIT > + 8 * sizeof_field(struct io_uring_sqe, ext_cap)); + io_uring_optable_init(); /* diff --git a/io_uring/rw.c b/io_uring/rw.c index 768a908ca2a8..e60bf0ed4c4f 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -257,11 +257,64 @@ static int io_prep_rw_setup(struct io_kiocb *req, int ddir, bool do_import) return 0; } +static inline void io_meta_save_state(struct io_async_rw *io) +{ + io->meta_state.seed = io->meta.seed; + iov_iter_save_state(&io->meta.iter, &io->meta_state.iter_meta); +} + +static inline void io_meta_restore(struct io_async_rw *io) +{ + io->meta.seed = io->meta_state.seed; + iov_iter_restore(&io->meta.iter, &io->meta_state.iter_meta); +} + +static inline const void *io_uring_sqe_ext(const struct io_uring_sqe *sqe) +{ + return (sqe + 1); +} + +static int io_prep_rw_pi(struct io_kiocb *req, const struct io_uring_sqe *sqe, + struct io_rw *rw, int ddir) +{ + const struct io_uring_sqe_ext *sqe_ext; + const struct io_issue_def *def; + struct io_async_rw *io; + int ret; + + if (!(req->ctx->flags & IORING_SETUP_SQE128)) + return -EINVAL; + + sqe_ext = io_uring_sqe_ext(sqe); + if (READ_ONCE(sqe_ext->rsvd0[0]) || READ_ONCE(sqe_ext->rsvd0[1]) + || READ_ONCE(sqe_ext->rsvd0[2]) || READ_ONCE(sqe_ext->rsvd0[3])) + return -EINVAL; + if (READ_ONCE(sqe_ext->rw_pi.rsvd)) + return -EINVAL; + + def = &io_issue_defs[req->opcode]; + if (def->vectored) + return -EOPNOTSUPP; + + io = req->async_data; + io->meta.flags = READ_ONCE(sqe_ext->rw_pi.flags); + io->meta.app_tag = READ_ONCE(sqe_ext->rw_pi.app_tag); + io->meta.seed = READ_ONCE(sqe_ext->rw_pi.seed); + ret = import_ubuf(ddir, u64_to_user_ptr(READ_ONCE(sqe_ext->rw_pi.addr)), + READ_ONCE(sqe_ext->rw_pi.len), &io->meta.iter); + if (unlikely(ret < 0)) + return ret; + rw->kiocb.ki_flags |= IOCB_HAS_METADATA; + io_meta_save_state(io); + return ret; +} + static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, int ddir, bool do_import) { struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); unsigned ioprio; + u16 ext_cap; int ret; rw->kiocb.ki_pos = READ_ONCE(sqe->off); @@ -279,11 +332,23 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, rw->kiocb.ki_ioprio = get_current_ioprio(); } rw->kiocb.dio_complete = NULL; + rw->kiocb.ki_flags = 0; rw->addr = READ_ONCE(sqe->addr); rw->len = READ_ONCE(sqe->len); rw->flags = READ_ONCE(sqe->rw_flags); - return io_prep_rw_setup(req, ddir, do_import); + ret = io_prep_rw_setup(req, ddir, do_import); + + if (unlikely(ret)) + return ret; + + ext_cap = READ_ONCE(sqe->ext_cap); + if (ext_cap) { + if (READ_ONCE(sqe->__pad4[0]) || !(ext_cap & EXT_CAP_PI)) + return -EINVAL; + ret = io_prep_rw_pi(req, sqe, rw, ddir); + } + return ret; } int io_prep_read(struct io_kiocb *req, const struct io_uring_sqe *sqe) @@ -410,7 +475,10 @@ static inline loff_t *io_kiocb_update_pos(struct io_kiocb *req) static void io_resubmit_prep(struct io_kiocb *req) { struct io_async_rw *io = req->async_data; + struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); + if (rw->kiocb.ki_flags & IOCB_HAS_METADATA) + io_meta_restore(io); iov_iter_restore(&io->iter, &io->iter_state); } @@ -795,7 +863,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type) if (!(req->flags & REQ_F_FIXED_FILE)) req->flags |= io_file_get_flags(file); - kiocb->ki_flags = file->f_iocb_flags; + kiocb->ki_flags |= file->f_iocb_flags; ret = kiocb_set_rw_flags(kiocb, rw->flags, rw_type); if (unlikely(ret)) return ret; @@ -829,6 +897,18 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type) kiocb->ki_complete = io_complete_rw; } + if (kiocb->ki_flags & IOCB_HAS_METADATA) { + struct io_async_rw *io = req->async_data; + + /* + * We have a union of meta fields with wpq used for buffered-io + * in io_async_rw, so fail it here. + */ + if (!(req->file->f_flags & O_DIRECT)) + return -EOPNOTSUPP; + kiocb->private = &io->meta; + } + return 0; } @@ -903,6 +983,8 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags) * manually if we need to. */ iov_iter_restore(&io->iter, &io->iter_state); + if (kiocb->ki_flags & IOCB_HAS_METADATA) + io_meta_restore(io); do { /* @@ -1126,6 +1208,8 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags) } else { ret_eagain: iov_iter_restore(&io->iter, &io->iter_state); + if (kiocb->ki_flags & IOCB_HAS_METADATA) + io_meta_restore(io); if (kiocb->ki_flags & IOCB_WRITE) io_req_end_write(req); return -EAGAIN; diff --git a/io_uring/rw.h b/io_uring/rw.h index 3f432dc75441..2d7656bd268d 100644 --- a/io_uring/rw.h +++ b/io_uring/rw.h @@ -2,6 +2,11 @@ #include +struct io_meta_state { + u32 seed; + struct iov_iter_state iter_meta; +}; + struct io_async_rw { size_t bytes_done; struct iov_iter iter; @@ -9,7 +14,14 @@ struct io_async_rw { struct iovec fast_iov; struct iovec *free_iovec; int free_iov_nr; - struct wait_page_queue wpq; + /* wpq is for buffered io, while meta fields are used with direct io */ + union { + struct wait_page_queue wpq; + struct { + struct uio_meta meta; + struct io_meta_state meta_state; + }; + }; }; int io_prep_read_fixed(struct io_kiocb *req, const struct io_uring_sqe *sqe); From patchwork Wed Nov 6 12:18:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13864989 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 622F420110E for ; Wed, 6 Nov 2024 14:29:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903367; cv=none; b=TmPsKLFlw3x1GhgyGLcIwxsRq2mkIGoYZ9wY+uPLNu7qaywG9hlCa1NUbhQybCjqwKsL4rRL5X4/xTNlrBGn197uxAApmIujGiwuvcnqCUPlkXvp4eqO/c4l781UgKRBcVHI6N+KHKKMp50t/wCK2VfV96BoKIipWs1Q+v1xIHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903367; c=relaxed/simple; bh=qGAzfkEOHOpm8kpRVtxmLwS1O3CyRbF7YVklUKFKOj0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=Vxpxz/dt1IyX0urLEtEdy3EJLzIf6pmeMYyh2ksADlOAv5kcj9FLL1zjnq7OkYr8vUdaojFc6itn70Iq4pgDmbCMEroWYV8qFjA5ixPQFuHX+tquLWDNHxmrx2JPrK851V2oSkrqOzoc25NDg9uVtK5Qse0iV35+2AMekt4SnZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=SE1x7xjJ; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="SE1x7xjJ" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241106142923epoutp038c8521a6bfff980c39d6bc4bb617ebdf~FZ3BPxWK62019520195epoutp03O for ; Wed, 6 Nov 2024 14:29:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241106142923epoutp038c8521a6bfff980c39d6bc4bb617ebdf~FZ3BPxWK62019520195epoutp03O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903363; bh=OTz/QgjwERHOOBHdZDM2jYUNAR5ftRU78+qZ7ID4M2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SE1x7xjJ0zkZL2Jt/W9SPh4YR7lrGbNbJMeYJ9Z+9fUz+UU5DjTsU55ntdCsSp9YT PW0/6HKLj73My995FbuuHZaFiQbFF3IekX6OGzhH8iavc3OopjvEh4VBEOgvz9fB0o pW8uQiBjLj+HTrKagituiW6Eg3geT0IlAdPPAFyI= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241106142923epcas5p3d41245122c5a779a11d78178e7a4c5ab~FZ3AuoV5m2414024140epcas5p3h; Wed, 6 Nov 2024 14:29:23 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.175]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Xk6z53w6Yz4x9Pp; Wed, 6 Nov 2024 14:29:21 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 72.FC.08574.14D7B276; Wed, 6 Nov 2024 23:29:21 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241106122713epcas5p433c4b14f82da79176c3e8bf6835054fe~FYMWAHqgo0572105721epcas5p4o; Wed, 6 Nov 2024 12:27:13 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241106122713epsmtrp1e1718f0909b7b5f8621d106e3b081bb1~FYMV-JcQv2054020540epsmtrp1G; Wed, 6 Nov 2024 12:27:13 +0000 (GMT) X-AuditID: b6c32a44-6dbff7000000217e-dd-672b7d4124c8 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 3C.26.07371.0A06B276; Wed, 6 Nov 2024 21:27:12 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122710epsmtip1cd212eea3ee9400a5707d69507477895~FYMTZzBpc0844908449epsmtip1e; Wed, 6 Nov 2024 12:27:10 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta , Kanchan Joshi Subject: [PATCH v8 07/10] block: introduce BIP_CHECK_GUARD/REFTAG/APPTAG bip_flags Date: Wed, 6 Nov 2024 17:48:39 +0530 Message-Id: <20241106121842.5004-8-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Te1BUVRzHOfde7+7CrN0WmA6UCNecBATZWNZDio+BYe6kM9Ho1Ix/SHd2 rwvDPm77qMgYKFqY8MGjURLXQCJ2XGZEQF4BashDKHCCEiHQSmAl2uKhbUZAu+xS/vf5/c73 e36/33kIcckEGSxM1xo5vZZV06Qv0XQzfFvU/qxIVUxdJUTzj5cI9FHRMo4stiaAaiYKSTR7 cwGg0RutGLpU042h382DBDpfmouh7lUHiUo67wDUMRaJ2jv6CFRePSVAJ0ZaSGTtXcHQ7eXe Deh2mUWwT8K0lk0ImOEBE1Nv+4RkGqqymbbRHJKZnxojmNNXbYD5tqJLwCzWhzD1kw4sxfdI xu40jlVy+lBOq9Ap07WqBPrAodTE1Dh5jDRKGo920qFaVsMl0EkHU6KS09WumejQd1i1yZVK YQ0Gesee3XqdyciFpukMxgSa45VqXsZHG1iNwaRVRWs54yvSmJiX41zCtzLSii0/kfx00HtV zlksB1gDC4BICCkZvNbdu6EA+AolVBuAuasWzBMsADgyfAZzqyTUnwAuT2SsOx4uOEiPqAPA 3/ruAE+wCKB1rnvNQVIvwS67eW0hgGoH8NTFbwh3gFNFGMwvtggKgFDoTx2GFrPCbSCorXD1 +xnSnRZTCDqd3v42w3NDToGbRVQ8HFhsAm4WU8/CvnOThJtxlya38Tzu3h5S40JoHbATHnMS zBt6IvCwP/y196qXg+FMYZ6XVfCv4SnMwzzM7bkGPLwXmvsLcXc/OBUOa7/a4Ulvgmf6L2Oe uhvhqaVJr1UMWz5fZxrmX7J4G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ktQCRqZVjJKpBcW56bnJhgWGeanlesWJucWleel6yfm5mxjB8aalsYPx3vx/ eocYmTgYDzFKcDArifD6R2mnC/GmJFZWpRblxxeV5qQWH2KU5mBREuc1nDE7RUggPbEkNTs1 tSC1CCbLxMEp1cCUeUpXzazW96mt0+tZ24ozH2dws7SYuJZd+/V9/w1embcCjZqG+6f03l80 4YPAFW2brsueWWpaNu81tjw/pG3T78pdwWDXX5XzyvTy3akaUipVpXLzlZvYN6x8YWngdMxq 7o2b8xO8z04NC/O4NM3HQr6caX5V3tru4OkzG4+XO5z0vX308F/RtNW3OCdsNj+huELx3/Yr 3KXveJ1jj162cPHyvMnOK6ql8lA7M+n7j63hap0CJTvPV7r8EjE3CO2uTHlQpXr9osa9XTwS LIdcHJi+rlt8QKLhSVj2350buC5/d9SfISu6d9/T5TqnP/IZPOpjLRcr6f17a5GQzcrOt/OC k9hUjATlqwouGiuxFGckGmoxFxUnAgB1i4kFJgMAAA== X-CMS-MailID: 20241106122713epcas5p433c4b14f82da79176c3e8bf6835054fe X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122713epcas5p433c4b14f82da79176c3e8bf6835054fe References: <20241106121842.5004-1-anuj20.g@samsung.com> This patch introduces BIP_CHECK_GUARD/REFTAG/APPTAG bip_flags which indicate how the hardware should check the integrity payload. BIP_CHECK_GUARD/REFTAG are conversion of existing semantics, while BIP_CHECK_APPTAG is a new flag. The driver can now just rely on block layer flags, and doesn't need to know the integrity source. Submitter of PI decides which tags to check. This would also give us a unified interface for user and kernel generated integrity. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Christoph Hellwig Reviewed-by: Keith Busch --- block/bio-integrity.c | 5 +++++ drivers/nvme/host/core.c | 11 +++-------- include/linux/bio-integrity.h | 6 +++++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index f56d01cec689..3bee43b87001 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -434,6 +434,11 @@ bool bio_integrity_prep(struct bio *bio) if (bi->csum_type == BLK_INTEGRITY_CSUM_IP) bip->bip_flags |= BIP_IP_CHECKSUM; + /* describe what tags to check in payload */ + if (bi->csum_type) + bip->bip_flags |= BIP_CHECK_GUARD; + if (bi->flags & BLK_INTEGRITY_REF_TAG) + bip->bip_flags |= BIP_CHECK_REFTAG; if (bio_integrity_add_page(bio, virt_to_page(buf), len, offset_in_page(buf)) < len) { printk(KERN_ERR "could not attach integrity payload\n"); diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index b5b5d5dd6b51..f1d1b243d8bc 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1015,18 +1015,13 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns, control |= NVME_RW_PRINFO_PRACT; } - switch (ns->head->pi_type) { - case NVME_NS_DPS_PI_TYPE3: + if (bio_integrity_flagged(req->bio, BIP_CHECK_GUARD)) control |= NVME_RW_PRINFO_PRCHK_GUARD; - break; - case NVME_NS_DPS_PI_TYPE1: - case NVME_NS_DPS_PI_TYPE2: - control |= NVME_RW_PRINFO_PRCHK_GUARD | - NVME_RW_PRINFO_PRCHK_REF; + if (bio_integrity_flagged(req->bio, BIP_CHECK_REFTAG)) { + control |= NVME_RW_PRINFO_PRCHK_REF; if (op == nvme_cmd_zone_append) control |= NVME_RW_APPEND_PIREMAP; nvme_set_ref_tag(ns, cmnd, req); - break; } } diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index 58ff9988433a..fe2bfe122db2 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -11,6 +11,9 @@ enum bip_flags { BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */ BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */ BIP_COPY_USER = 1 << 5, /* Kernel bounce buffer in use */ + BIP_CHECK_GUARD = 1 << 6, /* guard check */ + BIP_CHECK_REFTAG = 1 << 7, /* reftag check */ + BIP_CHECK_APPTAG = 1 << 8, /* apptag check */ }; struct bio_integrity_payload { @@ -31,7 +34,8 @@ struct bio_integrity_payload { }; #define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_CTRL_NOCHECK | \ - BIP_DISK_NOCHECK | BIP_IP_CHECKSUM) + BIP_DISK_NOCHECK | BIP_IP_CHECKSUM | \ + BIP_CHECK_GUARD | BIP_CHECK_REFTAG | BIP_CHECK_APPTAG) #ifdef CONFIG_BLK_DEV_INTEGRITY From patchwork Wed Nov 6 12:18:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13864990 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A75552036E4 for ; Wed, 6 Nov 2024 14:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903374; cv=none; b=hNEfXpA1Fg79xWuCRNRPEpglGorxkHaQYIZOwZsk2TZknGEz0yLtOOaI/5j7X0USJ49vdg2kP/l16t1CN4BsLzIpW5h1HeMvYZrOG7fPJn/ZPXm+KpLgD+IsPVyQndwNeCt+zUqvFkjZt8C8U2xhA2f2G8eOpK5v7Un26ocILJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903374; c=relaxed/simple; bh=v57Mkq3TaReFOJiYSfmTmfJ4LzKewFhLLD85vRtNtlQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=PoudcqbG8uJZeQgJWFjDy3/1vR+22dZWzoglMeHiSsyFViTIQP+CCatTi7H7EsML1ZST2dSqfqUtArBgs7txmst286LZgHQLY2nG1DaBbHvrEz5px44ZolABYjmseNsEHjIr89EVmD9Y4ipEAdQuqy7N1b+sYHhwWZeqIgL0ugo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=uwV+EPz9; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="uwV+EPz9" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241106142931epoutp0326ec3040ad4ab37c2390b88671dd5eb3~FZ3H8sqQt2080220802epoutp037 for ; Wed, 6 Nov 2024 14:29:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241106142931epoutp0326ec3040ad4ab37c2390b88671dd5eb3~FZ3H8sqQt2080220802epoutp037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903371; bh=Z41P+Tw8TmI51MCW7/+1acKX4G7SIcvf+xBvm2RWHlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uwV+EPz9lMUKrpbgertevat9Q++ydKf3GukrbWcimb1rBY8GEXSXqsZSnf5EA6DvK oKGexyo+fnsZcIMmfmfa/pcCgh+sWbYEedSWolWJThqBDKQmV4/ERhVaocWtcae6// oA3a9Yz1R1BHk/SDjXm2mAeialMAdYNQowlsRBoY= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241106142930epcas5p2dd9b01b267bd6084c28270f3401b3601~FZ3Hfu1Zv0777107771epcas5p2c; Wed, 6 Nov 2024 14:29:30 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.175]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Xk6zD5rN7z4x9Px; Wed, 6 Nov 2024 14:29:28 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 2C.E2.09800.84D7B276; Wed, 6 Nov 2024 23:29:28 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241106122715epcas5p1ccc25dc0bbfae6db881fecb6bd00d5e0~FYMYmh6mZ1859418594epcas5p1U; Wed, 6 Nov 2024 12:27:15 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241106122715epsmtrp2700194294705744c4474f89630fe94f7~FYMYltGYz2560925609epsmtrp2g; Wed, 6 Nov 2024 12:27:15 +0000 (GMT) X-AuditID: b6c32a4b-4a7fa70000002648-68-672b7d4826bb Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 89.23.08227.3A06B276; Wed, 6 Nov 2024 21:27:15 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122713epsmtip1504a45f8be2e394b46a5894582a9adb7~FYMWCOyXs0829608296epsmtip1C; Wed, 6 Nov 2024 12:27:13 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Kanchan Joshi , Anuj Gupta Subject: [PATCH v8 08/10] nvme: add support for passing on the application tag Date: Wed, 6 Nov 2024 17:48:40 +0530 Message-Id: <20241106121842.5004-9-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHJsWRmVeSWpSXmKPExsWy7bCmhq5HrXa6Qdt0TYuPX3+zWDRN+Mts MWfVNkaL1Xf72SxeH/7EaHHzwE4mi5WrjzJZvGs9x2Ixe3ozk8XR/2/ZLCYdusZosfeWtsWe vSdZLOYve8pu0X19B5vF8uP/mCzO/z3OanF+1hx2ByGPnbPusntcPlvqsWlVJ5vH5iX1Hrtv NrB5fHx6i8Wjb8sqRo8zC46we3zeJOex6clbpgCuqGybjNTElNQihdS85PyUzLx0WyXv4Hjn eFMzA0NdQ0sLcyWFvMTcVFslF58AXbfMHKCflBTKEnNKgUIBicXFSvp2NkX5pSWpChn5xSW2 SqkFKTkFJgV6xYm5xaV56Xp5qSVWhgYGRqZAhQnZGY1z+tgKtnBXLFo0gamB8ShnFyMHh4SA icTJI1ZdjJwcQgK7GSXefAvrYuQCsj8xSrw694sZwvnGKHF56m5GkCqQhs5ZvawQib2MEtcW f2OHcD4zSmxuW8AGUsUmoC5x5HkrI0hCRGAPo0TvwtMsIA6zwAQmiQXTtzCDVAkLBEhcOLWS FcRmEVCVuNrzACzOK2Ah8aflGAvEPnmJmZe+s4PYnAKWEmc/b2OEqBGUODnzCVgNM1BN89bZ YMdKCFzhkGh5u4gNotlFYvbJZVCDhCVeHd/CDmFLSXx+txeqJl3ix+WnTBB2gUTzsX1Qj9pL tJ7qZwaFErOApsT6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gCWEBP4k755+ygdgsAqoSV3se gG3gFbCQ+NNyjAVig7zEzEvf2UFsTgFLibOft4ENFQKpWdAHVS8ocXLmE7B6ZqD65q2zmScw CsxCkpqFJLWAkWkVo2RqQXFuem6xYYFRXmq5XnFibnFpXrpecn7uJkZwzGlp7WDcs+qD3iFG Jg7GQ4wSHMxKIrz+UdrpQrwpiZVVqUX58UWlOanFhxilOViUxHm/ve5NERJITyxJzU5NLUgt gskycXBKNTCVNETMalH11WiS3+J6Wqjv5gaLn692CT7dK+9utdyDY6+rQcnKBVd+q5U8dJby btRy2Z+nx/Y5kG3DKSavlu6074vVvI7tNd9kErbUv8aGcWbfVl2+OqUrGr+6vulf5ejnD4zQ LPD0i3CWMBCS5by266RsePXx501n5E5GL76ccFXdx8Z0geOy30LxhfyfL99clhi67ZqN3QeN xHNBQnO3bfnQfm4+o9nyx8dfzz//v/Xc4/qatPqezXEC2YqOT0uqSqX6FjsrvVZdbrLyM5// wnaPXj3HrIBnXaFyC/9sv5Zazv8vkqfr6KlzlnUHBK1/6nBpNTqa+yxT2mIzedvr9U/c5q10 mMi6ZOmJd0osxRmJhlrMRcWJANbZOvMoAwAA X-CMS-MailID: 20241106122715epcas5p1ccc25dc0bbfae6db881fecb6bd00d5e0 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122715epcas5p1ccc25dc0bbfae6db881fecb6bd00d5e0 References: <20241106121842.5004-1-anuj20.g@samsung.com> From: Kanchan Joshi With user integrity buffer, there is a way to specify the app_tag. Set the corresponding protocol specific flags and send the app_tag down. Reviewed-by: Christoph Hellwig Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Keith Busch --- drivers/nvme/host/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f1d1b243d8bc..dac2678cad96 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -883,6 +883,12 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req, return BLK_STS_OK; } +static void nvme_set_app_tag(struct request *req, struct nvme_command *cmnd) +{ + cmnd->rw.lbat = cpu_to_le16(bio_integrity(req->bio)->app_tag); + cmnd->rw.lbatm = cpu_to_le16(0xffff); +} + static void nvme_set_ref_tag(struct nvme_ns *ns, struct nvme_command *cmnd, struct request *req) { @@ -1023,6 +1029,10 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns, control |= NVME_RW_APPEND_PIREMAP; nvme_set_ref_tag(ns, cmnd, req); } + if (bio_integrity_flagged(req->bio, BIP_CHECK_APPTAG)) { + control |= NVME_RW_PRINFO_PRCHK_APP; + nvme_set_app_tag(req, cmnd); + } } cmnd->rw.control = cpu_to_le16(control); From patchwork Wed Nov 6 12:18:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13864991 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9ABCD202623 for ; Wed, 6 Nov 2024 14:29:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903381; cv=none; b=jptjXRzq/VU2wc2rsXmAZnYAZC4GaCsy9Mtp034kIcFMTEVmA4145rGk6KgDl6U/KsUr4YU1X7V6zNMRdiAHQsL1fXPb3Pbu2kRsMWVcqaZK5JKGXvivHM9migUKNiGNqxVkAEjOVf48Zr6Ln764c+BzPS9hxG31XrJ5vtiRQig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903381; c=relaxed/simple; bh=jraNWLaKHsTQe0pu2Jm0KWwiaQvYjmTAMdus/DUn6fU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=hasN1QxelFDkQT9+hbXcj5H2fsVMrzexNKwnLEGlepovRTP4n44/3ZFMGmkslbUdMptRixFADGevlN3rrJFq6e4c+8eHBimOEqa5WTa04WPhtX7MUVk3dZBTTyr016rG5PJXOHJ8YsZ8ryWRyK9F+WUDbF9gd6qOefj1Wsy5qb0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=bjg7bWLQ; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="bjg7bWLQ" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241106142938epoutp014cb0942c6c3a319ac35e7a4331a17224~FZ3ObfOh42053720537epoutp01e for ; Wed, 6 Nov 2024 14:29:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241106142938epoutp014cb0942c6c3a319ac35e7a4331a17224~FZ3ObfOh42053720537epoutp01e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903378; bh=og22ywRlDp0pEXMrdTg3MkhTF5pEsbsojrZbbFE+yGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bjg7bWLQ9a8OQt8nVelvpapavWPRC9Nr9sBd2OB6kN+TwpcMOG+XutOdb8a2lLoX1 lLLbIm+lq61Tzfv6fJLJ1+GWqkhvcqSuXcp2lY5ZMiCjpUTurGhh6M1jWuo5eb3wKV nRF9YPALQqhepUtBDTHQqTsiNR0CgDOfaLhdJE5c= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241106142937epcas5p3f7494817e484f48662c295bde7629a55~FZ3N-l8zu2414124141epcas5p3i; Wed, 6 Nov 2024 14:29:37 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.183]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Xk6zM5nhXz4x9Pv; Wed, 6 Nov 2024 14:29:35 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 97.3F.09420.F4D7B276; Wed, 6 Nov 2024 23:29:35 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241106122718epcas5p184094be8de895aa606170da9f4204ae0~FYMbDZH0R0260102601epcas5p1l; Wed, 6 Nov 2024 12:27:18 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241106122718epsmtrp1397a6b6955997363c5489e49ce41e211~FYMbCWeiW2054020540epsmtrp1P; Wed, 6 Nov 2024 12:27:18 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-73-672b7d4f01bc Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 3D.75.18937.6A06B276; Wed, 6 Nov 2024 21:27:18 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122716epsmtip12c34a08a7c5a7b109f9440d887ed60b1~FYMYpssUO0886208862epsmtip1E; Wed, 6 Nov 2024 12:27:15 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta Subject: [PATCH v8 09/10] scsi: add support for user-meta interface Date: Wed, 6 Nov 2024 17:48:41 +0530 Message-Id: <20241106121842.5004-10-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJJsWRmVeSWpSXmKPExsWy7bCmuq5/rXa6Qcc6LYuPX3+zWDRN+Mts MWfVNkaL1Xf72SxeH/7EaHHzwE4mi5WrjzJZvGs9x2Ixe3ozk8WkQ9cYLfbe0rbYs/cki8X8 ZU/ZLbqv72CzWH78H5PF+b/HWS3Oz5rD7iDosXPWXXaPy2dLPTat6mTz2Lyk3mP3zQY2j49P b7F49G1ZxehxZsERdo/Pm+Q8Nj15yxTAFZVtk5GamJJapJCal5yfkpmXbqvkHRzvHG9qZmCo a2hpYa6kkJeYm2qr5OIToOuWmQP0jpJCWWJOKVAoILG4WEnfzqYov7QkVSEjv7jEVim1ICWn wKRArzgxt7g0L10vL7XEytDAwMgUqDAhO2Pqtx72gvOiFQ2ve9kbGK8IdjFyckgImEh86m9n 6mLk4hAS2M0osXh5FzOE84lR4sH/fexwDjCUWGBaphz/BdWyk1Hiw4/TLBDOZ0aJFc+7mECq 2ATUJY48b2UESYgI7GGU6F0IUcUs8JJRYumqRUAOB4ewgLPEjleVIA0sAqoSfz6tYgOxeQUs JZo/TGaDWCcvMfPSd3YQmxMofvbzNkaIGkGJkzOfgJ3ED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TBAJCYlTL5cxQtjCEiv/PWcHsYUEPjJKrPkh DGKzCahLHHneClYjInCCUWL+RDeQQcwgNRO+zGbpYuTgEBZwltjxqhKkhkVAVeLPp1VsIDav gKVE84fJbBDz5SVmXvoONp8TKH728zZGiF0WEn8W9DFD1AtKnJz5hAXEZgaqb946m3kCo8As JKlZSFILGJlWMYqmFhTnpucmFxjqFSfmFpfmpesl5+duYgRHl1bQDsZl6//qHWJk4mA8xCjB wawkwusfpZ0uxJuSWFmVWpQfX1Sak1p8iFGag0VJnFc5pzNFSCA9sSQ1OzW1ILUIJsvEwSnV wLQj5GEOS/ErmUg17ldLZR7O0r64/0vppjSvc3M7LBe94q/IYnrsw9zw7d9F7jO8Z9QN/3F6 3Xx376rL90qvo0KfRRQSPIxOBsTInxHSaBPYG7R436moSQkJqU4b5vQ2Ci464hWuwP9BNdqj 4N0yP7uOrUsaXGw38Lt99c3e4Pltu/ahsOwjJ9LXu909toPx1uTjbevfP9xvI/bodlDgqeWX /trejwt6ffvKpDs7l0dxyisdiji13DTM6PFNn8tnE57GK8l+fba+bsLcA9csYqwTX695oXLq cBLDo/Pfz7XdmTD1ofsrkXkLub6uajp26NPLukKWyadmPX1lHlWUXVNZcOzEmSX3nKfZzbm1 2jJbQYmlOCPRUIu5qDgRADIYf8EdAwAA X-CMS-MailID: 20241106122718epcas5p184094be8de895aa606170da9f4204ae0 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122718epcas5p184094be8de895aa606170da9f4204ae0 References: <20241106121842.5004-1-anuj20.g@samsung.com> Add support for sending user-meta buffer. Set tags to be checked using flags specified by user/block-layer. With this change, BIP_CTRL_NOCHECK becomes unused. Remove it. Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 4 ++-- include/linux/bio-integrity.h | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ca4bc0ac76ad..d1a2ae0d4c29 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -814,14 +814,14 @@ static unsigned char sd_setup_protect_cmnd(struct scsi_cmnd *scmd, if (bio_integrity_flagged(bio, BIP_IP_CHECKSUM)) scmd->prot_flags |= SCSI_PROT_IP_CHECKSUM; - if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false) + if (bio_integrity_flagged(bio, BIP_CHECK_GUARD)) scmd->prot_flags |= SCSI_PROT_GUARD_CHECK; } if (dif != T10_PI_TYPE3_PROTECTION) { /* DIX/DIF Type 0, 1, 2 */ scmd->prot_flags |= SCSI_PROT_REF_INCREMENT; - if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false) + if (bio_integrity_flagged(bio, BIP_CHECK_REFTAG)) scmd->prot_flags |= SCSI_PROT_REF_CHECK; } diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index fe2bfe122db2..2195bc06dcde 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -7,13 +7,12 @@ enum bip_flags { BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */ BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */ - BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */ - BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */ - BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */ - BIP_COPY_USER = 1 << 5, /* Kernel bounce buffer in use */ - BIP_CHECK_GUARD = 1 << 6, /* guard check */ - BIP_CHECK_REFTAG = 1 << 7, /* reftag check */ - BIP_CHECK_APPTAG = 1 << 8, /* apptag check */ + BIP_DISK_NOCHECK = 1 << 2, /* disable disk integrity checking */ + BIP_IP_CHECKSUM = 1 << 3, /* IP checksum */ + BIP_COPY_USER = 1 << 4, /* Kernel bounce buffer in use */ + BIP_CHECK_GUARD = 1 << 5, /* guard check */ + BIP_CHECK_REFTAG = 1 << 6, /* reftag check */ + BIP_CHECK_APPTAG = 1 << 7, /* apptag check */ }; struct bio_integrity_payload { @@ -33,8 +32,7 @@ struct bio_integrity_payload { struct bio_vec bip_inline_vecs[];/* embedded bvec array */ }; -#define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_CTRL_NOCHECK | \ - BIP_DISK_NOCHECK | BIP_IP_CHECKSUM | \ +#define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_IP_CHECKSUM | \ BIP_CHECK_GUARD | BIP_CHECK_REFTAG | BIP_CHECK_APPTAG) #ifdef CONFIG_BLK_DEV_INTEGRITY From patchwork Wed Nov 6 12:18:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13864992 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 876E92038A1 for ; Wed, 6 Nov 2024 14:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903391; cv=none; b=iZ9YWqtVgFllGkYskL6L39l9cF8ivDpmjkGdkju4H8ynDS337b2C6McKOxbc73tAUevjukqVSCe3+NgQJExtB7pmOU3nJqQdw+DLjbSpxaYCYW3phWQX4tZekr11g8R1Pqg7EyjjWxoCkN8ywm21hZTaStARGycJByrO3RA/x9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903391; c=relaxed/simple; bh=3+EpeSIcCbF/6ZjkqBAtW4O9T46NdqwVVHXXGudPBqs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=IYrs9nwDJvEWt3Y9dVsxThzLSvAbbYmW+dSQ4Y7+hcHOklSAyeqgLVs2MB8gBF7sJSCbbtICaQF5XMfRvZqqnpOFRqtqptDPP3L3XOFf+wmNW4PcsZ7TAeO8jeuB10aXIk0nMcLA7Rru1VEW4kLTX7WQajq+cErwmo8sw3IM+ZY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=u8KgZ9Qs; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="u8KgZ9Qs" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241106142946epoutp017275d7a5b85a572a9715e17e8a4557ce~FZ3WpFnq62053720537epoutp01h for ; Wed, 6 Nov 2024 14:29:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241106142946epoutp017275d7a5b85a572a9715e17e8a4557ce~FZ3WpFnq62053720537epoutp01h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903386; bh=wQsh5MEv2xvuMdMfRC5hx+1fVZ+6hqXmEyHQLubiY3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u8KgZ9Qsq6feXaF7qxnAd3ZCDRMympaaZ/iZZFZtpNEs1K8irKt4x9kNp7IsiQ164 XioTRCJ29pNvcFjOWmkTxiSlXTdaqQaPHmX8pEpKg0nA/DHpBrR58B8dXlb0lUEFLQ 9piy2KrNXEgXtidv5Dy62+/m21RKZVOjSey/X6sQ= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241106142945epcas5p27b22bc354b85cff6c487990cf84f314e~FZ3V1wriO1484514845epcas5p2L; Wed, 6 Nov 2024 14:29:45 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.178]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Xk6zX2Kfvz4x9Pv; Wed, 6 Nov 2024 14:29:44 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id AE.E2.09800.85D7B276; Wed, 6 Nov 2024 23:29:44 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241106122721epcas5p3849e3582fcb6547be2b1b10b031138d4~FYMdpOSTa1876718767epcas5p3z; Wed, 6 Nov 2024 12:27:21 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241106122721epsmtrp1bdd1f5a15dcf3734ec183b4cc1275f08~FYMdnuyhZ2054020540epsmtrp1T; Wed, 6 Nov 2024 12:27:21 +0000 (GMT) X-AuditID: b6c32a4b-4a7fa70000002648-7e-672b7d58f2f4 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id CA.01.35203.9A06B276; Wed, 6 Nov 2024 21:27:21 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122718epsmtip1f4f0cccb196ed013747170516d7b45df~FYMbJ800Q0829608296epsmtip1F; Wed, 6 Nov 2024 12:27:18 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Kanchan Joshi , Anuj Gupta Subject: [PATCH v8 10/10] block: add support to pass user meta buffer Date: Wed, 6 Nov 2024 17:48:42 +0530 Message-Id: <20241106121842.5004-11-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01Ta0xTZxj2O+fQ62oORbdvDczuZLoAgbbQ1lPHbRsuJ8FEkv1RtgQLPSmM 0na9zEE0a0TQ4SoMQbQi1MkUqs7Bym1Q4xBoQC4bbEi97CbIxKEiY+qaylpaNv897/s+z/Pm +S4slP8zQ8DK15pog1apIRgcrP1KdHTcjr2xavGls2vJhSUvRu6r9KFknaMdkOduVTDIe1ce AdJzuQshm8/1I+T90lGMPFFbgpD9y/MMsqp3EpCu67Fkj2sQIxvOzDDJQ9c6GeRZ9zOEHPO5 w8gxWx0zjU912W4xqYkRM9Xq+JRBfdP4CdXtsTCohZnrGHXY6QDUsL2PSS22vkK1Ts8jmZys gqQ8WqmiDUJam6tT5WvVyUTGu9lvZ8vkYkmcREFuJoRaZSGdTKRvy4x7J1/jz0QIP1JqzP5W ptJoJEQpSQad2UQL83RGUzJB61UavVQfb1QWGs1adbyWNm2RiMUJMj9xV0HeQNsvQH9I8fG1 iWZgAd/HlwM2C+JSeH5wjFkOOCw+3g2gfXYpLFg8AnDCdzE0+RvAG47LyKrEu9+LBAcuACc7 /gwViwBedU6tsBj467BvthQEBuvwHgCtp65igQLFKxFor3WiAVYEvhVOWuuxAMbwjbDl/rRf wWLxcAV8UMIMrtsAj48/XsFsf3tksR0EMA8Ph4PHp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wgtpDA R0aJhwfDQWw2AXWJI89bwWpEBE4wSsyf6AYyiFlgBpPE7z8LWEASwgKuEtd654HZLAKqEhvf PQFq4ODgFbCUeN/MDjFfXmLmpe9gNidQ+OznbYwQuywk/izoA7uHV0BQ4uTMJ2BjmIHqm7fO Zp7AKDALSWoWktQCRqZVjJKpBcW56bnFhgWGeanlesWJucWleel6yfm5mxjB8aaluYNx+6oP eocYmTgYDzFKcDArifD6R2mnC/GmJFZWpRblxxeV5qQWH2KU5mBREucVf9GbIiSQnliSmp2a WpBaBJNl4uCUamDKuPD/xKHcKp9tF/xzJjmfbKxJinljlVP7m/1vWeW/CJeHkcXbs+4+fW+4 4vbtpXsKlk96pBdX8bvE/q2WjrzqwwnVtvujFPvLUnhX/FvW6qQW2PDqE+vNzufvXqRmZe8P 27U/tz39/nSHL0JMb1/WNss+msr88emTmS3yGlO+rzw4gc/x0KytDAuPrFx25O73aRGT3Dv0 P52Kdtn0oF/ATaqX5VXHubX/WB+Xc3tGM2rnrDpn+nj+zaoCwayH23hckuc1O6f8ad3r6533 Mrr5ieL7dX8471sl1LW3T+b3zDmzQluCoecv80HO22tPFspESBsEMEi1uZUuP8L+49Us3X12 4m2sm39y3wnV3/tDiaU4I9FQi7moOBEAz/uG0iYDAAA= X-CMS-MailID: 20241106122721epcas5p3849e3582fcb6547be2b1b10b031138d4 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122721epcas5p3849e3582fcb6547be2b1b10b031138d4 References: <20241106121842.5004-1-anuj20.g@samsung.com> From: Kanchan Joshi If an iocb contains metadata, extract that and prepare the bip. Based on flags specified by the user, set corresponding guard/app/ref tags to be checked in bip. Reviewed-by: Christoph Hellwig Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Keith Busch --- block/bio-integrity.c | 50 +++++++++++++++++++++++++++++++++++ block/fops.c | 45 ++++++++++++++++++++++++------- include/linux/bio-integrity.h | 7 +++++ 3 files changed, 92 insertions(+), 10 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 3bee43b87001..5d81ad9a3d20 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -364,6 +364,55 @@ int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter) return ret; } +static void bio_uio_meta_to_bip(struct bio *bio, struct uio_meta *meta) +{ + struct bio_integrity_payload *bip = bio_integrity(bio); + + if (meta->flags & IO_INTEGRITY_CHK_GUARD) + bip->bip_flags |= BIP_CHECK_GUARD; + if (meta->flags & IO_INTEGRITY_CHK_APPTAG) + bip->bip_flags |= BIP_CHECK_APPTAG; + if (meta->flags & IO_INTEGRITY_CHK_REFTAG) + bip->bip_flags |= BIP_CHECK_REFTAG; + + bip->app_tag = meta->app_tag; +} + +int bio_integrity_map_iter(struct bio *bio, struct uio_meta *meta) +{ + struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); + unsigned int integrity_bytes; + int ret; + struct iov_iter it; + + if (!bi) + return -EINVAL; + /* + * original meta iterator can be bigger. + * process integrity info corresponding to current data buffer only. + */ + it = meta->iter; + integrity_bytes = bio_integrity_bytes(bi, bio_sectors(bio)); + if (it.count < integrity_bytes) + return -EINVAL; + + /* should fit into two bytes */ + BUILD_BUG_ON(IO_INTEGRITY_VALID_FLAGS >= (1 << 16)); + + if (meta->flags && (meta->flags & ~IO_INTEGRITY_VALID_FLAGS)) + return -EINVAL; + + it.count = integrity_bytes; + ret = bio_integrity_map_user(bio, &it); + if (!ret) { + bio_uio_meta_to_bip(bio, meta); + bip_set_seed(bio_integrity(bio), meta->seed); + iov_iter_advance(&meta->iter, integrity_bytes); + meta->seed += bio_integrity_intervals(bi, bio_sectors(bio)); + } + return ret; +} + /** * bio_integrity_prep - Prepare bio for integrity I/O * @bio: bio to prepare @@ -564,6 +613,7 @@ int bio_integrity_clone(struct bio *bio, struct bio *bio_src, bip->bip_vec = bip_src->bip_vec; bip->bip_iter = bip_src->bip_iter; bip->bip_flags = bip_src->bip_flags & BIP_CLONE_FLAGS; + bip->app_tag = bip_src->app_tag; return 0; } diff --git a/block/fops.c b/block/fops.c index 2d01c9007681..412ae74032ad 100644 --- a/block/fops.c +++ b/block/fops.c @@ -54,6 +54,7 @@ static ssize_t __blkdev_direct_IO_simple(struct kiocb *iocb, struct bio bio; ssize_t ret; + WARN_ON_ONCE(iocb->ki_flags & IOCB_HAS_METADATA); if (nr_pages <= DIO_INLINE_BIO_VECS) vecs = inline_vecs; else { @@ -124,12 +125,16 @@ static void blkdev_bio_end_io(struct bio *bio) { struct blkdev_dio *dio = bio->bi_private; bool should_dirty = dio->flags & DIO_SHOULD_DIRTY; + bool is_sync = dio->flags & DIO_IS_SYNC; if (bio->bi_status && !dio->bio.bi_status) dio->bio.bi_status = bio->bi_status; + if (!is_sync && (dio->iocb->ki_flags & IOCB_HAS_METADATA)) + bio_integrity_unmap_user(bio); + if (atomic_dec_and_test(&dio->ref)) { - if (!(dio->flags & DIO_IS_SYNC)) { + if (!is_sync) { struct kiocb *iocb = dio->iocb; ssize_t ret; @@ -221,14 +226,16 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, * a retry of this from blocking context. */ if (unlikely(iov_iter_count(iter))) { - bio_release_pages(bio, false); - bio_clear_flag(bio, BIO_REFFED); - bio_put(bio); - blk_finish_plug(&plug); - return -EAGAIN; + ret = -EAGAIN; + goto fail; } bio->bi_opf |= REQ_NOWAIT; } + if (!is_sync && (iocb->ki_flags & IOCB_HAS_METADATA)) { + ret = bio_integrity_map_iter(bio, iocb->private); + if (unlikely(ret)) + goto fail; + } if (is_read) { if (dio->flags & DIO_SHOULD_DIRTY) @@ -269,6 +276,12 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, bio_put(&dio->bio); return ret; +fail: + bio_release_pages(bio, false); + bio_clear_flag(bio, BIO_REFFED); + bio_put(bio); + blk_finish_plug(&plug); + return ret; } static void blkdev_bio_end_io_async(struct bio *bio) @@ -286,6 +299,9 @@ static void blkdev_bio_end_io_async(struct bio *bio) ret = blk_status_to_errno(bio->bi_status); } + if (iocb->ki_flags & IOCB_HAS_METADATA) + bio_integrity_unmap_user(bio); + iocb->ki_complete(iocb, ret); if (dio->flags & DIO_SHOULD_DIRTY) { @@ -330,10 +346,8 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, bio_iov_bvec_set(bio, iter); } else { ret = bio_iov_iter_get_pages(bio, iter); - if (unlikely(ret)) { - bio_put(bio); - return ret; - } + if (unlikely(ret)) + goto out_bio_put; } dio->size = bio->bi_iter.bi_size; @@ -346,6 +360,13 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, task_io_account_write(bio->bi_iter.bi_size); } + if (iocb->ki_flags & IOCB_HAS_METADATA) { + ret = bio_integrity_map_iter(bio, iocb->private); + WRITE_ONCE(iocb->private, NULL); + if (unlikely(ret)) + goto out_bio_put; + } + if (iocb->ki_flags & IOCB_ATOMIC) bio->bi_opf |= REQ_ATOMIC; @@ -360,6 +381,10 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, submit_bio(bio); } return -EIOCBQUEUED; + +out_bio_put: + bio_put(bio); + return ret; } static ssize_t blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter) diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index 2195bc06dcde..de0a6c9de4d1 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -23,6 +23,7 @@ struct bio_integrity_payload { unsigned short bip_vcnt; /* # of integrity bio_vecs */ unsigned short bip_max_vcnt; /* integrity bio_vec slots */ unsigned short bip_flags; /* control flags */ + u16 app_tag; /* application tag value */ struct bvec_iter bio_iter; /* for rewinding parent bio */ @@ -78,6 +79,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, gfp_t gfp, int bio_integrity_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset); int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter); +int bio_integrity_map_iter(struct bio *bio, struct uio_meta *meta); void bio_integrity_unmap_user(struct bio *bio); bool bio_integrity_prep(struct bio *bio); void bio_integrity_advance(struct bio *bio, unsigned int bytes_done); @@ -108,6 +110,11 @@ static int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter) return -EINVAL; } +static inline int bio_integrity_map_iter(struct bio *bio, struct uio_meta *meta) +{ + return -EINVAL; +} + static inline void bio_integrity_unmap_user(struct bio *bio) { }