From patchwork Mon Feb 3 15:45:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13957745 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) (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 9FF40204689 for ; Mon, 3 Feb 2025 15:45:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.153.30 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738597541; cv=none; b=hSkziU37OG91ileJaLhBAu+xSIZ2Dn7You1p7z5x6pIYbs+S7KvMKEt4Vc5kxWo9GKHB4ZarGFQtI4vfXTjOJYhu67/NRjmPBOf6QZfI/GvgnXiFw6a6gouDxCRnYfrmle++ZBxmR4ClwIHeLu3aJQu+djJlT2RttLN0baUDll0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738597541; c=relaxed/simple; bh=ZwK2pTZPzRlNSlj9Qz7gSjaKpkPAhiWv9hTfPleYMTY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TPFibfoETFmHzHU7uT09h+ZDW8jbrCAK2dRz1WhE9QxQO9fk9E8VB+Vhxw8u7iwOWq1ZuElwwSl+lyDcnQvE3bLkoAfF54pIwpAOv48lrcEDFaKzYCEucAeY9PFJ6L9b5whisWelmpj1rpuKAPcytXOohlTdVidkaSur6qRi7q4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=cfGD/XrJ; arc=none smtp.client-ip=67.231.153.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="cfGD/XrJ" Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 513FjCw4004352 for ; Mon, 3 Feb 2025 07:45:38 -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=tqd4ldYb1MFOCFON2/4vIH7lbh7LQK7BJO0RRotffbE=; b=cfGD/XrJfXpL AHT3SebFNrZn+IypkAMv+VUvrbO3yR1gKbkuw55eG6iU3ARvG147sUc+Uv/1BBjP ubi/o4W9gWKbdgtva4t8KFZRrHtfNf7DZaSUly3lMowVX1c8WjxRZ2hcHOMos1LP QHSQZXDd3KqzLH4q6dEZwETq1QvG+zwUycJVvzmPCIZsWKpIAoCCH21FGG3fqAOK 4Zs7NJrGwMjEgfJAvfl5wALQ+M8DQL5bh9BwD4tVsJqwaDdhG6Vevk/fbUZpNK4h lloJNXSHIa6dI3erxJPEtbTNMwQLo6W77xxiXBakYQ7R0p7nSnMxJ25hQKXxmuWS vi1G/SjkAg== Received: from mail.thefacebook.com ([163.114.134.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 44k0q6r041-17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 03 Feb 2025 07:45:38 -0800 (PST) Received: from twshared24170.03.ash8.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; Mon, 3 Feb 2025 15:45:30 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id B8EA7179A9849; Mon, 3 Feb 2025 07:45:21 -0800 (PST) From: Keith Busch To: , , , , CC: Keith Busch Subject: [PATCH 2/6] io_uring: use node for import Date: Mon, 3 Feb 2025 07:45:13 -0800 Message-ID: <20250203154517.937623-3-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250203154517.937623-1-kbusch@meta.com> References: <20250203154517.937623-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: tA7XRdmbr_CUqc6BqN_bj4g3GdFvS8KT X-Proofpoint-GUID: tA7XRdmbr_CUqc6BqN_bj4g3GdFvS8KT 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-03_06,2025-01-31_02,2024-11-22_01 From: Jens Axboe Replace the mapped buffer to the parent node. This is preparing for a future for different types with specific handling considerations. Signed-off-by: Jens Axboe Signed-off-by: Keith Busch --- io_uring/net.c | 3 +-- io_uring/rsrc.c | 6 +++--- io_uring/rsrc.h | 5 ++--- io_uring/rw.c | 2 +- io_uring/uring_cmd.c | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/io_uring/net.c b/io_uring/net.c index 85f55fbc25c94..4e9d0f04b902d 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -1359,8 +1359,7 @@ static int io_send_zc_import(struct io_kiocb *req, unsigned int issue_flags) return ret; ret = io_import_fixed(ITER_SOURCE, &kmsg->msg.msg_iter, - node->buf, (u64)(uintptr_t)sr->buf, - sr->len); + node, (u64)(uintptr_t)sr->buf, sr->len); if (unlikely(ret)) return ret; kmsg->msg.sg_from_iter = io_sg_from_iter; diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index af39b69eb4fde..4d0e1c06c8bc6 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -860,10 +860,10 @@ int io_sqe_buffers_register(struct io_ring_ctx *ctx, void __user *arg, return ret; } -int io_import_fixed(int ddir, struct iov_iter *iter, - struct io_mapped_ubuf *imu, - u64 buf_addr, size_t len) +int io_import_fixed(int ddir, struct iov_iter *iter, struct io_rsrc_node *node, + u64 buf_addr, size_t len) { + struct io_mapped_ubuf *imu = node->buf; u64 buf_end; size_t offset; diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h index 190f7ee45de93..abd0d5d42c3e1 100644 --- a/io_uring/rsrc.h +++ b/io_uring/rsrc.h @@ -50,9 +50,8 @@ void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node); void io_rsrc_data_free(struct io_ring_ctx *ctx, struct io_rsrc_data *data); int io_rsrc_data_alloc(struct io_rsrc_data *data, unsigned nr); -int io_import_fixed(int ddir, struct iov_iter *iter, - struct io_mapped_ubuf *imu, - u64 buf_addr, size_t len); +int io_import_fixed(int ddir, struct iov_iter *iter, struct io_rsrc_node *node, + u64 buf_addr, size_t len); int io_register_clone_buffers(struct io_ring_ctx *ctx, void __user *arg); int io_sqe_buffers_unregister(struct io_ring_ctx *ctx); diff --git a/io_uring/rw.c b/io_uring/rw.c index a9a2733be8420..d6332d019dd56 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -393,7 +393,7 @@ static int io_prep_rw_fixed(struct io_kiocb *req, const struct io_uring_sqe *sqe io_req_assign_buf_node(req, node); io = req->async_data; - ret = io_import_fixed(ddir, &io->iter, node->buf, rw->addr, rw->len); + ret = io_import_fixed(ddir, &io->iter, node, rw->addr, rw->len); iov_iter_save_state(&io->iter, &io->iter_state); return ret; } diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index fc94c465a9850..b7b9baf30d728 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -281,7 +281,7 @@ int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, /* Must have had rsrc_node assigned at prep time */ if (node) - return io_import_fixed(rw, iter, node->buf, ubuf, len); + return io_import_fixed(rw, iter, node, ubuf, len); return -EFAULT; }