From patchwork Wed Oct 16 11:29:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838347 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 28C9D208962 for ; Wed, 16 Oct 2024 12:36:09 +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=1729082171; cv=none; b=r2IRyVvNxDhFSg6CQmEgiSl0AqwrE+b6qnlHPSWURC+Hu8hF5iVf6fVhqAGZTzkLZhiWiKIsXC+dc+wxaJwCI5mI2fG3qrIHKXBJTRpOBo2SC6yuPVd9lV66As6ej17d3zF8guZ3HpAB+k2gHv9oDpW/5vctkX5aW5MdzOnefqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082171; c=relaxed/simple; bh=JYbAqvDZtvFYF0NPlNV17yTtG4+nrjd64NKUzbtHnvY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=mgKX5gX+Wy4oT7YNXVxKSPonLQj4yMzseUmNPWIrckpdRhj5seAWGLO5gdwAttTOP1Dcskc93nrMR9h5OOGg2MtddSMnn5eo+NsIFtv3OCBVNgBBatDzW99zxeZqZDcli1CPpNWyrMu2Ab1WUV4wRWL6Isyu3VExWZKFBnx+Xak= 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=OMTLVxwy; 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="OMTLVxwy" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20241016123608epoutp0253085f160748254c092d7a0abcb4dc71~_7xIi4rqV1522015220epoutp02S for ; Wed, 16 Oct 2024 12:36:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20241016123608epoutp0253085f160748254c092d7a0abcb4dc71~_7xIi4rqV1522015220epoutp02S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082168; bh=mT4K+F2A/kIqOZdL/ZLie0ICYJwUxyCwdVtyep16tb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OMTLVxwyU5URm1/JIDINnCqM1xOWygQkKhO2HhC3iZQ3MW33HWAQ3ZwtmhMX8beZr bGyJPcjnUTBkmf+Xl60Iub9qGpbEAEHxK26T2S37REqnFua2IttNpi+sMPztKrEE6k fiMynzKn8kdLeE1g706ptaky+28MaF6R9hsVPbck= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241016123607epcas5p162635bbc7397511c995cc07acfa59885~_7xHsMBzi2383423834epcas5p1A; Wed, 16 Oct 2024 12:36:07 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.181]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XT9S43ZR7z4x9Ps; Wed, 16 Oct 2024 12:36:04 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 88.F7.09420.433BF076; Wed, 16 Oct 2024 21:36:04 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241016113724epcas5p191ccce0f473274fc95934956662fc769~_692-Rjvd0520505205epcas5p1c; Wed, 16 Oct 2024 11:37:24 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241016113724epsmtrp14aee8d06e2ce78c541c7ba97a7ba58b8~_692_Xuqb0254402544epsmtrp1W; Wed, 16 Oct 2024 11:37:24 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-8c-670fb334c4bf Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F9.9A.07371.475AF076; Wed, 16 Oct 2024 20:37:24 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113722epsmtip137a8c8fd22cb33714a53dfc2f84ee787~_691Clh-33048330483epsmtip1f; Wed, 16 Oct 2024 11:37: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, krisman@suse.de 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, Anuj Gupta Subject: [PATCH v4 01/11] block: define set of integrity flags to be inherited by cloned bip Date: Wed, 16 Oct 2024 16:59:02 +0530 Message-Id: <20241016112912.63542-2-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-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+NgFtrPJsWRmVeSWpSXmKPExsWy7bCmhq7JZv50g7efxC0+fv3NYtE04S+z x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Fngg55E6X/WX1xCDS3WuhXpjZxQ0bX/cf8q46f7fxc p9xpzbhkZsmPrOb1T0209+qG749q6J/VmR7fv//TD81m729NyxuUWIozEg21mIuKEwFe/GhU DAMAAA== X-CMS-MailID: 20241016113724epcas5p191ccce0f473274fc95934956662fc769 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113724epcas5p191ccce0f473274fc95934956662fc769 References: <20241016112912.63542-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 88e3ad73c385..8c41a380f2bd 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -562,7 +562,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 dd831c269e99..485d8a43017a 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 Oct 16 11:29:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838348 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 E6B1A207A15 for ; Wed, 16 Oct 2024 12:36:15 +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=1729082177; cv=none; b=UFCQMU038YWiJ3gRFmHBZUpEY3ZNv+XujrEl9oeVK1/JzMz7ldl66AWgGeBmDSsyB/1QQdKmJ2zyUPs7XEbToja3/M53japffD0RV3IHSIiNseP6gJxPwzap1HxuDOGaTCV0JCLEK9s9GHCi/7NfWbWZl5j5qk7LGKhOZk7zaoE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082177; c=relaxed/simple; bh=80iN9wH8fZxRyeNmWrkbWUyfZDLjnh4UxZJ8TgsMhwQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=EJLIuMP24Aqw7B2e4TXIJo9eOCxo6tTUx0tp2aYc0krfNZ/QwRT3UVpFMJh3lG/48Gqetu2O/hAEzCqMHWS+3miW50aZnWdC+/H5cH11fCb6tUnk3b5oP7hiRg/9fBJFeHvkdUIjbgsRTJhWBohqmH54i7nAEI6350+ncLPj2zY= 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=qTxxlxP2; 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="qTxxlxP2" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241016123613epoutp019d4c233b88ed0f141f3e149be79c667b~_7xN4MSlD1584015840epoutp01j for ; Wed, 16 Oct 2024 12:36:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241016123613epoutp019d4c233b88ed0f141f3e149be79c667b~_7xN4MSlD1584015840epoutp01j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082173; bh=j7kMMqrhvwE2U0rxzDSx84hS80YAqcLX62yw/e5POuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qTxxlxP2uiHNWdOkVRzGlZtNl38clk5mvooKlLnQkWC/5wbfrM2AqcD0wvincuxeF 1csi7r0ovhI3r8H8YEpEs/AQza847ZdUrmHwAIEgJEno5GqOAFK9AgkwIIzkSc+VF0 d7r2B2LZluGqF+IvG0iktE7harLsRvv5No1QQvOA= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241016123613epcas5p4fefeb190c8f152295a5cdf8c574aa8d7~_7xNa1bVV1646816468epcas5p4f; Wed, 16 Oct 2024 12:36:13 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.181]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XT9SC1Myxz4x9Px; Wed, 16 Oct 2024 12:36:11 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id E3.01.09770.B33BF076; Wed, 16 Oct 2024 21:36:11 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241016113736epcas5p3a03665bf0674e68a8f95bbd5f3607357~_6_CEFDD92628326283epcas5p3B; Wed, 16 Oct 2024 11:37:36 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241016113736epsmtrp23f19cc615b949554c87694a6229b48af~_6_CDSKot1555115551epsmtrp2e; Wed, 16 Oct 2024 11:37:36 +0000 (GMT) X-AuditID: b6c32a4a-e25fa7000000262a-c4-670fb33b0423 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EC.BA.08229.085AF076; Wed, 16 Oct 2024 20:37:36 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113734epsmtip176042ea87fdd663dbe664cf7e714eea5~_6_AIsgrp2871328713epsmtip12; Wed, 16 Oct 2024 11:37:34 +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, krisman@suse.de 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, Anuj Gupta Subject: [PATCH v4 02/11] block: copy back bounce buffer to user-space correctly in case of split Date: Wed, 16 Oct 2024 16:59:03 +0530 Message-Id: <20241016112912.63542-3-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-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+NgFjrAJsWRmVeSWpSXmKPExsWy7bCmuq71Zv50g6Xf2C0+fv3NYtE04S+z xZxV2xgtVt/tZ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4PnZ1dfzj0w7bXRjab90oleuTN0N+18keH+KOvx5kk6+6Mv1EuprZ+isnSVV8XmhNCO mFvx61WOd5yw5Zjn/GmHQJzeMrEjR1WTBNmUw+IEChfa5r98p8RSnJFoqMVcVJwIACMVt0YM AwAA X-CMS-MailID: 20241016113736epcas5p3a03665bf0674e68a8f95bbd5f3607357 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113736epcas5p3a03665bf0674e68a8f95bbd5f3607357 References: <20241016112912.63542-1-anuj20.g@samsung.com> Copy back the bounce buffer to user-space in entirety when the parent bio completes. Signed-off-by: Anuj Gupta Reviewed-by: Keith Busch --- block/bio-integrity.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 8c41a380f2bd..8948e635432d 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -119,8 +119,8 @@ 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 bio_vec *copy = &bip->bip_vec[1], *bvec = &bip->bip_vec[0]; + size_t bytes = bvec->bv_len; struct iov_iter iter; int ret; From patchwork Wed Oct 16 11:29:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838349 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 52B692076BA for ; Wed, 16 Oct 2024 12:36:27 +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=1729082189; cv=none; b=eJ7d32TKc1I4SZv5E1Gu1//KCYiVqCI2dXlxrZBLF1CfH+k2sNiS8u2/LQjEvz3nVAZEdUEedIV+IJzZlU4foEM0jbnX5lgm++MvddFB27Ux7oeZMcmNcb+/iaPvnnAJ3f6ADqXuDeCbXAR8h6eixvSambXABUKmV+x+FKkviYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082189; c=relaxed/simple; bh=he/RKtwB0BA6gZ5+5gIwr4rdDI2BtLEw7XicuZ0Kc5A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=WCNXUN/lrvYu+3oLS79Gi8BlPPCaBQV2bb41+YnbJLdinbyKkc5Cb5B144hoOfHYVZBo3EstH+pyYnnk84tlnRTJNCEqDO7LgBC2nBxfzO8bG0EAoscaZEy97HbZzmIVleq+g8ozCU8TQNokPKMQ4WDGvVuYvB2WeGls7pjjcI8= 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=i2H0uxzT; 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="i2H0uxzT" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241016123625epoutp0344d2c4aafa065beafa67a532be1b3709~_7xYRux641144611446epoutp03x for ; Wed, 16 Oct 2024 12:36:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241016123625epoutp0344d2c4aafa065beafa67a532be1b3709~_7xYRux641144611446epoutp03x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082185; bh=UVsxMR53W9XtECcTqAPzjCe5MFT++ZFTK0IoQGFyX50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i2H0uxzTjQrTysPpdFAZ3k9U1AWyqYia/NdpqN5CW4mstpfp/b3OLSRDDnjQbgqEp 5qYkgTzu+nykMAzUBxll68UCVhlXFm0nS2jaGaMpCSP0ku8PGI6mE2z2qOYlpvyHGY HD0y+1hb6ZQPjL2o0IKdGsKtbPwgz++9pu9M59qc= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241016123624epcas5p2f0d8b35c2ea1b60bc616d926c088e95a~_7xXYp64r3112131121epcas5p2S; Wed, 16 Oct 2024 12:36:24 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.180]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XT9SQ3t5cz4x9Pr; Wed, 16 Oct 2024 12:36:22 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 7E.43.18935.643BF076; Wed, 16 Oct 2024 21:36:22 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241016113738epcas5p2d217b8d6efbf855f61c133f64deaa486~_6_EOP5tl3038230382epcas5p26; Wed, 16 Oct 2024 11:37:38 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241016113738epsmtrp16c8c84804246c27c5bbbec8778145815~_6_ENcN6u0254402544epsmtrp1o; Wed, 16 Oct 2024 11:37:38 +0000 (GMT) X-AuditID: b6c32a50-cb1f8700000049f7-14-670fb346808a Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 2D.9A.07371.285AF076; Wed, 16 Oct 2024 20:37:38 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113736epsmtip1c8a477b3eda0933f06fe491b78581761~_6_CJyia12875928759epsmtip1E; Wed, 16 Oct 2024 11:37:36 +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, krisman@suse.de 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, Anuj Gupta , Kanchan Joshi Subject: [PATCH v4 03/11] block: modify bio_integrity_map_user to accept iov_iter as argument Date: Wed, 16 Oct 2024 16:59:04 +0530 Message-Id: <20241016112912.63542-4-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-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+NgFjrOJsWRmVeSWpSXmKPExsWy7bCmhq7bZv50g3PTZC0+fv3NYtE04S+z xZxV2xgtVt/tZ7O4eWAnk8XK1UeZLN61nmOxOPr/LZvFpEPXGC22n1nKbLH3lrbF/GVP2S26 r+9gs1h+/B+TxflZc9gd+D12zrrL7nH5bKnHplWdbB6bl9R77L7ZwObx8ektFo++LasYPTaf rvb4vEkugDMq2yYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DX LTMH6HwlhbLEnFKgUEBicbGSvp1NUX5pSapCRn5xia1SakFKToFJgV5xYm5xaV66Xl5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TUv50g/+rdCw+fv3NYtE04S+z xZxV2xgtVt/tZ7O4eWAnk8XK1UeZLN61nmOxOPr/LZvFpEPXGC22n1nKbLH3lrbF/GVP2S26 r+9gs1h+/B+TxflZc9gd+D12zrrL7nH5bKnHplWdbB6bl9R77L7ZwObx8ektFo++LasYPTaf rvb4vEkugDOKyyYlNSezLLVI3y6BK+Pnh/2MBe/kKnov/mVvYDwv2cXIwSEhYCLxcDpPFyMX h5DAbkaJqz/62boYOYHiEhKnXi5jhLCFJVb+e84OUfSRUWLp7zlMIAk2AXWJI89bGUESIgKz GCUOz5rPBOIwC3xnlJi2/BoLyAphgViJCRvkQRpYBFQlFt7pAtvAK2Ap8e3NRRaIDfISMy99 ZwexOQWsJE6dOwhmCwHV/Jv8gRGiXlDi5MwnYPXMQPXNW2czT2AE2oqQmoUktYCRaRWjZGpB cW56brJhgWFearlecWJucWleul5yfu4mRnAcaWnsYLw3/5/eIUYmDsZDjBIczEoivJO6eNOF eFMSK6tSi/Lji0pzUosPMUpzsCiJ8xrOmJ0iJJCeWJKanZpakFoEk2Xi4JRqYMrMXLbl/OQD R2UmvDy+ZfOarW/XvYypyL4i3bwz9805VospvNuMrj9IuH9yNtddaceLQdWL1qfsUl98qGv3 hbWNhc+yXzxRFt697YHqgtb3TQnLhad561Q+eOW5Jt6vUc1V4vuTqmk6Z7LOv1kr9ZNrgarU +1u2zHvX7T0iYGNz541PichVm9INITs2W5jWzf7WrS8XrPHMc9d83jne5n7LjPymNuUdv2IQ HOwWarkk+fZaNXlp2yW635/tPx68hMPyk4SHonvE2xdrRCSePMncGNPcvkrW74LZqf5DE0NU 653zT539PY9pec4V9rZNWS+X95d8f6Xaf+nZodPKIfMjNh5kuOFw5Czn8uPn/QMrlFiKMxIN tZiLihMBt0Z1GRIDAAA= X-CMS-MailID: 20241016113738epcas5p2d217b8d6efbf855f61c133f64deaa486 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113738epcas5p2d217b8d6efbf855f61c133f64deaa486 References: <20241016112912.63542-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 --- block/bio-integrity.c | 12 +++++------- block/blk-integrity.c | 10 +++++++++- include/linux/bio-integrity.h | 6 +++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 8948e635432d..341a0382befd 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -303,17 +303,16 @@ 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, u32 seed) { 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)) @@ -326,8 +325,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) { @@ -337,8 +335,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 83b696ba0cac..cb8f7260bdcf 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, u32 seed) { - int ret = bio_integrity_map_user(rq->bio, ubuf, bytes, seed); + 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, seed); if (ret) return ret; diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index 485d8a43017a..90aab50a3e14 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, u32 seed); +int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter, u32 seed); 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,8 @@ 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, u32 seed) +static inline int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter, + u32 seed) { return -EINVAL; } From patchwork Wed Oct 16 11:29:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838350 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 B025E207A09 for ; Wed, 16 Oct 2024 12:36:35 +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=1729082197; cv=none; b=GTFxjiztMIf9EWtUwX1eNgG9qxFgrGdvI1IOAfwpHlkqqizM4cnaq1koRjmDgMDVIWVL9kB1RdFM2g0SEcfycFO/HFzPBzH0JzJQ4+6Zpzws4CBbs6WYMmxXQNgwb4jYXwqvss1gA+S1ZwgGPCq0uKtRTdi5scqDshlW1D3SCjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082197; c=relaxed/simple; bh=ZF260PFRqTY8i0xvJfFGVVeNsxKecPbr5WJiEFbnwj0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=vC0/wkcUa49TZDmy8U7sGsUdHGc1WQ32DD4js5OE0ZAvCokjrsqciM2YtUgNBeDkIC13Fa0+hp2+fac5TxLxQJ8fMJNafZpGOMYRzNMdwhIjGn66RqzBWv+8nufwDLsftjB2xIdlH7Mi9yZf9lcNewIVM+rjndBqoTuBCQS3GBk= 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=g5VMOxn7; 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="g5VMOxn7" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241016123633epoutp03cac8e06ba9c12490c476c3f35d6e977e~_7xgLXjjX1083010830epoutp03B for ; Wed, 16 Oct 2024 12:36:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241016123633epoutp03cac8e06ba9c12490c476c3f35d6e977e~_7xgLXjjX1083010830epoutp03B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082193; bh=UKoRNiCpE9xYsK9GrO7c2Huj45QYroY0N/mJ/Q8UOgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g5VMOxn7sS5c4XXHGRpj/NR68Ico3k7JQF1ZuhVekvENVxYA37kZ+RArLMsSE7tCr UR2bFn6Ix7SPHtW9Fi0Crqsf2NNjPTXFaSemHOegex0daLD2JHhtPqkCHJYagy+r+U GMZRt/La0DSmHRGmK2GJfjFWhlheAlkT/WTpFDtE= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241016123632epcas5p3e1a8e0f298d5b0f8dfc499cf647650b0~_7xfUVskf2029820298epcas5p3a; Wed, 16 Oct 2024 12:36:32 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.177]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XT9SZ6CBYz4x9Pv; Wed, 16 Oct 2024 12:36:30 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 09.08.09420.E43BF076; Wed, 16 Oct 2024 21:36:30 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241016113741epcas5p3b90adb3b43b6b443ffd00df29d63d289~_6_GdhFFt1063910639epcas5p3I; Wed, 16 Oct 2024 11:37:41 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241016113741epsmtrp1a08274ed734fadd9a7decb4cd101e4cf~_6_GcrwNh0254402544epsmtrp1p; Wed, 16 Oct 2024 11:37:41 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-c2-670fb34e35ba Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 3E.9A.07371.485AF076; Wed, 16 Oct 2024 20:37:41 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113738epsmtip15ae17822cc4bf05c896c76e759451560~_6_EWKVy-2875928759epsmtip1F; Wed, 16 Oct 2024 11:37:38 +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, krisman@suse.de 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, Kanchan Joshi , Anuj Gupta Subject: [PATCH v4 04/11] block: define meta io descriptor Date: Wed, 16 Oct 2024 16:59:05 +0530 Message-Id: <20241016112912.63542-5-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-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+NgFjrBJsWRmVeSWpSXmKPExsWy7bCmpq7fZv50g52bDC0+fv3NYtE04S+z xZxV2xgtVt/tZ7O4eWAnk8XK1UeZLN61nmOxOPr/LZvFpEPXGC22n1nKbLH3lrbF/GVP2S26 r+9gs1h+/B+TxflZ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X3EZRqpFCaa/eGwexndVnv79hfWCEktxRqKhFnNRcSIA 6fhL3hIDAAA= X-CMS-MailID: 20241016113741epcas5p3b90adb3b43b6b443ffd00df29d63d289 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113741epcas5p3b90adb3b43b6b443ffd00df29d63d289 References: <20241016112912.63542-1-anuj20.g@samsung.com> From: Kanchan Joshi Introduces 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/bio-integrity.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index 90aab50a3e14..529ec7a8df20 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -30,6 +30,16 @@ struct bio_integrity_payload { struct bio_vec bip_inline_vecs[];/* embedded bvec array */ }; +/* flags for integrity meta */ +typedef __u16 __bitwise meta_flags_t; + +struct uio_meta { + meta_flags_t flags; + u16 app_tag; + u32 seed; + struct iov_iter iter; +}; + #define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_CTRL_NOCHECK | \ BIP_DISK_NOCHECK | BIP_IP_CHECKSUM) From patchwork Wed Oct 16 11:29:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838351 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 886EC208217 for ; Wed, 16 Oct 2024 12:36:43 +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=1729082206; cv=none; b=S174TLPedxMFexEpfMqKXxDTFvM/m0cNUF+aVsJDe0/AnYUYgTHD4QD1hT/LRdH3LXvLVjOPe96yLYM145oUCzvNFNXGr5kKygMgK6z7jWxVTYlUqt8AwF1J8OdUKC5fMJVn/dvjhDjXwcIqlg5y2am5eBmBx8DO/xdMGohkoOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082206; c=relaxed/simple; bh=Xu1LbGRncxovRrdMmeiSgMvWFfaeTe1/VhI1JxApEKY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=uUqRsjZarpOVX8BNz3u5uwaPsl6QU4qytUg40tr+0IUOOVVUd/TZep8yY8+9TpX01cQcgaNY6p/AkLGoaeVJOooxYBoWNmBRO+zD5wdo5z8QdlXLc+0hotaG0LdMUJD4f41K7N9yJmvwCi+GtcZtZLXRGYPQreEgsj8pWU8P65E= 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=sPhbQHLy; 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="sPhbQHLy" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241016123641epoutp01c521d326006e6f691b89488c2b181a60~_7xnx4FUg1584015840epoutp01s for ; Wed, 16 Oct 2024 12:36:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241016123641epoutp01c521d326006e6f691b89488c2b181a60~_7xnx4FUg1584015840epoutp01s DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082201; bh=ixWRd6Ku3AHLpgpPOdfQwfzu6Ddv6cbLE0o4Y5h4UVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sPhbQHLyV3BJ0gPwaVUU0uhLZccN3jWWum31eHCRN0sS+BWDx5dSgLhKeLbiIqayM jBs5Q2rlrknKiAKP4jsFgsTXVqkKOGvRzlf9jN4nOeOl4gdy8vPUfA39KQg0KqSTdB LG4fENZXtVTeKVldUhQwpvDnefYAGOX6wp1HvfS8= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241016123641epcas5p28eda85d51e3c2d8369f8a94bf82dfc8d~_7xnN5CRN1006810068epcas5p2-; Wed, 16 Oct 2024 12:36:41 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.174]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4XT9Sl2YnBz4x9Pp; Wed, 16 Oct 2024 12:36:39 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 09.90.09800.753BF076; Wed, 16 Oct 2024 21:36:39 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241016113743epcas5p3b4092c938d8795cea666ab4e6baf4aa9~_6_Ijwnih1066710667epcas5p3_; Wed, 16 Oct 2024 11:37:43 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241016113743epsmtrp22f1660c34422b1efbeeb7bfd71bfb89a~_6_Ii7uEO1555115551epsmtrp2f; Wed, 16 Oct 2024 11:37:43 +0000 (GMT) X-AuditID: b6c32a4b-4a7fa70000002648-6e-670fb357c8db Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 0E.68.08227.785AF076; Wed, 16 Oct 2024 20:37:43 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113741epsmtip197a1754cc8002dde58ee35e56722c539~_6_GfTUfB2875928759epsmtip1G; Wed, 16 Oct 2024 11:37:41 +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, krisman@suse.de 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, Anuj Gupta Subject: [PATCH v4 05/11] fs: introduce IOCB_HAS_METADATA for metadata Date: Wed, 16 Oct 2024 16:59:06 +0530 Message-Id: <20241016112912.63542-6-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-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+NgFjrCJsWRmVeSWpSXmKPExsWy7bCmpm74Zv50g63ThSw+fv3NYtE04S+z xZxV2xgtVt/tZ7O4eWAnk8XK1UeZLN61nmOxmHToGqPF9jNLmS323tK2mL/sKbtF9/UdbBbL j/9jsjg/aw67A5/Hzll32T0uny312LSqk81j85J6j903G9g8Pj69xeLRt2UVo8fm09UenzfJ BXBGZdtkpCampBYppOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAF2u pFCWmFMKFApILC5W0rezKcovLUlVyMgvLrFVSi1IySkwKdArTswtLs1L18tLLbEyNDAwMgUq TMjOmPn4PXPBctaK64dOMDcwrmPpYuTkkBAwkZjydQ9TFyMXh5DAbkaJRY0gCRDnE6PEvJs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5/Hzll32T0uny312LSqk81j85J6j903G9g8Pj69xeLRt2UVo8fm09UenzfJ BXBGcdmkpOZklqUW6dslcGXMfPyeuWA5a8X1QyeYGxjXsXQxcnJICJhI/D++l6mLkYtDSGA3 o8TDZb9YIRISEqdeLmOEsIUlVv57zg5R9JFRYsr7/0wgCTYBdYkjz1sZQRIiArMYJQ7Pmg82 ilngAqPE1X3P2EGqhAXcJCYuOQTWwSKgKvF41w02EJtXwFLi4+RDUOvkJWZe+g5WzylgJXHq 3EEwWwio5t/kD4wQ9YISJ2c+AbubGai+eets5gmMQGsRUrOQpBYwMq1ilEwtKM5Nzy02LDDK Sy3XK07MLS7NS9dLzs/dxAiOIC2tHYx7Vn3QO8TIxMF4iFGCg1lJhHdSF2+6EG9KYmVValF+ fFFpTmrxIUZpDhYlcd5vr3tThATSE0tSs1NTC1KLYLJMHJxSDUxWtcc3Sf7+YX6GoXT7us4Z botu/nrXNi/iysbtf9wfnZb6cNOBby337Sd/b6rfDP4V9PFZZe/Td7u/us1vb33y0NCsNJ2j MMolb92OztdndgXuk1+/uS1l16IfV5az/rw3MX8vv3j0I96OuEjmG9O1xVkEm2zu+e6+VXnB dpvui9/9pQxGf68sTfslVKdxzqrl0Ln1lxPlayatWBDYvbJ50dbWSq0vRp/sv1zs4TJ7UPz7 G0dnV5O+7L+DqQ0db8SnacY8dd1dcPC+6bWZP9dpvGeVf2vbEvH72u3w/SbRdypuCH5blHOA 4esxwx3C/bOnr5xkP1voi2d6k3H/3p1P2+TvLDz7c4ubo+pV03WicUosxRmJhlrMRcWJAEi5 2IoPAwAA X-CMS-MailID: 20241016113743epcas5p3b4092c938d8795cea666ab4e6baf4aa9 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113743epcas5p3b4092c938d8795cea666ab4e6baf4aa9 References: <20241016112912.63542-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 3559446279c1..f451942db74b 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 Oct 16 11:29:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838352 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 55E6D208972 for ; Wed, 16 Oct 2024 12:36:50 +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=1729082212; cv=none; b=aHBg8G5fwigUmwOEsM6LqwwKXNHSEQrDinCqZyzhW1dMQ6NYSZxtzhLg8YHRN+3D33SaAouvz3rzBdTj4SIqrDUdnJXRmXw+r6gNvXHCHqTBo1bW2WD9WNHWhIiWUSDKoJN1mrNLigMIx4d9pyTREgqBqYQ5tbWo4LPMCiwJuh0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082212; c=relaxed/simple; bh=FD1Rr3gSIir5niLs2wMOY9Fp6ypa/E7yl+xDRorWEKA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=figASDL+E2bH5JVDnFKy1gIADeBEtDEggmqiTXddr28m2a6MH8K+tYqvX1+hHc3gQY7tQhqlLMYYCt/HuqyoUm9QXt6qEGPEbRVWlGJ9LuqZpsYbxbOUVfWhzF+vkJf0yRdn/xBKxF0WMQyeFrYTsO2XyoXek2X20vJ4XhpCJnE= 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=FN/TWIfL; 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="FN/TWIfL" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241016123648epoutp045bd9c3ec142e20e2e33381ce41a6a527~_7xuLgH_z1871018710epoutp04j for ; Wed, 16 Oct 2024 12:36:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241016123648epoutp045bd9c3ec142e20e2e33381ce41a6a527~_7xuLgH_z1871018710epoutp04j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082208; bh=pP7fuKjfTHtbF6PT6N4PWc3TJYSIrBfJKrC83hsylPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FN/TWIfLUV/X93G36rboLeGzr/WfyzK7gW3g5K+iL9uqn6Dlq0w+CESQe1zGNDvDX wormGNQTzlnAN5Ud/ZPUkj2ljxvp++R+NMMgHinXKj4RSbOYluj8+4BbFvSZ+yLR7R OT2hxF3C5HzKmiPP0bW8/CEy+k6eH5s86me8e1Q8= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241016123647epcas5p2361dbf3e7a9c551f2321d41a62c57b26~_7xtmixik1006810068epcas5p2J; Wed, 16 Oct 2024 12:36:47 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.177]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4XT9St2kWdz4x9Pp; Wed, 16 Oct 2024 12:36:46 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F5.37.08574.E53BF076; Wed, 16 Oct 2024 21:36:46 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241016113745epcas5p1723d91b979fd0e597495fef377ad0f62~_6_KjuipO1436014360epcas5p1C; Wed, 16 Oct 2024 11:37:45 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241016113745epsmtrp24559f8dcad65ab7967e8ec2fd2772af3~_6_Ki4UcD1554615546epsmtrp2v; Wed, 16 Oct 2024 11:37:45 +0000 (GMT) X-AuditID: b6c32a44-6dbff7000000217e-18-670fb35e2cd8 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 5F.BA.08229.985AF076; Wed, 16 Oct 2024 20:37:45 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113743epsmtip1498e161032d7d5e8bb1c6da199eaf0ee~_6_IkrovM3048330483epsmtip1k; Wed, 16 Oct 2024 11:37:43 +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, krisman@suse.de 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, Anuj Gupta Subject: [PATCH v4 06/11] block: add flags for integrity meta Date: Wed, 16 Oct 2024 16:59:07 +0530 Message-Id: <20241016112912.63542-7-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-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: H4sIAAAAAAAAA02Te0xbVRzHc27fJN3uynRHBFdvAgSUR6XU2w6cRNyaDSOooPiHtaHXFlva rrcFNkxWWZpZ5L0sGx2vKEhafDBg5VFqRi2y1a1sq45HgjFxjCphioAKOGLLLbr/Puf3+v5+ v3MOm8bzMGPYpVojYdDKNRgziu78Jikp5Z2Bvcr0n5f24SvrW3S8uvEhDW91OAHeO9/AxGev jiC4vXcCwR9Y/HS82XMX4EM3umm4e+4ZvOOzBRb+8fQwE++Z3EbwKVsr68U90hHbPEsauGmS 9jusTOlA12mpa9bMlK4szNGl9YMOIB34rkq62v9UPudtdZaKkCsIA5/QlugUpVplNnb8ddlL skxRuiBFIMafx/haeRmRjeXm5accKdWEOsf45XKNKWTKl5MklvZClkFnMhJ8lY40ZmOEXqHR C/WppLyMNGmVqVrCKBGkpz+XGQp8V60au/URQ+9nVda6bjHNoItZAzhsiArhubnPkRoQxeah LgCH+zYZ1OEPAK/VVkc8fwLo/MFB202x/O7dYR7qBjDgJqmgVQAvzFh3HEw0EXoXLSDM+9Fm ABcDhWGmoT4Av9jkhzkazYbLG1YkzHQ0HrZNn9/piYuKYYdlHFBiB2HLnb9YYeagEujzj7Oo mH3wess9OlXzIDxz5RIt3AREB9mwa6OJQSXnwl8C30c4Gv46OciiOAauPnBHFqCEfwcWEIr1 8My3X0eED0OLryFUlB0SSIJfjaZR5jh43vclQunugXVb9yKpXDjcvssYPGtvjTCEbr8ZCZeB qBTWeeKoXdUBOOW4z2gEfNsj49ge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qB3iJGJg/EQowQHs5II76Qu3nQh3pTEyqrUovz4 otKc1OJDjNIcLErivOIvelOEBNITS1KzU1MLUotgskwcnFINTEK98++9KVkos7vMXDpKRWIK /43wCaLKHFucErNcdywKE1DcfGjyHbnaVxFGlV/O7GKfaCMVqte4pNVGdn9mEkv4pRrd5j/n Xeo3Hxf4OqffZ4/O4QLpN8JrVxzjNfOWkWj6kOZe4P/M4WZo6iK1xQndslkx6ksils5tkpcL 39eQYZDxKjrZd2pAulbCuZDOdcyJNx9/60pkUXqap/FdUf/a60VNb1eFikREyPyxXsYs7XlE WNP3it/7gw2XJqr4eWtJ6y7NZDz6Zpre8nCWTF+Tyk1TBXT3NTPuKliT4qQucXxxY6z3I7b/ VSnz7mUu032WFzlzj03IjOdRinxzi0/XXeBrtn1lkZ18cJ8SS3FGoqEWc1FxIgDFjT49DwMA AA== X-CMS-MailID: 20241016113745epcas5p1723d91b979fd0e597495fef377ad0f62 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113745epcas5p1723d91b979fd0e597495fef377ad0f62 References: <20241016112912.63542-1-anuj20.g@samsung.com> Add flags to describe checks for integrity meta buffer. These flags are specified by application as io_uring meta_flags, added in the next patch. Signed-off-by: Anuj Gupta --- include/uapi/linux/blkdev.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/uapi/linux/blkdev.h b/include/uapi/linux/blkdev.h index 66373cd1a83a..d606f8b9c0a0 100644 --- a/include/uapi/linux/blkdev.h +++ b/include/uapi/linux/blkdev.h @@ -11,4 +11,15 @@ */ #define BLOCK_URING_CMD_DISCARD _IO(0x12, 0) +/* + * flags for integrity meta + */ +#define BLK_INTEGRITY_CHK_GUARD (1U << 0) /* enforce guard check */ +#define BLK_INTEGRITY_CHK_APPTAG (1U << 1) /* enforce app tag check */ +#define BLK_INTEGRITY_CHK_REFTAG (1U << 2) /* enforce ref tag check */ + +#define BLK_INTEGRITY_VALID_FLAGS (BLK_INTEGRITY_CHK_GUARD |\ + BLK_INTEGRITY_CHK_APPTAG |\ + BLK_INTEGRITY_CHK_REFTAG) + #endif From patchwork Wed Oct 16 11:29:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838353 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 D2B67207A03 for ; Wed, 16 Oct 2024 12:36:58 +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=1729082220; cv=none; b=ExygVlNdT1SPx08xcA9HrxtS/DkOyJywtZ9N4bVNsxGN3m2ro6S6axwO8tM5LHFhTyZ8ak1+WZixWfQAKJysoHYjryptroScEOq+bL1eZ8skUyiJwwYEq2NQnmPuw7daXgrjzDwXqPxKvEMqFOyOr2S91HBTiNVtiUTvCoUbFz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082220; c=relaxed/simple; bh=AFxgKf2CMX7UNneAa1dPUe538R2nji7Q/4SWY/M9j3U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=ap10cdWmhnqVBlBIjHB+ZtqHVp9koVCj1DVjEw5PfY7gb8neonAZ7aS/mBbSFZFJjMWZTTglraG8c+kAkL7lNsNbqulfxX374XFA9fdsLiFZ9M17HhlHrdLUnNEE0+UDI+7j5JtOxIrLJP8js8Jqj3uAks455LR1lv27s7WU17U= 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=E53Udn/g; 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="E53Udn/g" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20241016123656epoutp02b6eaca7f53f07b11f88c84494a46de2f~_7x14bQhb1819918199epoutp02P for ; Wed, 16 Oct 2024 12:36:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20241016123656epoutp02b6eaca7f53f07b11f88c84494a46de2f~_7x14bQhb1819918199epoutp02P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082216; bh=O39Go3fokUwZDWd7rBK8ZXZOW5p4wPCNqPYj2KzQgs0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E53Udn/gnHiNCBebXklaOd7wKsg7xwfExftYL4UfvTYuZyy8wm+x1ldF9R5zj1jJX DZsrGR63wn9hP39RNsl590jTsz27FoiUX4NrNUHIODyjBezs4TloNzSq5hu85dg2Ht 4EdsNrgRUdlsVSld/MFqOUSHhveyvStdAM0KkPhI= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241016123656epcas5p175030dfc059206de463d20baff9a97c1~_7x1X84gm0838008380epcas5p1v; Wed, 16 Oct 2024 12:36:56 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.179]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XT9T23fNTz4x9Pt; Wed, 16 Oct 2024 12:36:54 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id DA.37.08574.663BF076; Wed, 16 Oct 2024 21:36:54 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241016113747epcas5p4e276eb0da2695ba032ce1d2a3b83fff4~_6_MxwORC2712227122epcas5p4e; Wed, 16 Oct 2024 11:37:47 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241016113747epsmtrp1f416b0972e498ffb7e22bae5484e113b~_6_Mvz4fa0254402544epsmtrp1t; Wed, 16 Oct 2024 11:37:47 +0000 (GMT) X-AuditID: b6c32a44-6dbff7000000217e-26-670fb366331e Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id CF.9A.07371.B85AF076; Wed, 16 Oct 2024 20:37:47 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113745epsmtip1125d8d26ee15ee70412c75ac746a6bf6~_6_KnXcxQ2871328713epsmtip15; Wed, 16 Oct 2024 11:37:45 +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, krisman@suse.de 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, Anuj Gupta , Kanchan Joshi Subject: [PATCH v4 07/11] io_uring/rw: add support to send meta along with read/write Date: Wed, 16 Oct 2024 16:59:08 +0530 Message-Id: <20241016112912.63542-8-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscrib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s8foXrN0s4uofV2sYpqnF7XI9eF5gyUx YU/Tt4q+iPeb7hWe3pFQYZj5pyeDLfPd01UMLKuM/nGx2l0/2v+1N2HHbP16yRdhqw08zzvY f1x/Pu7Wn/Anz6rOnTVjOeHR0x1VaOeycLd/04fVuQGJb13uXrYpWutl1GJbZePd1WXy6XD9 D6H+fRcy1G5X1pt+syts8bh4snKPbOIhyaOVhcW7TL69/7KRJ+aGeKyeEktxRqKhFnNRcSIA PssA2RQDAAA= X-CMS-MailID: 20241016113747epcas5p4e276eb0da2695ba032ce1d2a3b83fff4 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113747epcas5p4e276eb0da2695ba032ce1d2a3b83fff4 References: <20241016112912.63542-1-anuj20.g@samsung.com> This patch adds the capability of sending meta along with read/write. This meta is represented by a newly introduced 'struct io_uring_meta' which specifies information such as meta type,flags,buffer,length,seed and apptag. Application sets up a SQE128 ring, prepares io_uring_meta 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 | 26 ++++++++++++ io_uring/io_uring.c | 6 +++ io_uring/rw.c | 75 +++++++++++++++++++++++++++++++++-- io_uring/rw.h | 15 ++++++- 4 files changed, 118 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 86cb385fe0b5..1cd165720fcc 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -105,6 +105,32 @@ 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' + */ + __u8 big_sqe_cmd[0]; +}; + +enum io_uring_sqe_meta_type_bits { + META_TYPE_INTEGRITY_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_INTEGRITY (1U << META_TYPE_INTEGRITY_BIT) + +/* this goes to SQE128 */ +struct io_uring_meta { + __u16 meta_type; + __u16 meta_flags; + __u32 meta_len; + __u64 meta_addr; + __u32 seed; + __u16 app_tag; + __u8 pad[42]; }; /* diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index d7ad4ea5f40b..e5551e2e7bde 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3857,6 +3857,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) > + sizeof(struct io_uring_sqe)); + + BUILD_BUG_ON(META_TYPE_LAST_BIT > + 8 * sizeof_field(struct io_uring_meta, meta_type)); + io_uring_optable_init(); /* diff --git a/io_uring/rw.c b/io_uring/rw.c index 80ae3c2ebb70..b727e5ef19fc 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -257,6 +257,49 @@ 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) +{ + const struct io_uring_meta *md = (struct io_uring_meta *)sqe->big_sqe_cmd; + u16 meta_type = READ_ONCE(md->meta_type); + const struct io_issue_def *def; + struct io_async_rw *io; + int ret; + + if (!meta_type) + return 0; + if (!(meta_type & META_TYPE_INTEGRITY)) + return -EINVAL; + + def = &io_issue_defs[req->opcode]; + if (def->vectored) + return -EOPNOTSUPP; + + io = req->async_data; + io->meta.flags = READ_ONCE(md->meta_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->meta_addr)), + READ_ONCE(md->meta_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) { @@ -279,11 +322,18 @@ 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; + if (unlikely(req->ctx->flags & IORING_SETUP_SQE128)) + ret = io_prep_rw_meta(req, sqe, rw, ddir); + return ret; } int io_prep_read(struct io_kiocb *req, const struct io_uring_sqe *sqe) @@ -410,7 +460,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 (unlikely(rw->kiocb.ki_flags & IOCB_HAS_METADATA)) + io_meta_restore(io); iov_iter_restore(&io->iter, &io->iter_state); } @@ -777,8 +830,12 @@ static inline int io_iter_do_read(struct io_rw *rw, struct iov_iter *iter) static bool need_complete_io(struct io_kiocb *req) { + struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); + + /* Exclude meta IO as we don't support partial completion for that */ return req->flags & REQ_F_ISREG || - S_ISBLK(file_inode(req->file)->i_mode); + S_ISBLK(file_inode(req->file)->i_mode) || + !(rw->kiocb.ki_flags & IOCB_HAS_METADATA); } static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type) @@ -795,7 +852,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 +881,14 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type) kiocb->ki_complete = io_complete_rw; } + if (unlikely(kiocb->ki_flags & IOCB_HAS_METADATA)) { + struct io_async_rw *io = req->async_data; + + if (!(req->file->f_flags & O_DIRECT)) + return -EOPNOTSUPP; + kiocb->private = &io->meta; + } + return 0; } @@ -898,6 +963,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 (unlikely(kiocb->ki_flags & IOCB_HAS_METADATA)) + io_meta_restore(io); do { /* @@ -1102,6 +1169,8 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags) } else { ret_eagain: iov_iter_restore(&io->iter, &io->iter_state); + if (unlikely(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..af9e338b2bd8 100644 --- a/io_uring/rw.h +++ b/io_uring/rw.h @@ -1,6 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include + +struct io_meta_state { + u32 seed; + struct iov_iter_state iter_meta; +}; struct io_async_rw { size_t bytes_done; @@ -9,7 +15,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 Oct 16 11:29:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838355 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 19027208972 for ; Wed, 16 Oct 2024 12:37:13 +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=1729082234; cv=none; b=YqKY3CViy2jgtU2xDyNJ/MjPZ6NvYf0QewUbYofpGG+WcUMIyFWkMDgyukoN6a90DyX2+BNy/L/DGnZpbMJaFma+RyoH6eMUJfxUpcGM0I8RtDMdJ6JLxrFqinZBz8LSAGcFBIqwz4WYbsQn4RB+FEUh0sA+9I2nhuj6HxNqWzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082234; c=relaxed/simple; bh=FmY5BXEWM+NaI9Vzxv8DOlPlOtT5OJ1qgnE39com+lY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=MJS4Mvmavl6wfenkr0E+w8ccGGpwohg+5lKcehkQ7rWUhxB8dJ2ZEdok38DLskVy4AJKHK94rj6ZDawasEQJNQx5tE8f+ykOtJiqqEjvCjWvo1ZSQCC5yIPb7qTcgTq+wX356KqiqludX6sdf2YSWy4dWLcXwkDUa9zgrl5Hga0= 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=u72UPhap; 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="u72UPhap" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241016123711epoutp04c2fb7bd1236c5b58046e079b8aa962a4~_7yDhANR71941219412epoutp04F for ; Wed, 16 Oct 2024 12:37:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241016123711epoutp04c2fb7bd1236c5b58046e079b8aa962a4~_7yDhANR71941219412epoutp04F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082231; bh=wzmB/TWoyocJzmZU34Ksi+Owp+0Flh6pJN0TsToBSPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u72UPhapnGgMZin9WRB+O9eyo0lUo5IUvyumME4bHyjazDHx/1zLI/hEgdkR4YzcJ Dk0kndTTrE5IHJf2pv5+i7luWSaU21YutNGC/C0QHaeOP3pBlpnJzYUWHtmdWk2pA6 ngJe6+ZPKvHdcmaRP9zIt1HpK1GPhStFxyKQfaXI= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241016123710epcas5p4c8c3f8e11d0940ef04e5bae573107331~_7yCasbmB1722117221epcas5p4i; Wed, 16 Oct 2024 12:37:10 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.174]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XT9TJ490Mz4x9Pv; Wed, 16 Oct 2024 12:37:08 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 91.47.08574.473BF076; Wed, 16 Oct 2024 21:37:08 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241016113750epcas5p2089e395ca764de023be64519da9b0982~_6_PBvkgZ3038630386epcas5p2I; Wed, 16 Oct 2024 11:37:50 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241016113750epsmtrp22c814f9026baaea6d5e51cb50909d6ca~_6_O-nlbU1554615546epsmtrp2x; Wed, 16 Oct 2024 11:37:50 +0000 (GMT) X-AuditID: b6c32a44-6dbff7000000217e-56-670fb3747bd0 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 31.CA.08229.E85AF076; Wed, 16 Oct 2024 20:37:50 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113748epsmtip183e9a7ec82ba541b29d1130741cc0b4d~_6_M1iVTA2875928759epsmtip1J; Wed, 16 Oct 2024 11:37:47 +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, krisman@suse.de 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, Anuj Gupta , Kanchan Joshi Subject: [PATCH v4 08/11] block: introduce BIP_CHECK_GUARD/REFTAG/APPTAG bip_flags Date: Wed, 16 Oct 2024 16:59:09 +0530 Message-Id: <20241016112912.63542-9-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.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bfuNJdKVfbfs+dr7akZW8t41Tdv4v7/Y8vC1bvmimvIT9ov/lc+2 3lww5yYzt4ilyYlL80+H79nU6OPKYMSy4HqmW5jRseuz9y+d6P01darv17SNic51V2eHcnYs 96jgfHtJ9G7APK2PCp1zZR+wacobrNzV63QpkPeSPbfL69uH6nvq2M4Km3MbTz913GKZ9vb2 JXf4+iLDrn+apHbEmenmjJYkprmsWpJXFCP+ujobTTHLqvm+i3HPcmWvD0osxRmJhlrMRcWJ AFXA9EwUAwAA X-CMS-MailID: 20241016113750epcas5p2089e395ca764de023be64519da9b0982 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113750epcas5p2089e395ca764de023be64519da9b0982 References: <20241016112912.63542-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. 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 --- 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 341a0382befd..d3c8b56d3fe6 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -436,6 +436,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 43d73d31c66f..211f44cc02a3 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1004,18 +1004,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 529ec7a8df20..a9dd0594dfc8 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 { @@ -41,7 +44,8 @@ struct uio_meta { }; #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 Oct 16 11:29:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838354 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 67AB1209678 for ; Wed, 16 Oct 2024 12:37:04 +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=1729082226; cv=none; b=NjiayFj411AuumDteXpdaVDJpXO7NN3pG4zSfC4ezMUpQsHgHcGtUzoXSf+ViVcT4BrWNm2gsIB7Uyrc7QKb7mPwbgL5pvJuwe2RdijtQC0XqEeMPpKWp59rN0Hqnsqnuf2MaTvMnCTrp7gywklj7jG7zGcAmlP+zCTzsRZLfbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082226; c=relaxed/simple; bh=rWG+L8TKua66elGsLM0q6AdqhuoGedubwJQEvqG+Myg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=OTzaR3ScQ6DZbs5ZToSbq2jW9sihkk0JvvC9DY0/X1gXT9AJlQFz0W3c6MuqhVknQC/5QOgeQoIMNtn9Xr6iyOLdHaTlJKW5tjdU5dy1Tcvd4rduUfHauBUVuWiT8XP+95Wr41h/wVOt9DNstAbI7uEEbOrlUBKu2asrcV2MYY4= 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=Soy1mG2v; 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="Soy1mG2v" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241016123702epoutp04ee571ead3ada3c4328fe606569393f68~_7x7WML4C2052320523epoutp04H for ; Wed, 16 Oct 2024 12:37:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241016123702epoutp04ee571ead3ada3c4328fe606569393f68~_7x7WML4C2052320523epoutp04H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082222; bh=l5NLGAVozNPeGXm3NN3/NT8GrqW9QoQFU3FPIXkqZQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Soy1mG2vU372NaHyxIzXL+s3WVLZGEGHTSqcQIuF9EbCzauH9iymSyUJyqm0AGtgr josQjeZVwzGKOp2YaO3t6PTHgI9Zoef6VpwHSY+ubxwEl3nNRmZlHZLDIvk9IK2V8y jWOthQOvCADGZD/BOOBsiMidQQwxMTOoX10KZJUw= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241016123702epcas5p299d4ccd67892ddb47ec8a965a601e475~_7x63VnXv1543915439epcas5p2Y; Wed, 16 Oct 2024 12:37:02 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.174]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XT9T833sZz4x9Pv; Wed, 16 Oct 2024 12:37:00 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 97.18.09420.C63BF076; Wed, 16 Oct 2024 21:37:00 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241016113752epcas5p4c365819fce1e5d498fd781ae2b309341~_6_RMXIKo1424214242epcas5p4n; Wed, 16 Oct 2024 11:37:52 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241016113752epsmtrp22c9d3afdc4237a16a85531587f299460~_6_RLg81s1555115551epsmtrp2i; Wed, 16 Oct 2024 11:37:52 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-04-670fb36cf13d Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 4F.68.08227.095AF076; Wed, 16 Oct 2024 20:37:52 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113750epsmtip15073a22c64ea221d14f0ec92e0320c7c~_6_PFnQMF2787227872epsmtip16; Wed, 16 Oct 2024 11:37:50 +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, krisman@suse.de 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, Kanchan Joshi , Anuj Gupta Subject: [PATCH v4 09/11] block: add support to pass user meta buffer Date: Wed, 16 Oct 2024 16:59:10 +0530 Message-Id: <20241016112912.63542-10-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-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+NgFjrJJsWRmVeSWpSXmKPExsWy7bCmlm7OZv50g7cnBCw+fv3NYtE04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fitX6g6 Y9NlrZKwHxazZxVVTtQNV0u5LWAw4XaCz0EFK84FVw9dXxy1RDeq1yUud16Pmt+j16V17Ktq 2abdmXFZmmtXkCq3Ogfv9QM5S352zVrIUsdybsGEwrWMtRPuxCXPnvxSiaU4I9FQi7moOBEA 9ROoixMDAAA= X-CMS-MailID: 20241016113752epcas5p4c365819fce1e5d498fd781ae2b309341 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113752epcas5p4c365819fce1e5d498fd781ae2b309341 References: <20241016112912.63542-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. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Christoph Hellwig --- block/bio-integrity.c | 51 +++++++++++++++++++++++++++++++++++ block/fops.c | 44 +++++++++++++++++++++++------- include/linux/bio-integrity.h | 7 +++++ 3 files changed, 93 insertions(+), 9 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index d3c8b56d3fe6..24fad9b6f3ec 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "blk.h" static struct kmem_cache *bip_slab; @@ -303,6 +304,55 @@ static unsigned int bvec_from_pages(struct bio_vec *bvec, struct page **pages, return nr_bvecs; } +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 & BLK_INTEGRITY_CHK_GUARD) + bip->bip_flags |= BIP_CHECK_GUARD; + if (meta->flags & BLK_INTEGRITY_CHK_APPTAG) + bip->bip_flags |= BIP_CHECK_APPTAG; + if (meta->flags & BLK_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; + + /* should fit into two bytes */ + BUILD_BUG_ON(BLK_INTEGRITY_VALID_FLAGS >= (1 << 16)); + + if (meta->flags && (meta->flags & ~BLK_INTEGRITY_VALID_FLAGS)) + 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; + + it.count = integrity_bytes; + ret = bio_integrity_map_user(bio, &it, meta->seed); + if (!ret) { + bio_uio_meta_to_bip(bio, meta); + iov_iter_advance(&meta->iter, integrity_bytes); + meta->seed += bio_integrity_intervals(bi, bio_sectors(bio)); + } + return ret; +} + int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter, u32 seed) { @@ -566,6 +616,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 e696ae53bf1e..59257b209bfb 100644 --- a/block/fops.c +++ b/block/fops.c @@ -57,6 +57,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 { @@ -131,6 +132,9 @@ static void blkdev_bio_end_io(struct bio *bio) if (bio->bi_status && !dio->bio.bi_status) dio->bio.bi_status = bio->bi_status; + if (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)) { struct kiocb *iocb = dio->iocb; @@ -224,14 +228,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) @@ -272,6 +278,14 @@ 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) @@ -289,6 +303,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) { @@ -333,10 +350,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; @@ -349,6 +364,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; @@ -363,6 +385,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 a9dd0594dfc8..ec792873f2d5 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -24,6 +24,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 */ @@ -90,6 +91,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, u32 seed); +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); @@ -121,6 +123,11 @@ static inline 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) { } From patchwork Wed Oct 16 11:29:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838356 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 47F0E207A09 for ; Wed, 16 Oct 2024 12:37:20 +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=1729082243; cv=none; b=nfD4Yd/EnJz3PyBPK26TYBiIH3zUsh3xIs9BUCSSNs/nwDQYuj8v4mvRH5hUph9gCeA6Nf3bIZE2WyrGdPNYzL3ZOrR8RI8G7zAF1KtXN48u49DnTdyBh+/9NUynxS1aX7HAyyLngRs/neof5bJDZxUnIbaMoOdZPAfF0XsNg1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082243; c=relaxed/simple; bh=55i5BYT08PR+ogRCKeefqI6P0kYHacdRz9t+UtJq0mI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=dTFhtxjrLLo4DB+A/eawTcgETjp2ZmGlA2OJPZe541Hk5DxL+FN3++dNU4KgiBjaHf9J613kzOn6CbYpGvNaWmcO8pXIk05zcNOBQvuIMWhkQIYRLXnwGxs9sBLyhzvRO36VRyuKqD6sueZRh6exMizXNEtJlzdvPnO1vqesZlc= 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=e2+/jeDu; 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="e2+/jeDu" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241016123718epoutp03c7a4584bd853c39bcfcb69351ee5ee05~_7yKOX19m1144611446epoutp03G for ; Wed, 16 Oct 2024 12:37:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241016123718epoutp03c7a4584bd853c39bcfcb69351ee5ee05~_7yKOX19m1144611446epoutp03G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082238; bh=rp2FS8zl3jE/nKjhp03u/2IrOy2rAmcpwepbQ5vVxF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e2+/jeDuW3uMxGPnYeS14wahU1Ema4xiRm4PR1fUQZGxVJJcWS2dVmVEXkq5AOU4a Kq3FEjM7TLbAVkHaeqhnTzszcc0ril6qPPEjA8Bhq+ZxwQ6GjlpGoYI24DEu6j010b Fd0q7v8LPqa7wjog1gZMA3/feEqn9iNRvqoS3l/o= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241016123718epcas5p1f952275928210c06b8799453c1168094~_7yJrnWtE2746927469epcas5p1N; Wed, 16 Oct 2024 12:37:18 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.174]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4XT9TS2jw0z4x9Pq; Wed, 16 Oct 2024 12:37:16 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 26.63.18935.C73BF076; Wed, 16 Oct 2024 21:37:16 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241016113755epcas5p2d563b183a9f4e19f5c02d73255282342~_6_TVmfn53038230382epcas5p2R; Wed, 16 Oct 2024 11:37:55 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241016113755epsmtrp15b225a1884e9c64c9f4e76452b15d6d7~_6_TUzQX60254402544epsmtrp1x; Wed, 16 Oct 2024 11:37:55 +0000 (GMT) X-AuditID: b6c32a50-cb1f8700000049f7-82-670fb37c9fa0 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 40.78.08227.295AF076; Wed, 16 Oct 2024 20:37:54 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113752epsmtip19c5aa77a3fa0dd1f65f9f54ac12acc52~_6_RRY3Th2875928759epsmtip1K; Wed, 16 Oct 2024 11:37:52 +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, krisman@suse.de 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, Kanchan Joshi , Anuj Gupta Subject: [PATCH v4 10/11] nvme: add support for passing on the application tag Date: Wed, 16 Oct 2024 16:59:11 +0530 Message-Id: <20241016112912.63542-11-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-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+NgFjrBJsWRmVeSWpSXmKPExsWy7bCmhm7NZv50gyedwhYfv/5msWia8JfZ Ys6qbYwWq+/2s1ncPLCTyWLl6qNMFu9az7FYHP3/ls1i0qFrjBbbzyxltth7S9ti/rKn7Bbd 13ewWSw//o/J4vysOewO/B47Z91l97h8ttRj06pONo/NS+o9dt9sYPP4+PQWi0ffllWMHptP V3t83iQXwBmVbZORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+TiE6Dr lpkDdL6SQlliTilQKCCxuFhJ386mKL+0JFUhI7+4xFYptSAlp8CkQK84Mbe4NC9dL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xgtVt/tZ7O4eWAnk8XK1UeZLN61nmOxOPr/LZvFpEPXGC22n1nKbLH3lrbF/GVP2S26 r+9gs1h+/B+TxflZc9gd+D12zrrL7nH5bKnHplWdbB6bl9R77L7ZwObx8ektFo++LasYPTaf rvb4vEkugDOKyyYlNSezLLVI3y6BK+PVitNMBTe5KvZd28DcwPiFo4uRk0NCwESiYfEOxi5G Lg4hgd2MErMub2KESEhInHq5DMoWllj57zk7RNFHRol5M96CJdgE1CWOPG8F6xYRmMUocXjW fCaQBLPAd0aJf93OILawgJ/E8TNbweIsAqoSt/7fYgexeQWsJH7t+8cMsUFeYual72BxTqD4 qXMHwWwhAUuJf5M/MELUC0qcnPmEBWK+vETz1tnMExiBtiKkZiFJLWBkWsUomVpQnJueW2xY YJSXWq5XnJhbXJqXrpecn7uJERxJWlo7GPes+qB3iJGJg/EQowQHs5II76Qu3nQh3pTEyqrU ovz4otKc1OJDjNIcLErivN9e96YICaQnlqRmp6YWpBbBZJk4OKUamJRKA82Kn6vOe91bcv1u TuuK93enRpVvYc9/vWyvdoyfRZ1l0Nn/p67Y6DzvCnPOXZKroXjp8FvBBVdvf5iUWGzR1pPH /GHvi+rX6Vr3ThT8YNdUyuljfu++T0+i6J7EsmWpzf+1l3IYKfHwz97HJZd/19ti/ZdV90yy y687RK4qTVS4LpLnwfHQbOlarxVTTrtcTpdpqbHpL5v4yP47kyhDeaFtuI/8zUtxbsaPp52K naD8t8qhTJqDJ+sD39TTi2ZM9oq+p33jvglDa6clr4O16JcPFfH8SW7Pc51/ZtmaPOFKenl0 5RPWv0fX7uF8bOkoeja1J3mml8h318LwqBm6p7+H7fr+MHz2zCVLlViKMxINtZiLihMBKwjv MhMDAAA= X-CMS-MailID: 20241016113755epcas5p2d563b183a9f4e19f5c02d73255282342 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113755epcas5p2d563b183a9f4e19f5c02d73255282342 References: <20241016112912.63542-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. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Christoph Hellwig --- 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 211f44cc02a3..c7ba264504b5 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 Wed Oct 16 11:29:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13838417 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 8FCD620823D for ; Wed, 16 Oct 2024 12:37:27 +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=1729082249; cv=none; b=JoqL7F9g3rSvFGVQ+1U5cT+fsxRpYZnL7wLcNHFeEeRLtLKLygHidRhSOTs4o1XRDkyiKB0LCHJ6RScCPY3onT7SXHfLSmrPo+yt+dzSY23r0UDMz/nZzxWFEmLc7OOzXy3E3+pUExska/rV0yUd/Go1g338FPfnrpujQEh2iYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729082249; c=relaxed/simple; bh=d/VW0lpwYUltDPxzsuM2m8RXMRUI3+BODfWq13zoDNc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=s4b0Zo+qNeV61JdGCKc1Ia/uqYm3uWeHZrvb41NTMkN9193WVjEAOhUfQy1vNAEde52F8E+49idWhOFHPqAAFxFPjEVzhugQKGZbMe4rxxdxRSj7G5Hb+12f4Z79DrQ2Fjs0n6hdOdN/DZZT7LfEB+Zlzpz0XfdyIFnqmdP3NpM= 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=VkfxGp6I; 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="VkfxGp6I" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241016123725epoutp016e878f8848a8b4dd1950affb64a062a8~_7yQvjVGU1583515835epoutp01_ for ; Wed, 16 Oct 2024 12:37:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241016123725epoutp016e878f8848a8b4dd1950affb64a062a8~_7yQvjVGU1583515835epoutp01_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1729082245; bh=onb9D8irMkDonXAnGDbuDg2oS2aLz5VgLMelslR2Osw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkfxGp6IawnhO+k2f7bkkXLKJp4o4OvAh+jDeixqrhbUXHN6cg4lsglOt1TgEshoJ W66F8oZd+FuvCnv+wg33IOraUhoUJZLAXT3LVMREibL6jT0Ns8MbMNUrlPICp0v+P2 bJZHPmYk0127BKVneqBBFq4n8t4fg52jilUzTGKs= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241016123725epcas5p44cc6c5183af4ca01042d96fb04e1510e~_7yQNsAlQ1720917209epcas5p4w; Wed, 16 Oct 2024 12:37:25 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.179]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XT9Tb2HDGz4x9Pv; Wed, 16 Oct 2024 12:37:23 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 1F.11.09770.383BF076; Wed, 16 Oct 2024 21:37:23 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241016113757epcas5p42b95123c857e5d92d9cdec55e190ce4e~_6_VVIcxJ1424214242epcas5p4s; Wed, 16 Oct 2024 11:37:57 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241016113757epsmtrp2cd5cd20f134d35a1e94a840bfb6c3a5a~_6_VUV7ny1554615546epsmtrp21; Wed, 16 Oct 2024 11:37:57 +0000 (GMT) X-AuditID: b6c32a4a-e25fa7000000262a-59-670fb383d50c Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 83.AA.07371.595AF076; Wed, 16 Oct 2024 20:37:57 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241016113755epsmtip1a6461705654a11b705fdf0593467dbab~_6_TaGi1e3098130981epsmtip1G; Wed, 16 Oct 2024 11:37:54 +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, krisman@suse.de 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, Anuj Gupta Subject: [PATCH v4 11/11] scsi: add support for user-meta interface Date: Wed, 16 Oct 2024 16:59:12 +0530 Message-Id: <20241016112912.63542-12-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241016112912.63542-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+NgFjrIJsWRmVeSWpSXmKPExsWy7bCmlm7zZv50g3e/eS0+fv3NYtE04S+z xZxV2xgtVt/tZ7O4eWAnk8XK1UeZLN61nmOxmHToGqPF9jNLmS323tK2mL/sKbtF9/UdbBbL j/9jsjg/aw67A5/Hzll32T0uny312LSqk81j85J6j903G9g8Pj69xeLRt2UVo8fm09UenzfJ BXBGZdtkpCampBYppOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAF2u pFCWmFMKFApILC5W0rezKcovLUlVyMgvLrFVSi1IySkwKdArTswtLs1L18tLLbEyNDAwMgUq TMjOOHBxEUtBl1DF4T2PWRsYf/F1MXJySAiYSOxdfpGli5GLQ0hgN6NE0/s7UM4nRonOs9+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HF+1hx2Bz6PnbPusntcPlvqsWlVJ5vH5iX1HrtvNrB5fHx6i8Wjb8sqRo/Np6s9Pm+S C+CM4rJJSc3JLEst0rdL4Mo4cHERS0GXUMXhPY9ZGxh/8XUxcnJICJhInLq/hK2LkYtDSGA3 o8SG9Z8ZIRISEqdeLoOyhSVW/nvODlH0kVHi558uZpAEm4C6xJHnrYwgCRGBWYwSh2fNZwJx mAUuMEpc3feMHaRKWMBZ4v2SnUA7ODhYBFQl/p3WBQnzClhJLJx2iwVig7zEzEvfwco5geKn zh0Es4UELCX+Tf7ACFEvKHFy5hOwemag+uats5knMAJtRUjNQpJawMi0ilEytaA4Nz032bDA MC+1XK84Mbe4NC9dLzk/dxMjOH60NHYw3pv/T+8QIxMH4yFGCQ5mJRHeSV286UK8KYmVValF +fFFpTmpxYcYpTlYlMR5DWfMThESSE8sSc1OTS1ILYLJMnFwSjUwHZWdY/+wcbdfdGgy6zIr W7n3VSZRW/t3/etTN4nmW5UbrHBTe8L5C1q80wW63NpebH4Zfsruaba9ec7FHR2dYrOzBMKd pEt/FdW6L/vBLqp67svEBQ4+BxNlr09k4jv++8zNV7EL05iKr239d9/20Idk3oIJiQsWrn4k vdRC+GbWsmLbZNu1O/x8lFdlsai87Lj78ojzC4+uH9Nzz7086zMnLM0+Zapq7u/So3Gvd4gF 633RWSq8T33H79SJEqsk+3uUHt07YnT0SdVtlRdXo0R55tV/ufP8yVzRBW8/ZFxN7WU6cKHh /grRFf5pS5+cnbJ73imfXy2TOrYf1V4VeXBXi+CCdzqK97+fvfmGj1uJpTgj0VCLuag4EQB2 gniODgMAAA== X-CMS-MailID: 20241016113757epcas5p42b95123c857e5d92d9cdec55e190ce4e X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241016113757epcas5p42b95123c857e5d92d9cdec55e190ce4e References: <20241016112912.63542-1-anuj20.g@samsung.com> Add support for sending user-meta buffer. Set tags to be checked using flags specified by user/block-layer user and underlying DIF/DIX configuration. Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ca4bc0ac76ad..87ae19c9b29c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -802,6 +802,23 @@ static unsigned int sd_prot_flag_mask(unsigned int prot_op) return flag_mask[prot_op]; } +/* + * Can't check reftag alone or apptag alone + */ +static bool sd_prot_flags_valid(struct scsi_cmnd *scmd) +{ + struct request *rq = scsi_cmd_to_rq(scmd); + struct bio *bio = rq->bio; + + if (bio_integrity_flagged(bio, BIP_CHECK_REFTAG) && + !bio_integrity_flagged(bio, BIP_CHECK_APPTAG)) + return false; + if (!bio_integrity_flagged(bio, BIP_CHECK_REFTAG) && + bio_integrity_flagged(bio, BIP_CHECK_APPTAG)) + return false; + return true; +} + static unsigned char sd_setup_protect_cmnd(struct scsi_cmnd *scmd, unsigned int dix, unsigned int dif) { @@ -814,14 +831,16 @@ 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_CTRL_NOCHECK) == false && + (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_CTRL_NOCHECK) == false) && + (!dix || bio_integrity_flagged(bio, BIP_CHECK_REFTAG))) scmd->prot_flags |= SCSI_PROT_REF_CHECK; } @@ -1373,6 +1392,8 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd) dif = scsi_host_dif_capable(cmd->device->host, sdkp->protection_type); dld = sd_cdl_dld(sdkp, cmd); + if (!sd_prot_flags_valid(cmd)) + goto fail; if (dif || dix) protect = sd_setup_protect_cmnd(cmd, dix, dif); else