From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-il1-f178.google.com (mail-il1-f178.google.com [209.85.166.178]) (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 265181FA16A for ; Mon, 13 Jan 2025 22:30:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736807413; cv=none; b=kPfqpIfN8jCVbzI+JbpRtByIKQ7r5g7vyN1DBi0OdKru8MNrWsG70ekRLgYQrtbunOjqqLJS74YeQomSc24AOpDfivnQsULGt+5XYgao0hhJYBKdUU0CJmw0wnikXZ18yTZF8r8r362rOFFHwHm0TBfr/Q0n85F7M7s3CIV8uYQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736807413; c=relaxed/simple; bh=hUgEwdoHcBT26rlpizn+ruY8wmBwdO0kVUnA0F84F0w=; h=From:To:Cc:In-Reply-To:References:Subject:Message-Id:Date: MIME-Version:Content-Type; b=dSm8fYqHc785IIRFqPlFSODfmttR34FIIEq3+Nb1Z/gjhmJX5BoPNk35Bpxf3iKhCtUpfHe5GPH/3OV+ukKWm4F2zDeUqEcrZFx19eX09Oc2NUlB5cwm5XaPB9JdrsMjWrIAnmayQIjIttotKyTwANBIFNDObJKjuuuyPcsxDyc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=nVLQx/Mw; arc=none smtp.client-ip=209.85.166.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="nVLQx/Mw" Received: by mail-il1-f178.google.com with SMTP id e9e14a558f8ab-3ce7935d38cso2714275ab.3 for ; Mon, 13 Jan 2025 14:30:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1736807407; x=1737412207; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:date:message-id:subject :references:in-reply-to:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zEtnQ2duiHf3hSpucZN3b3BFYLg18RCwSD6UbrLwQ40=; b=nVLQx/Mwb+j32c5c99r+XJXUJRHckAJGiJP7lexYDIZV9j6xtRVXgd3w9X80fJNAzk xqtXKYCHc+fRVDMZYA+w7OHHzF7GbmWBgiSVNgb8ejSmidr9nOOJQMqGV63v26f2CcRY xJ3kbPyymphljxBOzG1pV/MDERyHP4/sYq1do/LkZhV6YSmcA5vI8RD4e++uRb2JaU2E GdRRoI3g0xuWnKYbPIHRjlTIVpj5reGPBI6UU01up22mm77DOnyEaIfu6jA6ow7xBYPY PMaNrHFFHwlCNDgjrU3tXUnrAuoUoXzXZAdLwzf6bGd8vl9Fm6zelcHmog1kMCw6yRgq lffw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736807407; x=1737412207; h=content-transfer-encoding:mime-version:date:message-id:subject :references:in-reply-to:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zEtnQ2duiHf3hSpucZN3b3BFYLg18RCwSD6UbrLwQ40=; b=i7ga4MXPLlQ8uoOBNDP1m0CR55o0Nh9kfbgacL32MuX41wNDjwuBi5AokYajlK/7kG bI3u+nhhECjTnZl31Sv9UtBnPUdKEnnREfp+KNFyOeeMHVFvjcOKeUrsKeD0xiaubK+0 vroE9LYLgu3sogO9FDqRGyep1bq/Smb9g1BlBNLUiaWQQemP1yXdqToCo/v75UUu6mVv a/VFzP+sAjbtL7qux30b75BC6iZdaSCoffj1nJ1sA2PVaFUsGXadq0ZJ7GsqiKqSGL8U qxRf4wsDT8olLx/S2cVC5lkcHL+a0aLDIdtJZzIOLfADsc3l79Jd/f6VlKuUCCA6mUdy s1Pw== X-Gm-Message-State: AOJu0YwhRrt6T3+pXLgJK7RQwrdSA80QvAXw8LdeE3xuIgwkyDrlZZpe jUoOEOWPCnaUPSh43fPQPvwUFcOXZiCnEvaFeSi0SWuE+deM7g33HF4C8Ror6DOKmFZHieVAr7w k X-Gm-Gg: ASbGnctvKhmEFJ0ULvIDyO/OnmTGieoHMUVKOUIcySkyGswLaietyBdnOCOh+vmKuow LG9rzqUqw6+EcdC2+ma9e4TKG5jnXw5UojSjPgJ2yLe6flQWJ+k/0R+OCX87rmSaZt7SEWXUkKP SZ1IdpKENYFd5FTUD+P2WtVQmzZeCyQ8VHm6wHTEEclNs5719tDMcOlGBpZQ1hJsB5OLFRmwv0V +RhD9H6+bT0/kgDaXdvNRdzp0WzCGv3P1a2V8mrmx/3RJyb X-Google-Smtp-Source: AGHT+IH14nhDCfcE/VicXuUGkNCUwz79Cq5l77YJlqvmJudS4QIjKRZEFSv70F1oHkafS+cFB2okYw== X-Received: by 2002:a05:6e02:154b:b0:3a7:e286:a572 with SMTP id e9e14a558f8ab-3ce3a86a535mr161533645ab.3.1736807407481; Mon, 13 Jan 2025 14:30:07 -0800 (PST) Received: from [127.0.0.1] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4ea1b7177e4sm3019798173.92.2025.01.13.14.30.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 14:30:06 -0800 (PST) From: Jens Axboe To: linux-kernel@vger.kernel.org, Bui Quang Minh Cc: Pavel Begunkov , io-uring@vger.kernel.org, syzbot+3c750be01dab672c513d@syzkaller.appspotmail.com, Li Zetao In-Reply-To: <20250113160331.44057-1-minhquangbui99@gmail.com> References: <20250113160331.44057-1-minhquangbui99@gmail.com> Subject: Re: [PATCH v2] io_uring: simplify the SQPOLL thread check when cancelling requests Message-Id: <173680740642.1193220.11121663333496197972.b4-ty@kernel.dk> Date: Mon, 13 Jan 2025 15:30:06 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailer: b4 0.14.3-dev-14bd6 On Mon, 13 Jan 2025 23:03:31 +0700, Bui Quang Minh wrote: > In io_uring_try_cancel_requests, we check whether sq_data->thread == > current to determine if the function is called by the SQPOLL thread to do > iopoll when IORING_SETUP_SQPOLL is set. This check can race with the SQPOLL > thread termination. > > io_uring_cancel_generic is used in 2 places: io_uring_cancel_generic and > io_ring_exit_work. In io_uring_cancel_generic, we have the information > whether the current is SQPOLL thread already. And the SQPOLL thread never > reaches io_ring_exit_work. > > [...] Applied, thanks! [1/1] io_uring: simplify the SQPOLL thread check when cancelling requests commit: a13030fd194c88961be4679f87a1380f1bda0ebe Best regards, -- Jens Axboe