From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B29337700D for ; Tue, 21 Apr 2026 03:07:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776740823; cv=none; b=K8ZZ4ZiBJxi5zAKQTHq7TwqHqcNU/3W/Uz6nPDbo5MTSzZ1nHqngzZ8Z/6vdGtc+QumEb5psIcKAg8dlDbDv1Dt9Nf9r4OWazKNB76+kE3UTMuSH/LiqDHGz7Ttck/F24Z5EuV7wUFnKdYVn/JhfVsDQusH1dUYMy62j+YlEI/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776740823; c=relaxed/simple; bh=wBqbSVNLmblycpPiB4EVKCEJkX8NpN5Q/069MdSR2vo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CykeIHsvcbdWWPQnioT/1N/SXxRDf6obEisg41juDzDD0IzKdygJb1kVUvvknKU+9mH5xJCaks8GlF4Ji053i3Xnq8aBCrWoR/0CkA5g+x69PUN3h7VxXQR7ZTiExm9RHRHAZ43XyIJJDD8V3WO3SCMGF6ufUkLgGR8FB2QvsFY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LLaFrSe7; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LLaFrSe7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776740821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IJ1jBK4Qvk6IyuAc9PHelYKQB7rpI+GlQygtFZv3Gyc=; b=LLaFrSe7H0iJGX0Shmd444Jti497+4/hQXAeDIXxtssgSZ+YLVZUbF7t1y1ZqqXgqwrPVx b7btcECQdH26GRKNOsCSYbyJixN8YoNfeskAPXggQH3vIUvfOoUpuDyfB6eUtcna6zDuN5 6Zkcs5lviN+4DaTeg6zSLGx+xLh+gOU= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-376-wTudjAQlMAi-26eGJaOhJw-1; Mon, 20 Apr 2026 23:06:57 -0400 X-MC-Unique: wTudjAQlMAi-26eGJaOhJw-1 X-Mimecast-MFC-AGG-ID: wTudjAQlMAi-26eGJaOhJw_1776740812 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 517F11956054; Tue, 21 Apr 2026 03:06:52 +0000 (UTC) Received: from llong-thinkpadp16vgen1.westford.csb (unknown [10.22.65.81]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1DB4119560AB; Tue, 21 Apr 2026 03:06:44 +0000 (UTC) From: Waiman Long To: Tejun Heo , Johannes Weiner , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Jonathan Corbet , Shuah Khan , Catalin Marinas , Will Deacon , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Guenter Roeck , Frederic Weisbecker , "Paul E. McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Anna-Maria Behnsen , Ingo Molnar , Thomas Gleixner , Chen Ridong , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-hwmon@vger.kernel.org, rcu@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, Costa Shulyupin , Qiliang Yuan , Waiman Long Subject: [PATCH 16/23] genirq/cpuhotplug: Use RCU to protect access of HK_TYPE_MANAGED_IRQ cpumask Date: Mon, 20 Apr 2026 23:03:44 -0400 Message-ID: <20260421030351.281436-17-longman@redhat.com> In-Reply-To: <20260421030351.281436-1-longman@redhat.com> References: <20260421030351.281436-1-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 As HK_TYPE_MANAGED_IRQ cpumask is going to be changeable at run time, use RCU to protect access to the cpumask. To enable the new HK_TYPE_MANAGED_IRQ cpumask to take effect, the following steps can be done. 1) Update the HK_TYPE_MANAGED_IRQ cpumask to take out the newly isolated CPUs and add back the de-isolated CPUs. 2) Tear down the affected CPUs to cause irq_migrate_all_off_this_cpu() to be called on the affected CPUs to migrate the irqs to other HK_TYPE_MANAGED_IRQ housekeeping CPUs. 3) Bring up the previously offline CPUs to invoke irq_affinity_online_cpu() to allow the newly de-isolated CPUs to be used for managed irqs. Signed-off-by: Waiman Long --- kernel/irq/cpuhotplug.c | 1 + kernel/irq/manage.c | 1 + 2 files changed, 2 insertions(+) diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c index cd5689e383b0..86437c78f1f2 100644 --- a/kernel/irq/cpuhotplug.c +++ b/kernel/irq/cpuhotplug.c @@ -196,6 +196,7 @@ static bool hk_should_isolate(struct irq_data *data, unsigned int cpu) if (!housekeeping_enabled(HK_TYPE_MANAGED_IRQ)) return false; + guard(rcu)(); hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ); if (cpumask_subset(irq_data_get_effective_affinity_mask(data), hk_mask)) return false; diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 2e8072437826..8270c4de260b 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -263,6 +263,7 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, bool housekeeping_enabled(HK_TYPE_MANAGED_IRQ)) { const struct cpumask *hk_mask; + guard(rcu)(); hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ); cpumask_and(tmp_mask, mask, hk_mask); -- 2.53.0