From patchwork Tue Oct 29 16:23:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 839544 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 CF02E1DA305 for ; Tue, 29 Oct 2024 17:23:37 +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=1730222620; cv=none; b=HmTyaAT6zKbXoQ3DfgqqBAbTr9zxLNQed1mH4CkYHHgKtVfIYnFjHRlI42EltQ0Am6sQnB8hek3AFTCHrQ+iinYxPQgkjFTh6FriqrZ7rrEDkkcId1daryAIAY+Uwoq5p+OgFGgPkvj0aVf9P/PNACKcL4x6+AUKbhD9KfB0/eQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222620; c=relaxed/simple; bh=u4sUcEX/k+wez75P184+zcG/4LIpxzsuKCd9h01C0oc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=I6q/DEvtwEJGtfMD/B0ZlWlgjvsNKKhhLKYJInb1qa+wZebq9LU9kxbYkIedDBD0KZAF+kgGPMaETbn0RJ2HWQwv4zQjazDdaUcE9An42yWGnZseQr1bBbYCznZn2QzG8O69WizWlRuJL5tQsC8fMTMQXFzeY3WBYIB9cd6LPgI= 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=GLduJASx; 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="GLduJASx" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241029172335epoutp014dec8053c643aff7d01b5320fa2433c8~C-E1WgWzc2983329833epoutp01D for ; Tue, 29 Oct 2024 17:23:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241029172335epoutp014dec8053c643aff7d01b5320fa2433c8~C-E1WgWzc2983329833epoutp01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222615; bh=1yEesIXP8hqj3mWCayZYKotAS9KxK7WmVJifezfxMwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GLduJASx6XouFM0VMY4gFhHacTRWDJqN2yJGc/zFyBliGOMe69jzjxiwsy5w7qRmC q0Tu/Didt6YsvYUu9gaI5mx71fLbzkQ75H69mc3LdwnVhO8uFhSNS99PAY2Nn3xgrh UjTv1UnRCV3R4PYlQcVFENj6X+BwVB/8u+ZEaG+A= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241029172335epcas5p4b9aeaf624b86420921a9231cc1551bee~C-E0vVZsB1636716367epcas5p4B; Tue, 29 Oct 2024 17:23:35 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.174]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XdHCn3w11z4x9Pv; Tue, 29 Oct 2024 17:23:33 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 02.F9.09420.51A11276; Wed, 30 Oct 2024 02:23:33 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241029163214epcas5p1069ca93a2a9d8840e4f142cc4b713775~C_X-v4_OV2340523405epcas5p1A; Tue, 29 Oct 2024 16:32:14 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163214epsmtrp1c51dc3fc90333bdd1c5a8dcc372ba54f~C_X-vDYut0708307083epsmtrp1K; Tue, 29 Oct 2024 16:32:14 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-52-67211a15b45d Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D4.07.08227.E0E01276; Wed, 30 Oct 2024 01:32:14 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163212epsmtip2c07a03b121b4c271c42f7bd3adf8681f~C_X9alVN10998409984epsmtip2W; Tue, 29 Oct 2024 16:32:12 +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 v5 02/10] block: copy back bounce buffer to user-space correctly in case of split Date: Tue, 29 Oct 2024 21:53:54 +0530 Message-Id: <20241029162402.21400-3-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgF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srw7XGpdZw/esX0if+ffHFNpaXf7E7+rjn3wtmaokCxMNZ86Vyhkfgab78H9+1517LK8YGmc f52Pf4fQnG47o7ZNybZXzu1U2i4m9nD/rSibGS0z27T+/JE2EnsW/59B45xKNuvz/87ZH2fZ Zr1fu/pGpY/1OcPKF01+q42kJsoqrNoQddDh6P5//qsj5FIKzq548HChhQ+vZu753U/nZdxy vvVUUYmlOCPRUIu5qDgRAL6ZvHUhAwAA X-CMS-MailID: 20241029163214epcas5p1069ca93a2a9d8840e4f142cc4b713775 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163214epcas5p1069ca93a2a9d8840e4f142cc4b713775 References: <20241029162402.21400-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: Anuj Gupta [hch: better names for variables] Signed-off-by: Christoph Hellwig 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 Tue Oct 29 16:23:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 839543 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 5E1B71D9665 for ; Tue, 29 Oct 2024 17:23:50 +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=1730222632; cv=none; b=iB8m3L+2ddSciOjRAxr0v6k2OwriawrtIwnMi3xzHvTMcZwitsKbdRfT9w29PpJT4LZ6mNIG6av/xMlW4AjtEEy1g41vQuJm7PzfmkHUuYamo07q/3JKAH281IGvKHmHEGxm4T+mUfuEPmAO77aqHsDORmB+ckdW73SeUPvwtTY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222632; c=relaxed/simple; bh=6Jsyj+yD2Vbk8Dl+vuFoXvjbwlYWR2rPusXgpoT9Lyo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=G56dPqA0LEHbhylBe3F7cIFdZJDDvBDSbI82DDIA4308OPCmBqk6YXMi5KEbpS8W8GLQHjmTT1+oF1b551J6sKlzqEecHAexMPdacixS0iMJm3m1HkXbCehoFf+EoYE8sMI9lxaYL5e/rEflXl5eq7VMAy1MOwSpThWpdUDZLUI= 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=OUgFSPyu; 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="OUgFSPyu" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241029172348epoutp010a5d3653a2347aa5eafe30729b503f10~C-FBWpC222983329833epoutp01J for ; Tue, 29 Oct 2024 17:23:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241029172348epoutp010a5d3653a2347aa5eafe30729b503f10~C-FBWpC222983329833epoutp01J DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222628; bh=RUxSD6cm/2/oRpjJQ/qX5pi0ZZMenTN0KcQUO7F+Cjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OUgFSPyuH99B16995/j89/QOEcBpc8oLvwV3dwk50KDnMdF7RncNZA9kwq18UZhOL DNqu2vsljSlIxA83MkAD7yEvHdiD7dfoH4HPbXT4QHMuFYVgAEey/aMg53NfMnN6UO 6A/YQi7AHnJpYIwJfomeEKLLy4FS58sp9lDagdw0= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241029172348epcas5p1ef1585b46b83aa08f29a5a73359ad0f3~C-FAy1jzA0899208992epcas5p1K; Tue, 29 Oct 2024 17:23:48 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.176]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XdHD31511z4x9Pt; Tue, 29 Oct 2024 17:23:47 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 58.7A.18935.22A11276; Wed, 30 Oct 2024 02:23:46 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241029163220epcas5p2207d4c54b8c4811e973fca601fd7e3f5~C_YEu6-ss0970309703epcas5p2B; Tue, 29 Oct 2024 16:32:20 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163220epsmtrp184c6055921ab0b6389e5209895ed85f2~C_YEuC6yO0708307083epsmtrp1M; Tue, 29 Oct 2024 16:32:20 +0000 (GMT) X-AuditID: b6c32a50-cb1f8700000049f7-bb-67211a22e017 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 3A.4B.07371.31E01276; Wed, 30 Oct 2024 01:32:19 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163217epsmtip253344fee5699a83a61ae5feaa5096850~C_YCQ_AR70998409984epsmtip2X; Tue, 29 Oct 2024 16:32:17 +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 v5 04/10] fs, iov_iter: define meta io descriptor Date: Tue, 29 Oct 2024 21:53:56 +0530 Message-Id: <20241029162402.21400-5-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Te0xbVRzHc+69tBdczbV7nTWC5caJsJVRRrsDwjbDolddIovGZLrZVbgp taWtfQxnRDpIV8HQls1ltnTIJo5H4zQdEBgghmfGVhgiGghkL1pxWJUR3SsMW1p0/33P73y/ v09+50Hi/GscAanUGFm9Rq6mOXFEW19ykogWJCrSekdfQAt/PyRQmWMJR+7mNoA8M3YOmu+7 A9DkDx0YavIMYOgPywiBak6VY2hgOchBx3t/Bqh7agvq6r5EoC/P+bnos1/aOahh6BGGRpeG YtCoy83dzWc6XDNcZtxnYrzNFRzmQn0p0zlp5jAL/imCsbU0A+ZKXT+XWfQmMN7ZIJYX97Yq u5CVF7B6IavJ1xYoNYoc+rU3ZLkyiTRNLBJnoh20UCMvYnPoPXvzRC8p1aGZaOFhudoUKuXJ DQZ6285svdZkZIWFWoMxh2Z1BWpdhi7VIC8ymDSKVA1rzBKnpaVLQsZDqsLLJ1oJ3QTvw5+q xzAz+OKJShBLQioD+s+PEZUgjuRTXQC6l+dAZHEHQE/NNTzs4lP/AGhrTFhNTFTORevdAPZ/ 9XQksAhga1mACG9wqCTY/6tlpdO6cNuqM5dXGDjlwKC12s0Nu9ZSL8KpQE9MWBPUZvj59QAI ax6VCasuerEI7hno/PHuij+WyoKDA11YxPMUvOScXaHhIU95aw0eBkBqmoRz/g4QCe+BrqZv onotvD3Uwo1oAfzNfiyqFfDeuD8K08Hywe+j/l3QMmwPNSVDgGT47cVtkXI8PDl8Hotwn4RV D2ejUR5sr13VNLQ2uaM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xU3rx1 NvMERoFZSFKzkKQWMDKtYpRMLSjOTc9NNiwwzEst1ytOzC0uzUvXS87P3cQIjjgtjR2M9+b/ 0zvEyMTBeIhRgoNZSYR3daxsuhBvSmJlVWpRfnxRaU5q8SFGaQ4WJXFewxmzU4QE0hNLUrNT UwtSi2CyTBycUg1MRxat5TaWNblx/WQKe9CJRwwFpgeLo8PE1px0j7DfF/nwynUTj+ZTze9m H22ukhZV+L/lsOIv9ll6/vxVpUFvEqWXiB2xTTsqvch92tIzs+T7+6Nu/Mq2Pzc9ff6Gno8r GO89E/VSjP+nZh/Z/73MsXDHHpEefqX1z3V2tafdW7RdfPf3236Tz39L2t9+irkgxfxBbZ1T Ud+CN0kJ3Ud2HsyY2CVlE29sGXDh6DWpTtV2NsP5ioFbpj+dt/qXymaJss0XU81l7gfPvzat 52j4oeVyr9q/RmgnaqmbH94n12LMXrDlZopgTXTp3nU7ntlwvWr10bcpFDofelf2jcnH6bIy TDutZvw+lta/j/eiEktxRqKhFnNRcSIAyLvsDCcDAAA= X-CMS-MailID: 20241029163220epcas5p2207d4c54b8c4811e973fca601fd7e3f5 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163220epcas5p2207d4c54b8c4811e973fca601fd7e3f5 References: <20241029162402.21400-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 --- include/linux/uio.h | 10 ++++++++++ include/uapi/linux/fs.h | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 853f9de5aa05..eb3eee957a7d 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -82,6 +82,16 @@ struct iov_iter { }; }; +/* flags for integrity meta */ +typedef __u16 __bitwise 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: 839542 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 53FE51D9A40 for ; Tue, 29 Oct 2024 17:23:59 +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=1730222643; cv=none; b=Nq8safz+2QO+ZNHYD27m7s+SV0BcCqsMYrlRCELftAOrI/ObRaiGJQcj7FglwZ5HcGB4yCq/FDxDX1m5lT8Ysfh4+HO4Gk7wKIjg15gtRktWToq69ML8wJrKY8DWDq9NjRCzMHJNslZ29Nl7mTpKgYiKj3HGD0XliDKk1XKOs+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222643; c=relaxed/simple; bh=kVVqpch4W3C7vaedFKwtfznSdsSPmraBgqU1G7FqsVc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=i7yBQXInLyULxFTQlQ9Y4nXSaG9fjyZdRhI4gnFksgK0gJmlAtC6b0kqhUxtaQjBD2gDanQ8sgw3nc6YsVeTq9mGctsKgmfFWUUqUBFnT4EqxMynYPAHbZOFh5jjZYAaWv7ckduIY2zRofqGEma2de42HSsYysN4Fup+1Q6OiuI= 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=J9U1lBMr; 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="J9U1lBMr" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241029172357epoutp0459704e0a87663388f5e0a8d44c9876b3~C-FJlepL40698406984epoutp04Q for ; Tue, 29 Oct 2024 17:23:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241029172357epoutp0459704e0a87663388f5e0a8d44c9876b3~C-FJlepL40698406984epoutp04Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222637; bh=tHAbilR2K4P3xVmFkTJzSdUKF5Ld+Fwe7sWbBnlCjJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J9U1lBMrOzHQ5+anQTCPkUUrXW35rOGWLafYJ99tjZE1IP+ESkb05kwW8SxuaEhjC fJqAqeufHbM8wEaDtF+QeQqk1yBWkkafRGPWo748Jz0XoPmdCrT2X7Ec4VYcuu0Ygj E3CZZHaWhA3lD8BEda1G1QN0JYM7JyyuLxlImw+k= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241029172357epcas5p2015b9120eb423b446185217025ccc962~C-FJDQ9Wj0233702337epcas5p2S; Tue, 29 Oct 2024 17:23:57 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.175]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XdHDC6PQJz4x9Pv; Tue, 29 Oct 2024 17:23:55 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 60.6F.09800.B2A11276; Wed, 30 Oct 2024 02:23:55 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241029163225epcas5p24ec51c7a9b6b115757ed99cadcc3690c~C_YJmJnkX2264422644epcas5p2M; Tue, 29 Oct 2024 16:32:25 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163225epsmtrp1e30ac6a04ff99e5320275f75c8cd10e5~C_YJkUSfC0708307083epsmtrp1T; Tue, 29 Oct 2024 16:32:25 +0000 (GMT) X-AuditID: b6c32a4b-23fff70000002648-e6-67211a2bacfd Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id DD.09.18937.91E01276; Wed, 30 Oct 2024 01:32:25 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163222epsmtip2b2e748905798ff147e75e4ebcfa74b85~C_YHIAakw0998409984epsmtip2Y; Tue, 29 Oct 2024 16:32:22 +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 v5 06/10] io_uring/rw: add support to send metadata along with read/write Date: Tue, 29 Oct 2024 21:53:58 +0530 Message-Id: <20241029162402.21400-7-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPJsWRmVeSWpSXmKPExsWy7bCmlq62lGK6wY3t+hYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJouj/9+yWUw6dI3RYu8tbYs9 e0+yWMxf9pTdovv6DjaL5cf/MVmc/3uc1eL8rDnsDkIeO2fdZfe4fLbUY9OqTjaPzUvqPXbf bGDz+Pj0FotH35ZVjB5nFhxh9/i8Sc5j05O3TAFcUdk2GamJKalFCql5yfkpmXnptkrewfHO 8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6ZOUA/KSmUJeaUAoUCEouLlfTtbIryS0tSFTLyi0ts lVILUnIKTAr0ihNzi0vz0vXyUkusDA0MjEyBChOyM3p2X2Ar6HGq2Lx+JlMD4z7TLkZODgkB E4l7C9+xdDFycQgJ7GaU2N86lR3C+cQo8fjeVwRn86kzbDAt037PZoNI7GSU2LB0DZTzmVHi 29EtLCBVbALqEkeetzKCJEQE9jBK9C48DbaFWWACk0T7xDnsIFXCAtESc75tZQKxWQRUJaat vsIMYvMKWErc23eUFWKfvMTMS9/B6jkFrCSOHd3DBFEjKHFy5hOwbcxANc1bZzND1N/gkHjQ 7AVhu0jcPzMZ6m5hiVfHt7BD2FISL/vboOx0iR+XnzJB2AUSzcf2MULY9hKtp/qBZnIAzdeU WL9LHyIsKzH11DomiLV8Er2/n0C18krsmAdjK0m0r5wDZUtI7D3XAGV7SPTNusYMCa1eRom3 axYyTWBUmIXknVlI3pmFsHoBI/MqRsnUguLc9NRi0wLjvNRyeDwn5+duYgSndC3vHYyPHnzQ O8TIxMF4iFGCg1lJhHd1rGy6EG9KYmVValF+fFFpTmrxIUZTYHhPZJY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WpRfnxRaU5q8SFGaQ4WJXFe5ZzOFCGB9MSS1OzU1ILU IpgsEwenVAPTxIkKPFaWL+7s+GjK6qB/JurNMaPlL2IucLE8Wnh617FXsTsMribe07OR8s5r YVw+K2bS9vw9m3YIz/RZzrhAZ9qq9oPPu9xOBN+MydzP8nWl1gYx55yZ54qcli73nap436wy r+GlxOnJRtI8P8UDP7Sv6w3edMyt5YLJlyOtCu2xCccnbNSwblGfn8v2d69Y/NnjZTIP3txg PrznUaqjTHIZj7dzoWzq/msPmd399Ut+K5X4pnQndYb13PrQvVS76Hi+TsuCY46b1m6Ts3u2 bWFrhbzO78IlRx7MyeHdF7Ks0odt/4EHEgKW7/f+TP5UNu3qpWg7+wgtxrY9xXMMa5OuNb8z DppsFVJTJ/lCiaU4I9FQi7moOBEAqUTueSIDAAA= X-CMS-MailID: 20241029163225epcas5p24ec51c7a9b6b115757ed99cadcc3690c X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163225epcas5p24ec51c7a9b6b115757ed99cadcc3690c References: <20241029162402.21400-1-anuj20.g@samsung.com> This patch adds the capability of sending metadata along with read/write. A new meta_type field is introduced in SQE which indicates the type of metadata being passed. This meta is represented by a newly introduced 'struct io_uring_meta_pi' which specifies information such as flags,buffer length,seed and apptag. Application sets up a SQE128 ring, prepares io_uring_meta_pi within the second SQE. The patch processes the user-passed 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 --- include/uapi/linux/io_uring.h | 29 +++++++++++++ io_uring/io_uring.c | 9 ++++ io_uring/rw.c | 79 ++++++++++++++++++++++++++++++++++- io_uring/rw.h | 14 ++++++- 4 files changed, 128 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 024745283783..4dab2b904394 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -92,6 +92,10 @@ struct io_uring_sqe { __u16 addr_len; __u16 __pad3[1]; }; + struct { + __u16 meta_type; + __u16 __pad4[1]; + }; }; union { struct { @@ -105,6 +109,31 @@ struct io_uring_sqe { */ __u8 cmd[0]; }; + /* + * If the ring is initialized with IORING_SETUP_SQE128, then + * this field is starting offset for 64 bytes of data. For meta io + * this contains 'struct io_uring_meta_pi' + */ + __u8 big_sqe[0]; +}; + +enum io_uring_sqe_meta_type_bits { + META_TYPE_PI_BIT, + /* not a real meta type; just to make sure that we don't overflow */ + META_TYPE_LAST_BIT, +}; + +/* meta type flags */ +#define META_TYPE_PI (1U << META_TYPE_PI_BIT) + +/* this goes to SQE128 */ +struct io_uring_meta_pi { + __u16 pi_flags; + __u16 app_tag; + __u32 len; + __u64 addr; + __u64 seed; + __u64 rsvd; }; /* diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 4514644fdf52..b3aeddeaba2f 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3875,10 +3875,13 @@ 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, meta_type); 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); + BUILD_BUG_SQE_ELEM_SIZE(64, 0, big_sqe); BUILD_BUG_ON(sizeof(struct io_uring_files_update) != sizeof(struct io_uring_rsrc_update)); @@ -3902,6 +3905,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_meta_pi) > + sizeof(struct io_uring_sqe)); + + BUILD_BUG_ON(META_TYPE_LAST_BIT > + 8 * sizeof_field(struct io_uring_sqe, meta_type)); + io_uring_optable_init(); /* diff --git a/io_uring/rw.c b/io_uring/rw.c index 7ce1cbc048fa..bcff3ae76268 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -257,11 +257,58 @@ 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 int io_prep_rw_meta(struct io_kiocb *req, const struct io_uring_sqe *sqe, + struct io_rw *rw, int ddir, u16 meta_type) +{ + const struct io_uring_meta_pi *md = (struct io_uring_meta_pi *)sqe->big_sqe; + const struct io_issue_def *def; + struct io_async_rw *io; + int ret; + + if (READ_ONCE(sqe->__pad4[0])) + return -EINVAL; + if (!(meta_type & META_TYPE_PI)) + return -EINVAL; + if (!(req->ctx->flags & IORING_SETUP_SQE128)) + return -EINVAL; + if (READ_ONCE(md->rsvd)) + return -EINVAL; + + def = &io_issue_defs[req->opcode]; + if (def->vectored) + return -EOPNOTSUPP; + + io = req->async_data; + io->meta.flags = READ_ONCE(md->pi_flags); + io->meta.app_tag = READ_ONCE(md->app_tag); + io->meta.seed = READ_ONCE(md->seed); + ret = import_ubuf(ddir, u64_to_user_ptr(READ_ONCE(md->addr)), + READ_ONCE(md->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 meta_type; int ret; rw->kiocb.ki_pos = READ_ONCE(sqe->off); @@ -279,11 +326,20 @@ 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; + + meta_type = READ_ONCE(sqe->meta_type); + if (meta_type) + ret = io_prep_rw_meta(req, sqe, rw, ddir, meta_type); + return ret; } int io_prep_read(struct io_kiocb *req, const struct io_uring_sqe *sqe) @@ -410,7 +466,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 +854,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; @@ -824,6 +883,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; } @@ -898,6 +969,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 { /* @@ -1102,6 +1175,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 Tue Oct 29 16:24:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 839541 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 7458E205142 for ; Tue, 29 Oct 2024 17:24:06 +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=1730222648; cv=none; b=HlZnt2xMDgVaU4WqyrKza40Bb/B5guiMth4K2b4caNXCN8lnqVpEgh7XW9otbpflAC/zeEjastMekYtUze8x10106lnhkGRhObBWtFw+lk3mWARB9Jnn4qMsRlFH0JcFx+P1l7ZVGDzk2G4+vxLbVvi5gkAqmFKnLih2HDy/8og= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222648; c=relaxed/simple; bh=eiTbYrSDASnf8+i0nVkgeEha1QL2SQUQBBcwJPGXWRs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=o8qqgI093nh1xCcAdD/hqIRBUZgyb8sE3TkN49PVmjbNLETojNfU894dX6MydKxLPTBe0N9OyiM96CBawLZSXatmgEaW5eQtfzeLlYB+v6qCoRuG30Pcanj+SRzt36idmiq7OZU3sMwj0F0qCb3GyLsiWAIVTXCNUzbP00+y2tE= 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=fQfyaWt5; 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="fQfyaWt5" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20241029172404epoutp02bd27c0ae67e23c726ef0fd94475bf2b5~C-FQJKHYl2164621646epoutp02n for ; Tue, 29 Oct 2024 17:24:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20241029172404epoutp02bd27c0ae67e23c726ef0fd94475bf2b5~C-FQJKHYl2164621646epoutp02n DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222644; bh=1dbtQAeD0iePlfKD3yxWUWqgeSMIvmMv0CUHvF3cEGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQfyaWt5QR8k3fv5ogj6/an6walPzCAHRoGuXWVeCN0NOEqblHl4eeX0Yz/EnsPyE NWhSGRADdDmFage7kZnEVqngolVSFOgymohhLPWZwDUe6GjmOB7yoSuvOhMs8lUOWq 1awnOui8XMpYGmH+tV3r7ElQCbMchWQ4xJ97cNDc= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241029172403epcas5p3e118afcce8ac877e372e8c257bfd9c69~C-FPN9CyA0894708947epcas5p3s; Tue, 29 Oct 2024 17:24:03 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.177]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4XdHDL4R9rz4x9Pp; Tue, 29 Oct 2024 17:24:02 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 9D.7A.18935.23A11276; Wed, 30 Oct 2024 02:24:02 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241029163230epcas5p18172a7e54687e454e4ecb65840810c4e~C_YOm1YX-2993629936epcas5p1r; Tue, 29 Oct 2024 16:32:30 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241029163230epsmtrp2df03d4cb640586cc2c056461a4be9506~C_YOjdbyZ1621316213epsmtrp2J; Tue, 29 Oct 2024 16:32:30 +0000 (GMT) X-AuditID: b6c32a50-cb1f8700000049f7-d9-67211a32078b Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 98.07.08227.E1E01276; Wed, 30 Oct 2024 01:32:30 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163228epsmtip2eb473021666d8b3baa91fd6557a9a56d~C_YMIvhm01387713877epsmtip2F; Tue, 29 Oct 2024 16:32:27 +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 v5 08/10] nvme: add support for passing on the application tag Date: Tue, 29 Oct 2024 21:54:00 +0530 Message-Id: <20241029162402.21400-9-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Tf0xTVxTHc98r/cEoebaYXZsp9S1mKQtIWeleiTg30Lwome26ZRtxgRf6 UgjltesPcW5jBFYMvwTxJ235FRcNJWMOKgEtBAuIVYGpmUwUNgidCyAGcGBG0LW0bP73Oed8 z/3mnHsvFxVMsEXcHMZMGxlKh7PDWR19Eklsgmi7Nr59IJpY+HuVRRRVr6GEw9kBiJbxKjYx 27cIiAe9XQjR3DKAEPPWYRZhP1uMEAMvn7CJGs99QHSPvU24u70souGCj0OUj3ayiYuDLxBi ZG0wjBixOTh7BGSXbZxD3huykG3OUjbZ/sN35NUHhWxywTfGIo+7nIC83djPIZfatpFt008Q ZXh67q5smtLQRjHNZOk1OYw2GT+gzkjJSJTHS2OlCuJdXMxQeXQynpqmjN2Xo/PPhIsPUzqL P6WkTCZ85+5dRr3FTIu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feWtsWe vSdZLOYve8pu0X19B5vF8uP/mCzO/z3OanF+1hx2ByGPnbPusntcPlvqsWlVJ5vH5iX1Hrtv NrB5fHx6i8Wjb8sqRo8zC46we3zeJOex6clbpgCuKC6blNSczLLUIn27BK6Ms1tiCtq4K3b9 n8nUwDiHs4uRk0NCwETi/sU57F2MXBxCArsZJRa0HGWGSEhInHq5jBHCFpZY+e85VNFHRomH z9eCJdgE1CWOPG8Fs0UETjBKzJ/oBlLELDCDSeL3nwUsIAlhAT+JLRv/MIHYLAKqEq2LH4HZ vAKWEvM37GGD2CAvMfPSd3YQm1PASuLY0T1ANRxA2ywlTk5ygygXlDg58wnYSGag8uats5kn MArMQpKahSS1gJFpFaNkakFxbnpusWGBUV5quV5xYm5xaV66XnJ+7iZGcLxpae1g3LPqg94h RiYOxkOMEhzMSiK8q2Nl04V4UxIrq1KL8uOLSnNSiw8xSnOwKInzfnvdmyIkkJ5YkpqdmlqQ WgSTZeLglGpgUig4fNFd5t37iD1OevnfyhbO2ZbcLS4xIfDDbpNIO1bunCID29DjQfcYOcQW TeDRWOe/36LORO9wfZvXdh23x+vUni4UX1e+rcBEYPdd1dMx2i9msq5NEFLj+W9at7umYPqd 9jjl3pLZzOrx/6RkBbg2C8766pij+n2eqKtTdekBPvMNE86ejjQRF2ErK/5qvzitbHa6/MM7 n6yymz+WRBguCzmTULF7T2Fal6xo/tz129bn/a258Nv3kYew7kxTxVU3Nnl5/2zcsmG5x4Yt fW3SAtKzYvSeVq2wNDjB6+PIVPj/0YEA40UNxbKXDA6mFV+8bO2Z+eiQ4ibOwKvdKu9DmYzU F3Gz9H1zyVdiKc5INNRiLipOBAB+d6zPJgMAAA== X-CMS-MailID: 20241029163230epcas5p18172a7e54687e454e4ecb65840810c4e X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163230epcas5p18172a7e54687e454e4ecb65840810c4e References: <20241029162402.21400-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 --- 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 79bd6b22e88d..3b329e036d33 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -872,6 +872,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) { @@ -1012,6 +1018,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 Tue Oct 29 16:24:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 839540 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 21AC020606D for ; Tue, 29 Oct 2024 17:25: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=1730222751; cv=none; b=rn7Y2sTuRqWB8GeIXGJM7ozUHyLWPvs5jGfifAo9JwTJYpCi0JX1ffWRIT8kz459O23hoWHjauh1X0tByApg/ZftrhyWH8KereXRrJv21s32Y5ouovMa/XAmZhCs28wvpDsR1I3Z/i7ZF5YNgvIbez2Bys/bnaJ3ERBH3uJGrM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222751; c=relaxed/simple; bh=LnaNhp0NkZ+h1x7hNoh8dcamhZlSIZfnMvMK0uvlcQA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=ueGViEBxTPLcXFgRMfJfvQ/GKd2h/P+n/P2zos8owhp0BFFmYP0zL0JXZmv+G3MY+eLExd5kXkDp51OdNtZqmoeyec+gHNopm/zOC4miYN9Sn91jvlEeFcL80GLHUvtjph3bEkwXQL66GogqNRmjm/d2ONqt5eN4EYKAa5jM5WY= 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=r7ivlmEC; 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="r7ivlmEC" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241029172547epoutp0112ee6c0a02d13727506d0e4715e227fd~C-GvzWIrR3157231572epoutp01E for ; Tue, 29 Oct 2024 17:25:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241029172547epoutp0112ee6c0a02d13727506d0e4715e227fd~C-GvzWIrR3157231572epoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222747; bh=8JozZTu1XSCEABsX3TkivbzX6vM8WnvmIwslWwYHbLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r7ivlmECaV8wf5QrHiLPI+XMiUlv1fnlU4mGueqZn92jyQhmcCRe240PO3jBlj1Bc vy4Q5EVH1OXMus+/oS1O+ouFM+NmS80Vw5AFLXVPQEICRq2aBQsr0YgEmtiovubdnH jxNNeizemzNBOoj2IgYDTFmDiJ69UDSEMaNjmlJg= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241029172546epcas5p3bec90d67d624ce23cd583d1956e0b8ce~C-Gu44GIQ2484924849epcas5p3P; Tue, 29 Oct 2024 17:25:46 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.182]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4XdHGK1qJTz4x9Pq; Tue, 29 Oct 2024 17:25:45 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 00.1A.09420.99A11276; Wed, 30 Oct 2024 02:25:45 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241029163233epcas5p497b3c81dcdf3c691a6f9c461bf0da7ac~C_YQ3_uT52670526705epcas5p4X; Tue, 29 Oct 2024 16:32:33 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163233epsmtrp1799296227aa898eaa6db6202340f0d68~C_YQ3LOAg0723107231epsmtrp10; Tue, 29 Oct 2024 16:32:33 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-2a-67211a99c54a Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 0D.4B.07371.02E01276; Wed, 30 Oct 2024 01:32:33 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163230epsmtip2b37587e74672e6bf9f7f3d746f1ccbb8~C_YOnT_e90998409984epsmtip2c; Tue, 29 Oct 2024 16:32:30 +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 v5 09/10] scsi: add support for user-meta interface Date: Tue, 29 Oct 2024 21:54:01 +0530 Message-Id: <20241029162402.21400-10-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJJsWRmVeSWpSXmKPExsWy7bCmhu5MKcV0g6aX7BYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJotJh64xWuy9pW2xZ+9JFov5 y56yW3Rf38Fmsfz4PyaL83+Ps1qcnzWH3UHQY+esu+wel8+Wemxa1cnmsXlJvcfumw1sHh+f 3mLx6NuyitHjzIIj7B6fN8l5bHrylimAKyrbJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ 19DSwlxJIS8xN9VWycUnQNctMwfoHSWFssScUqBQQGJxsZK+nU1RfmlJqkJGfnGJrVJqQUpO gUmBXnFibnFpXr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105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163233epcas5p497b3c81dcdf3c691a6f9c461bf0da7ac References: <20241029162402.21400-1-anuj20.g@samsung.com> Add support for sending user-meta buffer. Set tags to be checked using flags specified by user/block-layer. Signed-off-by: Anuj Gupta --- drivers/scsi/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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; }