From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sg-1-101.ptr.blmpb.com (sg-1-101.ptr.blmpb.com [118.26.132.101]) (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 51E91337BB8 for ; Mon, 2 Mar 2026 07:53:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=118.26.132.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772437986; cv=none; b=A4v5ezPyB+zEivg0NRqhQO8rUDOptu2ObhaE/6ecjDX6RmqWykEMCkwWMGrwBHqSfc1Cs41x6DL9w+aF5EbfHnfdCu1xJVh7GxcX+0gPM1/CEGTt01dGITE2VFtGsQ6n+/+BcWuUAEoWCoVaQSjAMVZC/WnFswrHHQqwIWyVE0o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772437986; c=relaxed/simple; bh=XH+TgyQJYrU8fNK1eEXW2c0NoIumPBqw2CKhw534Sz4=; h=Subject:Date:In-Reply-To:Cc:From:To:Message-Id:Content-Type: References:Mime-Version; b=s8TLES+/UYMvxAvwAtOlYcVhZ19zK4dtLX/9B+2vLRYxhE7zcs7ZPKywB3aT8QTlygkWxd8LzdqArViWgTB6t5chAGBEP+efd25lv+VjC00uvhVXHwlRlZWl9XUuuf+N8ludYsIsJdJ9x8+xUmeAikao/JpSLstBRdRIzCb0jqA= 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=Jld/BJAD; arc=none smtp.client-ip=118.26.132.101 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="Jld/BJAD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1772437978; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=XJQbGVgOA6I60dB8y0qr6QT4Xv7obtiE15uJEm45WXA=; b=Jld/BJADDSrudFLScLy7q16yPcx94r7oZsE6OgMpGXHqfmPOCLgKxNMfAViwRJsMmJmk9r eTldZBH0U0ItENCDOTE10dG8IGSeKVsDwLwe+JbndcSboScdqKhXg9L7Cfm363cu8kKwV4 BtDcYCsfghIeSLD7WgavEg7lxzWbSpQgRVtmsEwR4yuQNScZFOyEkvsjWCTMEAiTmx/4V+ xIYScDTVLCpt5Fnef4kYhmdOjo/We4mEJLSGKw/XEp5Lr1Lnom5Hy8q2CupjqGBb0CcOgf S/a94IBuQGqbvURHHNboohC8WDFQvYNh4Y+b969U2aQYWiYt0QraXv4SV3IqZg== Subject: [PATCH v2 01/12] smp: Disable preemption explicitly in __csd_lock_wait Date: Mon, 2 Mar 2026 15:52:05 +0800 In-Reply-To: <20260302075216.2170675-1-zhouchuyi@bytedance.com> X-Original-From: Chuyi Zhou Cc: , "Chuyi Zhou" From: "Chuyi Zhou" X-Mailer: git-send-email 2.20.1 To: , , , , , , , , , , , Message-Id: <20260302075216.2170675-2-zhouchuyi@bytedance.com> X-Lms-Return-Path: Content-Type: text/plain; charset=UTF-8 References: <20260302075216.2170675-1-zhouchuyi@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: 7bit The latter patches will enable preemption before csd_lock_wait(), which could break csdlock_debug. Because the slice of other tasks on the CPU may be accounted between ktime_get_mono_fast_ns() calls. Disable preemption explicitly in __csd_lock_wait(). This is a preparation for the next patches. Signed-off-by: Chuyi Zhou Acked-by: Muchun Song --- kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/smp.c b/kernel/smp.c index f349960f79ca..fc1f7a964616 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