From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from va-2-115.ptr.blmpb.com (va-2-115.ptr.blmpb.com [209.127.231.115]) (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 DFD054229B9 for ; Thu, 9 Jul 2026 12:30:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.231.115 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783600241; cv=none; b=GZhre4x8nKfznFrUcXYOE8DrzBYxbMivSFTpo/Cf8lKtnzda36wNjm+i4R1sms6JuS/OS/bOTzWwBz9A0/LExhIWg36/Q4v6ex0qZgPvEdjhHXVvCOFs7SqoiR1x5tc3Gco2qT+cxPT3ERG/pV9Sp4Kn1LyhGdKKRdMSMl1RBVc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783600241; c=relaxed/simple; bh=uC6JuvPHHiv16iM6gQUufwzeMB2xsKifWPv7SKWL1fY=; h=Cc:Subject:Message-Id:Content-Type:To:In-Reply-To:Date:From: References:Mime-Version; b=iP6IoJvP2bW3Aqcv6SxG2ep/4VX58J/5L2PDPzJSMXOFrs01gfw8kous8av/lBFMRNi40/HveuyNcmEyV9Yp4XK8xKf06REF7gwzTsb3bYI7cqNbrdXP1bMGd1hYXBZI45ADnH0WFeofq+VGLNqsrrYu0Q/yU39qWHdT31b0NEY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=j14HqUnn; arc=none smtp.client-ip=209.127.231.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="j14HqUnn" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1783600233; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=PTis8wF35iuucNzcojqxgDe88w0r7l5E8SRoiLTj548=; b=j14HqUnnTHODcf+eSBMF+rPzcT4cFsOB9Gd+Vx3rgQzSyTLo2wAY7lCSJ+Jp3cD/R3MebD E/HDc/BuGc73h+k72HixP0FoTPMhmV7+iIpw+mAmxK7ULooZpRv/x70BQOx4Wf0397s/0d bJRMn9qrDtNIFnXzZpyU+2TKoNv9LY0b0hvnI0LmccgXchWj083E+im4Q55NXPcTKmDrUu jpineuglkUjgF6sEjFNF2xEyAFhJJ41yHCzCHaU4nqXqQMg3Nyzrj3KLteyjdZ/8CD7IZt 4yHLr15Ou7A9Hm7NeVdv80NOuUGgZcW1bbkWIazKmz+NL+XQE5/2/wPbS9cezw== Cc: , "Chuyi Zhou" Subject: [PATCH v10 01/14] smp: Disable preemption explicitly in __csd_lock_wait() Message-Id: <20260709122933.4021501-2-zhouchuyi@bytedance.com> X-Original-From: Chuyi Zhou Content-Type: text/plain; charset=UTF-8 To: , , , , , , , , , , , , , Content-Transfer-Encoding: 7bit In-Reply-To: <20260709122933.4021501-1-zhouchuyi@bytedance.com> Date: Thu, 9 Jul 2026 20:29:20 +0800 X-Lms-Return-Path: From: "Chuyi Zhou" References: <20260709122933.4021501-1-zhouchuyi@bytedance.com> X-Mailer: git-send-email 2.20.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 The CSD lock wait debugging code in __csd_lock_wait() must run with preemption disabled. The smp function call mechanisms which invoke it currently keep preemption disabled across the wait, so the debugging code inherits that guarantee from its callers. Keeping preemption disabled across the whole smp function call operation can induce large scheduling latencies. Shortening the caller-side preemption-disabled region would invoke __csd_lock_wait() with preemption enabled. Prepare for that by disabling preemption explicitly around the CSD lock wait debugging code in __csd_lock_wait(). Signed-off-by: Chuyi Zhou Tested-by: Paul E. McKenney Reviewed-by: Steven Rostedt (Google) Reviewed-by: Sebastian Andrzej Siewior Acked-by: Muchun Song --- kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/smp.c b/kernel/smp.c index a0bb56bd8dda..b58975480e11 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -323,6 +323,8 @@ static void __csd_lock_wait(call_single_data_t *csd) int bug_id = 0; u64 ts0, ts1; + guard(preempt)(); + ts1 = ts0 = ktime_get_mono_fast_ns(); for (;;) { if (csd_lock_wait_toolong(csd, ts0, &ts1, &bug_id, &nmessages)) -- 2.20.1