From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC1A1C021BC for ; Wed, 26 Feb 2025 18:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rhZprq/fhlitTeHklVfwoWYolzCx7OIds6d1dWBk5OU=; b=WxrzOluKqdLe9PvEqoMNopVFb5 1A/DyPtQ2ix3olijG+BprAxWvZ+I5fcymaYvSEbnFDK3YExm27mTVdfz6AeN74W2kuv7E9qUf8dqB 8IqqPCi6On4e0XfQRUv2XIMzadDJi2T6K5dr/pPesf4vEVF1GK7RSYq48OC6e9KBPbXI5/5s4dkmf KMGTsmlouVQHmaT6NVWVRI4GGET1Tvp00MOZQc969yKKs22FhYC94nvSHF/qqsVmfd4lzCHnMUaQY 2D8l9uiyT29JQymPlvkTv7AbMEcAbvoykdaKduLk7bLmV/Sb941LTaQOe1IiwzXwvbV1Wdl54mZ6l mwGIaaog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tnM2F-00000004v20-16B3; Wed, 26 Feb 2025 18:21:31 +0000 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tnM2B-00000004uy1-3W9x for linux-nvme@lists.infradead.org; Wed, 26 Feb 2025 18:21:29 +0000 Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51QF0nIO019916 for ; Wed, 26 Feb 2025 10:21:27 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=s2048-2021-q4; bh=rhZprq/fhlitTeHklVfwoWYolzCx7OIds6d1dWBk5OU=; b=XTjFnQAXg4xI WeqXWBWb30Xt6tDWW7TF6EtQZvilQ9Fc/UR4/c8GHNZew8b9Flx2ucQaqxUKxGSU FY1cAkyXpa9D8w/K6FhqapM7P6K4PCfZ3nPTz8tPJP5Lb2KtJaOuwtYot5yKyh0K zgKJ7I7wTjInTcMWyJQJwIjIapapMwYTMFtqbiUmKXxPs1ZSf7a511vRD8YvvgVw /GnefufHBWx75pExZmpA2gRV+WWOZD9xUepFcnFlj9lWSwa2yrwqT6a7voz2aB8L dK9kpOH5jTnMpxHLzbk822Itt5wdomtaj9wU3uRlbyN/xfIsXLypIFSYlqSpyy1e EvroPGKXxQ== Received: from mail.thefacebook.com ([163.114.134.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 45257j1hut-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 26 Feb 2025 10:21:26 -0800 (PST) Received: from twshared32179.32.frc3.facebook.com (2620:10d:c085:208::7cb7) by mail.thefacebook.com (2620:10d:c08b:78::c78f) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.14; Wed, 26 Feb 2025 18:21:07 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id BEB64187C82C8; Wed, 26 Feb 2025 10:21:04 -0800 (PST) From: Keith Busch To: , , , , CC: , , , Xinyu Zhang , Keith Busch Subject: [PATCHv7 3/6] nvme: map uring_cmd data even if address is 0 Date: Wed, 26 Feb 2025 10:20:58 -0800 Message-ID: <20250226182102.2631321-4-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250226182102.2631321-1-kbusch@meta.com> References: <20250226182102.2631321-1-kbusch@meta.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-ORIG-GUID: QLqjTAVOWdpM3oxTGMEVM5L6wqo0sHLt X-Proofpoint-GUID: QLqjTAVOWdpM3oxTGMEVM5L6wqo0sHLt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-26_04,2025-02-26_01,2024-11-22_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250226_102127_992728_4700C7CD X-CRM114-Status: GOOD ( 14.23 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org From: Xinyu Zhang When using kernel registered bvec fixed buffers, the "address" is actually the offset into the bvec rather than userspace address. Therefore it can be 0. We can skip checking whether the address is NULL before mapping uring_cmd data. Bad userspace address will be handled properly later when the user buffer is imported. With this patch, we will be able to use the kernel registered bvec fixed buffers in io_uring NVMe passthru with ublk zero-copy support. Reviewed-by: Caleb Sander Mateos Reviewed-by: Jens Axboe Reviewed-by: Ming Lei Signed-off-by: Xinyu Zhang Signed-off-by: Keith Busch --- drivers/nvme/host/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 5078d9aaf88fc..ecf136489044f 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -516,7 +516,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, = struct nvme_ns *ns, return PTR_ERR(req); req->timeout =3D d.timeout_ms ? msecs_to_jiffies(d.timeout_ms) : 0; =20 - if (d.addr && d.data_len) { + if (d.data_len) { ret =3D nvme_map_user_request(req, d.addr, d.data_len, nvme_to_user_ptr(d.metadata), d.metadata_len, ioucmd, vec, issue_flags); --=20 2.43.5