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 191DF42982C for ; Tue, 16 Jun 2026 11:12:38 +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=1781608361; cv=none; b=OkKnsy1NbpcxITBiI72Fx9+4J9OZJCOFs0vcCzxAwiiBUDm740jVK9ORg3/UkXXPvkDrGvlALSQaoM30z6gzbDrb/eLiuU4ttAeg5ofkSl/+RdHQN+7BPVLgbj0tw48zaAl+K00mXuco9nOlDSFi2ldwj+2MzMW3oJzZV2b+7BA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781608361; c=relaxed/simple; bh=Rg0SRjge25r54MuX+5e7uJUHi8h+jHWxgQTJZMA3Ybw=; h=References:Mime-Version:In-Reply-To:Message-Id:From:Subject:Date: Content-Type:To:Cc; b=XBIta4/hWXeFfhk323N7Gkxp6OhmVofj+nxlZKJLkrP6vmvnk+bw8JCeI97NvV6YpuhoWkE9vqBwVK6LEddbpzhBJ08abqXBGilNuJDKyKx5ydSV/ZkCcALegUAjzCWthM+jKhqYKT9ekmrnBhYF/DAr8/d9g6+mCu3B9C0q2jM= 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=X18AaafF; 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="X18AaafF" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1781608348; 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=X18AaafFELgY36HI8gTHEoHsgYxQYfA16Ed3p5SZx9g4F0EBQrP3AYZoiXmio8/kfgG6WS gc3noRgcqFmH008wVqyjqPB+XSwbn7zxdZm1BlAzgFPyDqTGBZATiIlmp7NcnsFiD2Bqtv +NZsQj7GFmM2Kqfwan4UCsDZUuM4K/Zha00q2GeqGYwU/tz6qoEgwpaYaW7y/7T+PHv3t0 D6SezlUhbJvjWgGqkuGi+QimGQ3OkJJQKMQCZNAkpLJNfSjVYqTe9iQ3hi402B1LV0/hb5 5E5GVZaTWhZrfz6K09BXLneckao7l/rSNqD+NuIJP+c4+v/dkHuoPID1ELtAWg== X-Lms-Return-Path: Content-Transfer-Encoding: 7bit References: <20260616111127.966468-1-zhouchuyi@bytedance.com> X-Original-From: Chuyi Zhou Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 In-Reply-To: <20260616111127.966468-1-zhouchuyi@bytedance.com> Message-Id: <20260616111127.966468-2-zhouchuyi@bytedance.com> From: "Chuyi Zhou" Subject: [PATCH v8 01/14] smp: Disable preemption explicitly in __csd_lock_wait() Date: Tue, 16 Jun 2026 19:11:14 +0800 X-Mailer: git-send-email 2.20.1 Content-Type: text/plain; charset=UTF-8 To: , , , , , , , , , , , , , Cc: , "Chuyi Zhou" 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