From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from va-1-111.ptr.blmpb.com (va-1-111.ptr.blmpb.com [209.127.230.111]) (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 454E73F1AC5 for ; Tue, 9 Jun 2026 09:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.230.111 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780996689; cv=none; b=L6ofJQFuFF6fiO2l4gNnm0XqilV1rYz850EMZDvZMDc9NoHDVaKjJt45Bq0v7EqOkMKAep+8Nv/7asgxpzcJhIS7WJ6vLWcSuVZ3xTijYrEailwHOmQNlgSItZX1Lpt2ZW0sd9r6ZuWKwFkTMQJXBMmgyRuYgn8pVnaJ5YAgVvI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780996689; c=relaxed/simple; bh=Rg0SRjge25r54MuX+5e7uJUHi8h+jHWxgQTJZMA3Ybw=; h=From:Content-Type:To:Message-Id:Mime-Version:In-Reply-To: References:Cc:Subject:Date; b=kmu9YRnZE27VnmtM300pllyiI9xh/TyIEV96Gs5o6ixbVPo+o8csykE+7nI2aNQX/KGU+eDoUCxH234Vjlup4gRHObksA76lQdMRZgtfu8Kxozp84+q5eSjQT+yavvcgmKbR4xm4gReknuLx/paUeY6hLnadLvli1lT2jC6g+bE= 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=mlrJnLlO; arc=none smtp.client-ip=209.127.230.111 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="mlrJnLlO" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1780996681; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=0CuqQYjiGxOq8T4U5Tl4ROE+RqReBxMtjXyeROSsYsk=; b=mlrJnLlOfDwh7+qYqX6Um+EhE1TWpLettNAgwFkTZPbZXa99TtV+zmAcxcSWJ4JdTLxELk Fb0RX/mGSwwtZmRZiJ6iT8emlyLz1GMmfHH0IbDVQoYoNv6JipgZ5+j4SFR4uR56PI59Bt t6r3EIxgnsefWV+GdqhN+V0DEBoobYwc+qFlJxwitCuz5U6MZSB+ooO7obing0NdCqgYcb EjYKO/lEgCsoGr0wQ7MYqMWA340s9wEgKd5aMfMfdX5QT08Zph6uuIrlV2mkbmO7RdiQIX j/ASE9GSkwMIvM3i3tixU1i8Uky3gtlkpvltS3alr2TavXISgnQcJnw8eTM0BQ== Content-Transfer-Encoding: 7bit From: "Chuyi Zhou" X-Lms-Return-Path: Content-Type: text/plain; charset=UTF-8 To: , , , , , , , , , , , , , Message-Id: <20260609091710.404083-2-zhouchuyi@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 In-Reply-To: <20260609091710.404083-1-zhouchuyi@bytedance.com> References: <20260609091710.404083-1-zhouchuyi@bytedance.com> X-Mailer: git-send-email 2.20.1 X-Original-From: Chuyi Zhou Cc: , "Chuyi Zhou" Subject: [PATCH v7 01/14] smp: Disable preemption explicitly in __csd_lock_wait() Date: Tue, 9 Jun 2026 17:16:57 +0800 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 Reviewed-by: Steven Rostedt (Google) Reviewed-by: Sebastian Andrzej Siewior Tested-by: Paul E. McKenney --- 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