From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f100.google.com (mail-ej1-f100.google.com [209.85.218.100]) (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 34D8F288C13 for ; Mon, 5 Jan 2026 21:05:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767647153; cv=none; b=nDsN94oaBfCmanoS4zgrAckyS3Jxbb69S1CLEsG+NtgqJu2XGfYQGqOiMGzzP0YQFdJAhw4UwlGcsSibIyjQuhgnpQpKn6fiJ2UMtjLRPQCDYofXfc0xQazxAh++DbNJOOi7Np4x/uszhq1YxLXciWy7ktzVL2EgFTasFnKEFXs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767647153; c=relaxed/simple; bh=PKe3zut0rc2C2whJ8cqtZoWJ6n2ersPUtJEMB8597Lw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TkzMl0HxRSw2ENhcShbVcNshnAHLliqAP8iOIIx4KPq80WswnzUfeaRng8Yih1X+AyOhrchoWrlDshTssDt4TLBL20Eo05mQXDDfK7FPfg6L45TFeB/A4DDDXgdwRNw3CyCLPHDX2hfbTIuIpuogqBnpUo+69kc78N6Q3xb1oXs= 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=buBzbC6o; arc=none smtp.client-ip=209.85.218.100 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="buBzbC6o" Received: by mail-ej1-f100.google.com with SMTP id a640c23a62f3a-b734a4b788cso5513766b.3 for ; Mon, 05 Jan 2026 13:05:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1767647149; x=1768251949; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ThFq9ylN2vLuaOoZ/EmEU7GtHAyA7EZX6diS045hnHc=; b=buBzbC6oMPAIS4xMy0m92wzj/rH/OUTuBTef6Jc57lX+Aeqn2WkFXz3bVDA4JftE9e V4Jh+keQjk6QvRQRQwSXpVd1c8QmK99A9fZfzBT/xHL9ZjcpC/HBHhiPcMJyzGK3fZBV VxeYvOYcrexkZnguCGWyYpoPs0C8PD/By40xB+TpS/JOijGrwrYfKVSHIN0IASkGoon8 pViBmbBELKcs3UKPDAnp+SHUvi7yQaO2YDm19RzgChjK/9dplkWD61IDft9zI7Qx0zqq B6fFyqW/WMXeIXHdUJbnoo/TimFZvh/61EJBjQU03VUED623JtXfQgWmo6qTI7Yso/nA TXYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767647149; x=1768251949; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ThFq9ylN2vLuaOoZ/EmEU7GtHAyA7EZX6diS045hnHc=; b=PtXkA2YCjtrDKY3AAER+eLi68hIe9JKLB9QwxhaC5EZNhSi2EAFEomdG0iWTtXPyC/ Fi9fKwXNF4K6SAwiBR9+g1VK32+Gp7yYFex668J0iuiRvLKvC3yMPXCUBDagZ1xZe1hC 39gX93vFhG/GviO5jM/lFukiaCmWQNr3PZBd4YPuZy4nTvAJwDeO+yvh8nl3Q+w3pWo0 0wdC5Too74LrMG5BGDm6uTSrLFFc9HaleiaPa9neOy++za/lNn+iO77Oc6SUY7IS3GAt 98QNVgxFBlUesfxZCuKqcCq1OyB6V6bRyVt+zuPRYwPhyTGdXcJ4RLqJJeoWnn2jol7v 3fQA== X-Forwarded-Encrypted: i=1; AJvYcCWC/PwYkdBA/SNR6u2Ve3ZpNzPwEsGt38u0puP4QwZcRffpIsmfu9sMlYRUVP2DN8zuvphWgUQaDDtzBxc=@vger.kernel.org X-Gm-Message-State: AOJu0Ywr+rD/9zuDYGvXRf0O9UaKpFTn9DC0ZJJx5/ilOdx2ehzU3mwn h473LEXl9RLE2wWiBDUFNT5hkIjE05qof3Y42jd2sip7HlunSJs/G0Hhy2Q0ebAVp/ibGBxg43+ kFd4p8yXqU8usQ560HJstj752OpdodmCvd2ElrkgeEsEJxTVTuyjX X-Gm-Gg: AY/fxX4Ee9AGAAPXko4HF/dEU/2EQcK0zRtSWXhnCjsSjnbgz6u3jqel2H54UdTBb9N E4m8bbXS6v85MO13aWlvxapai6q1AEq62Xg3H6QMK/Tzh7Uhx0ed5ioguwSDh7E7yAaQ5tT6uLb lUubGWdSPQD50oKgnr3xaV9t9Kob6Qfm2MC/nYsKc4ghfyStjxQWaxPcrg1DA4oBc05EEUOQntL cgQrBBjTY8axolQWE8PpPVIuceM1EFroKptvPJVTct7Rd3zx0eMkwPJBb+BzAMK4Nn0XdWy3EOq GY4aVviag/3pae7boNN2c5dLZ+zDNIjao2mE9sLyTj8b4U97bo4gHyVbIIVOVH6XWfHgEN2q1vP 4jQ3nC3fEyhK0WCddiMBq4bdqZCE= X-Google-Smtp-Source: AGHT+IFfGhpbIFSepFLprA1aLr+eH5GA8QJxe4JwPbqRXkHq2J0qeTXAvG+MDsJ5Im3r4i8AbtZPkZzYkOck X-Received: by 2002:a17:907:3e0f:b0:b80:b7f:aa1a with SMTP id a640c23a62f3a-b8427099dc2mr53580666b.8.1767647149351; Mon, 05 Jan 2026 13:05:49 -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 a640c23a62f3a-b842a275ff2sm1257266b.22.2026.01.05.13.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 13:05:49 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.49.34.222]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 089B534059A; Mon, 5 Jan 2026 14:05:48 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id E97F1E41BCB; Mon, 5 Jan 2026 14:05:47 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe Cc: Joanne Koong , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH v7 0/3] io_uring: use release-acquire ordering for IORING_SETUP_R_DISABLED Date: Mon, 5 Jan 2026 14:05:39 -0700 Message-ID: <20260105210543.3471082-1-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit io_uring_enter(), __io_msg_ring_data(), and io_msg_send_fd() read ctx->flags and ctx->submitter_task without holding the ctx's uring_lock. This means they may race with the assignment to ctx->submitter_task and the clearing of IORING_SETUP_R_DISABLED from ctx->flags in io_register_enable_rings(). Ensure the correct ordering of the ctx->flags and ctx->submitter_task memory accesses by storing to ctx->flags using release ordering and loading it using acquire ordering. Using release-acquire ordering for IORING_SETUP_R_DISABLED ensures the assignment to ctx->submitter_task in io_register_enable_rings() can't race with msg_ring's accesses, so drop the unneeded {READ,WRITE}_ONCE() and the NULL checks. v7: - Split from IORING_SETUP_SINGLE_ISSUER optimization series - Drop unnecessary submitter_task {READ,WRITE}_ONCE() and NULL checks - Drop redundant submitter_task check in io_register_enable_rings() - Add comments explaining need for release-acquire ordering Caleb Sander Mateos (3): io_uring: use release-acquire ordering for IORING_SETUP_R_DISABLED io_uring/msg_ring: drop unnecessary submitter_task checks io_uring/register: drop io_register_enable_rings() submitter_task check io_uring/io_uring.c | 13 ++++++------- io_uring/msg_ring.c | 28 ++++++++++++++-------------- io_uring/register.c | 7 ++++--- 3 files changed, 24 insertions(+), 24 deletions(-) -- 2.45.2