From nobody Thu Apr 2 22:00:02 2026 Received: from mail-pg1-f228.google.com (mail-pg1-f228.google.com [209.85.215.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6A6B428846 for ; Mon, 2 Mar 2026 17:29:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.228 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772472565; cv=none; b=emKqL/bRIaiL89GZUeQVcW1M9JvgMwZO4fP/XddUTX1L4VbKwwuT4MHaCcNjiYRdbF1nGVgYceJ1JFOMBIV17IFuSEuLckR3NJtR9EsA+9eHjHg8JjgBR6rYH5E+YRHkwc4eikOnd9blgS+Twu45zMcNfIfM0ocr4cotVMRD9SU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772472565; c=relaxed/simple; bh=NBvNotESp7kUasR2rqxc9z9U7+RvFpA7PAQQGkHDOZA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R1QVVrtQ4hpCkTUXD7pxdJ2/JDi1H2De6ibTDQfBv5ACGB7E9EEamUXHZCrCwbw/7xbDtI1OUcBjSAywDPKqidU2uYFfnS8gdBlpXeuA3gcUhmM07FJayymNBuk0RLqZyvhrw4eIFUKbG3Rzl5CHHnQzvyPWRqX/dMKB0k9B4WM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=dPY+CUXn; arc=none smtp.client-ip=209.85.215.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="dPY+CUXn" Received: by mail-pg1-f228.google.com with SMTP id 41be03b00d2f7-c70c1da52c4so332173a12.2 for ; Mon, 02 Mar 2026 09:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1772472563; x=1773077363; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YA4oP39D1EwOno4AkPegcttVQHiaILWd3dC9XNEopg8=; b=dPY+CUXnAnAP93i0m2sogrKJdOcv3PfhHRonzPORJvAXbcJSuuK28VFLW3HA0+Va0v J9cs/lNv9vtrZfHbQNNAvmpcgYHE5+S5IJZiQFOGSsPwejH4TI6Gs8OUdQpF6swm5J2N FQK5ASiNUXjew4TwMHoeHEHHUSJXsb9pOckSo+0nPzA6d0ukoOhS8Z5jnlwqkp/vqKbB maBr7q85RYZXyBnUkMn7/j97WvzntNcNBvAFr51rhFGZLCyJT9MQOhVX8wiLuAYUdDkF CTfm/PJO9/TGX2s29+JjwYef1CYcWWfps5vsVe0owNBj2/7973i0BubNNWl/VdHr5FQn 0Byw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772472563; x=1773077363; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YA4oP39D1EwOno4AkPegcttVQHiaILWd3dC9XNEopg8=; b=awKhfyyV6TE3vCBUaMOdQk93sW8d1ps8RuPYVMK1sJiBKLnAU9dopPEkEqf7W4Hwk8 +iAEXYmMIr1kZbpMuXNHsAQSjNw6PmwJFBLfjubWEwAj79VZNwBVF+7D4/iSAD6tySYz 2GukKxhdIl7GARYR5wjkBXXX/WJxmBcFY9Pn+TnNxWA8BxNegPZ5ID+TfeqEoeK+/cY1 Ds28VgrZ04LQirPUQvhmDjJpa8eUHYEoedATvA17IuSklq22l58tGTlI5Z2QR3nQZD/x XJvu8dp4JnUN7UGhsJja60Va9PxGAYSeFVwEmQFFsILmXrTNmcFzVg4NW/ESrvKw/shb U2uQ== X-Forwarded-Encrypted: i=1; AJvYcCUaRFbRjtjXefTbn855KbPMxyIBjVVmuISeorvEwYiKLHTVLZMp/2w9f8DlwljoUqCHdoAGLEZ8MtwtsR8=@vger.kernel.org X-Gm-Message-State: AOJu0YzN+PCckaKjb1taDxNBNou+WpwXPm1ifZanHdqx+zdVEyXdU72y q5f1cwXw6CXbpTCx75VBEDb0E8NSrUhc/v8/QLRl+P5juznkI3YKZKuPhWwiRP8dIBomYqBv99U OH9Z32tkAHddpczYB6mERlUS0Jb+LXdG8TLkGYeOfEvN5xZoEb+5d X-Gm-Gg: ATEYQzxRiKSkg56Zjyljd0rCVk2CutZ6QhJfn7Anq/I+2r5YfwH+jWYdkZKTav5CRC0 /nj3f9QUV8NDT2LU03LAyUdKV0H+4401WJE2+ISp0iwPdhT3o++TnzOlYLPGymuCk+tFfX+DC+r nVrrHIPg5228Db5W8mZiGXRUxrlLpZ98fb1X5lvR6RZUdVolnSPmnyye56Qyi0tgOr8h+vyBFmA i1qDOv54Rgu6mxUnLj8FPQS1f2J9sbJK8VpvLpxH+y+AFCnb4ndNeLmoLHZcU29/r/LiulRDpr4 KePNJRVdbZ+aTgydQyDiy0UvECszpXFuF3SJcvi0JScMeVcVKrPiRmBKx90W3jDH5K1Acvy6iQg 6itBYvw2PFcWJGhnUXAQJEbte3Kf+BaAhlTQhlJ4= X-Received: by 2002:a17:90b:3949:b0:359:95ec:5a2f with SMTP id 98e67ed59e1d1-35995ec5c72mr1230896a91.6.1772472563254; Mon, 02 Mar 2026 09:29:23 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id 98e67ed59e1d1-359939787dasm287026a91.1.2026.03.02.09.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2026 09:29:23 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.112.29.101]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 2FE0A340199; Mon, 2 Mar 2026 10:29:22 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 2C3B1E41FBD; Mon, 2 Mar 2026 10:29:22 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe , Christoph Hellwig , Keith Busch , Sagi Grimberg Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Anuj Gupta , Kanchan Joshi , Ming Lei , Caleb Sander Mateos Subject: [PATCH v5 4/5] io_uring/uring_cmd: allow non-iopoll cmds with IORING_SETUP_IOPOLL Date: Mon, 2 Mar 2026 10:29:13 -0700 Message-ID: <20260302172914.2488599-5-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260302172914.2488599-1-csander@purestorage.com> References: <20260302172914.2488599-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, creating an io_uring with IORING_SETUP_IOPOLL requires all requests issued to it to support iopoll. This prevents, for example, using ublk zero-copy together with IORING_SETUP_IOPOLL, as ublk zero-copy buffer registrations are performed using a uring_cmd. There's no technical reason why these non-iopoll uring_cmds can't be supported. They will either complete synchronously or via an external mechanism that calls io_uring_cmd_done(), io_uring_cmd_post_mshot_cqe32(), or io_uring_mshot_cmd_post_cqe(), so they don't need to be polled. Allow uring_cmd requests to be issued to IORING_SETUP_IOPOLL io_urings even if their files don't implement ->uring_cmd_iopoll(). For these uring_cmd requests, skip initializing struct io_kiocb's iopoll fields, don't set REQ_F_IOPOLL, and don't set IO_URING_F_IOPOLL in issue_flags. Signed-off-by: Caleb Sander Mateos Reviewed-by: Kanchan Joshi Reviewed-by: Anuj Gupta --- io_uring/uring_cmd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index b651c63f6e20..7b25dcd9d05f 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -255,13 +255,11 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int i= ssue_flags) issue_flags |=3D IO_URING_F_SQE128; if (ctx->flags & (IORING_SETUP_CQE32 | IORING_SETUP_CQE_MIXED)) issue_flags |=3D IO_URING_F_CQE32; if (io_is_compat(ctx)) issue_flags |=3D IO_URING_F_COMPAT; - if (ctx->flags & IORING_SETUP_IOPOLL) { - if (!file->f_op->uring_cmd_iopoll) - return -EOPNOTSUPP; + if (ctx->flags & IORING_SETUP_IOPOLL && file->f_op->uring_cmd_iopoll) { req->flags |=3D REQ_F_IOPOLL; issue_flags |=3D IO_URING_F_IOPOLL; req->iopoll_completed =3D 0; if (ctx->flags & IORING_SETUP_HYBRID_IOPOLL) { /* make sure every req only blocks once */ --=20 2.45.2