From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from va-1-112.ptr.blmpb.com (va-1-112.ptr.blmpb.com [209.127.230.112]) (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 5A793382298 for ; Tue, 30 Jun 2026 11:11:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.230.112 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782817863; cv=none; b=da3J7MptnasutrRtOmYd2964o0enaJRC97Pq8NYvDSJnY76L5c0DzMAbb4PJQjnvkZO5u5TJDL4p4RohbA9qu9vdtw+2QUrutQEi8J1U6VlmScx+Ps2egP9HpjBGzruDGLr6W6CNZDxayUX79vR+2LgYyu4PuxcE21Wv6LjarG4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782817863; c=relaxed/simple; bh=uC6JuvPHHiv16iM6gQUufwzeMB2xsKifWPv7SKWL1fY=; h=Message-Id:In-Reply-To:References:To:Subject:Content-Type:Cc:From: Date:Mime-Version; b=obd5HMqFXI67TbpLLfzVQeGFoNb1aVa8eftYZ1Rji4TBBg1PxgIsx6xf7ECtYDDlUrsSoxqPeeHbrNmv9a7+ejY1WXQFMNw5m5Qcsdmx5kruPVy1VUz6TkGh4zsyY8fW6d3BZ5KVTsBlbesfiXc+99uV7BLKu2h4a+fx4Fs2jbM= 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=Ffb+375t; arc=none smtp.client-ip=209.127.230.112 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="Ffb+375t" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1782817854; 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=Ffb+375t2NVTmHMiUvrmBzBVH2+9+pAt8Ee5gashxPpP4tv7LeZ1yvHXy3DHRFENLskM5F Lzdw3nnsO7kRiBayB6AY/js/dUkotR25wYMjg4HIrsJpd6KhXcS1LZ7EXCFeURW/S25Ngk QVuRgGBqINXY9pyS01Ltt1zNBD8MMmE/2juwaHFDR3IZH3uWCgQ6uOiacqzfIjLRvRoMK1 Dd+ov25Ip2FO0mmqSpON89/snDJxmuq35svbSAbwyoGWs16q6cVNo7uOP+MtRCTeZcKJUU +SsUPycqKvB7mm4Rib/zON8jLsUMDz7eSbiKvnA9ABl6iqC29qjuIVlvRsHMIw== Message-Id: <20260630111008.2034376-2-zhouchuyi@bytedance.com> X-Original-From: Chuyi Zhou X-Mailer: git-send-email 2.20.1 In-Reply-To: <20260630111008.2034376-1-zhouchuyi@bytedance.com> References: <20260630111008.2034376-1-zhouchuyi@bytedance.com> To: , , , , , , , , , , , , , Subject: [PATCH v9 01/14] smp: Disable preemption explicitly in __csd_lock_wait() Content-Type: text/plain; charset=UTF-8 Cc: , "Chuyi Zhou" From: "Chuyi Zhou" Content-Transfer-Encoding: 7bit X-Lms-Return-Path: Date: Tue, 30 Jun 2026 19:09:55 +0800 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