From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from va-1-114.ptr.blmpb.com (va-1-114.ptr.blmpb.com [209.127.230.114]) (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 8B41F352C51 for ; Mon, 8 Jun 2026 11:25:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.230.114 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780917903; cv=none; b=pwtvFw1cSTO2yi/ZdbsSXBpLUsTWDn75u1FpCpk6jQt7xooKxkuvwKVDraOVC3xV/0NqBIN/afnOWw9s58pFm82gstyEE3zOY0ni2ih2mWCzSHkP3CL1Ko+XbEV+mvth/Q65QwZH6cTr7dG1q8TW94hTcJgtYh+Wn6qPmTpcW4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780917903; c=relaxed/simple; bh=EYv37vvOxOOSEA9iNpyoUcnpLZLoti6qm7ewzY5yDAo=; h=Date:Message-Id:To:Mime-Version:Cc:From:Content-Type:Subject; b=SU8QnIpFoNvXY+1kfoCMO6l1g6ADscoH2im/dPR2XNEXceJFd1b2bhvPH9nFlUBONu5aQjrDPnKVEoD7WER8eZaEymedzlp9me998+DSi0l5iSvSOHu5gp1tv2eyGiFDnYDgawoqp9mSqrEm++AtM9OEQcQiRn0XR30oo+yuxKE= 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=emRrPa96; arc=none smtp.client-ip=209.127.230.114 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="emRrPa96" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1780917895; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=b0qlF7X55N2awPG3sUAxrSJ7bu1S7d6KYlLKPTaWilM=; b=emRrPa961ijcc6aGl7R7v6HeYQq3zv8c/TgRTRfmEKPtXc6IZ4KTl+cHSZDBCq9oC71jZf vPswnLN+By1bQjQQxIoCdh911cKYHkbsWc1wFwwRvNGbeVA9IOD1s+hFdej0jFz5dmUzSW 92Nb0NLoHJUgJq9uJfTteDKJdwGjWVFYYXFEfvFz2q7t9HVtQvaXEKoK2zNbA7uRstUnU9 TO4Akar0yNbLqV1kLmIcX96pAW6dx2QR0gKl+J5PTbBIagDvCPSrV2MncRqKTwBUVxO1+x 4WVFaMyWJpRvBFFovWSAqYAoG2HLZFOj2Ino5kqyAUG4QMZYPs7qENAEk7U87w== Date: Mon, 8 Jun 2026 19:23:47 +0800 Message-Id: <20260608112349.3955175-1-zhouchuyi@bytedance.com> Content-Transfer-Encoding: 7bit X-Mailer: git-send-email 2.20.1 To: , , , , , Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Cc: , "Chuyi Zhou" From: "Chuyi Zhou" X-Original-From: Chuyi Zhou Content-Type: text/plain; charset=UTF-8 Subject: [PATCH 0/2] smp: Fix CSD lock debug regressions X-Lms-Return-Path: This series fixes two regressions introduced by commit b0473dcd4b1d ("smp: Improve smp_call_function_single() CSD-lock diagnostics"). That commit made smp_call_function_single() use the destination CPU's csd_data while CSD lock debugging is enabled. This improves diagnostics, but it changes two assumptions that the existing code relied on. The first patch keeps invalid CPU numbers from being used for the destination CPU csd_data lookup before generic_exec_single() has a chance to reject them. This preserves the existing -ENXIO path for callers such as smp_call_function_any() when no online CPU can be selected. The second patch makes csd_lock() acquire CSD_FLAG_LOCK atomically in the debug configuration. With destination CPU csd_data, multiple remote CPUs can concurrently send async calls to the same target CPU and therefore contend for the same CSD object. The old non-atomic wait-then-set sequence can let two senders enqueue the same llist node, corrupting call_single_queue and leaving later synchronous callbacks stuck behind it. The non-debug fast path keeps the existing wait-then-set sequence. Chuyi Zhou (2): smp: Avoid invalid per-CPU CSD lookup with CSD lock debug smp: Make CSD lock acquisition atomic for debug mode kernel/smp.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) -- 2.20.1