From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f54.google.com (mail-dl1-f54.google.com [74.125.82.54]) (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 0685B397685 for ; Mon, 13 Apr 2026 07:44:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776066257; cv=none; b=j7pTq5V+s3tYAIS1jvlN3nLJ+D6/nwj91DaPGAea7cOU7Ai/CQLfBpgO4bI+YIUShGDWVLJm78CgPWW8MVcT12VRa/OOXafm6r3eP7M6JKKC857K5xoSQ3QJylqOg863Hkl3Yhl1gzi6P1kY2CIjQ+DUtMdhI4j//nv4Jl7O6PY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776066257; c=relaxed/simple; bh=abNstHmJGgw4JbpWqL555msiifzgY+9+aN3eQVlKCX4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a/MAG7qkBuo4bQ0GHAzuIJECHZehvEmqZn+1ytyMX1mETEZ+OiupKpnk6X4H7d5wYXFZygbAaeVrBpUE/3sGFLMm0XTVrDKSOFSorFbY8KKsofkBiZ+nK+zv/piN1W8PnTYH4uzXL1Jw+cKxR+10N0szKV8n9XtRBipfPWh0ntg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OfXeGHxD; arc=none smtp.client-ip=74.125.82.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OfXeGHxD" Received: by mail-dl1-f54.google.com with SMTP id a92af1059eb24-12c1fcce8f8so6903837c88.1 for ; Mon, 13 Apr 2026 00:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776066255; x=1776671055; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=EF3HsX1PiWlQS1SWUgySjoqh/zlAKHa5r5Dv0SN822Y=; b=OfXeGHxDXjLlvoZJQLl2fIyr2B7Ezrmrc+Ir2bzbbK7z4cugW2V3aOao4CC1jCFf9/ KkiyEWtA9IQ61ZMNyufOzSeQlYQn12b5HoZujPMJGD/QijERHfLBqXfuuebIhGseJ/sc HqRHyx9DrQFL1QQ3tGiLfAQiLQj969T+3JE/bnRN/O0bdfd3eJhHhPQ+g8MfVPWjclpw i1y4fo+fzljdwsDlavcuqNQAQ9sTfWraQVCDFDGa78J6daPlwai6hkt+hqdV/MP0eaPp vTaHIpac17q+ITfiX9s9Q4AVTfZBMhv0g0GuryusQ1pOLZpnaPsSVhVvxtsKJ9VMJG3c bT9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776066255; x=1776671055; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=EF3HsX1PiWlQS1SWUgySjoqh/zlAKHa5r5Dv0SN822Y=; b=kXUK0ruIAQLSP5opepEkJT3iZzd2IuY/xni+Qy1hBIL91M0qsM8ygHfuAZP+QheoPH i6fBuChKRXup1FjhlZYEWtLVZlMEeqcUSuOfANVPlFuiLd0g+7/pHVXe7FTJMQTSggSM FoSsldHj4E0xlRCzz0E+T4UBsVWj1HQJYcxY0KwE9UvmqjO6wfiopHbarm1+vY+GqEi1 psZIp14zbJWQR4E2KrM3wttBMk62wbOR0iY1J3I2XIhyCJ84OriVaoaIa8U2sEcoryzQ lHq7875iL6cczkO4jOx5iSZPuFodxvayI3saiatgI8HajlkFFcwkcEqtzhZs44/8izhm +Vcg== X-Gm-Message-State: AOJu0YxFXRG8POG4QW/BauNe+FCZj4jft7MCYXNE6qhzSrudRMGpb8UD CrdkX6wgDRqfejnKOWU6A5YtuL/wFk+x7IBuWwku88NnNhixXvqz5sVM X-Gm-Gg: AeBDievBXHs4fJJIVVclfXplqp5RxWLHngRGYWGgGxfqdSlPRVT5REynt/GAqHY14eE wweVvjx8E0ihU8Fqw0RUg++6qUGba7Hxa3k8TVs+GD9JD19CXnRdRlC+uE48OY5A/zq4ZZq8MT4 m0XwglV49cHlv0knljhiWoJdFnRAR08XGqo1h65D0JwZ1lZF8WClLs8I/tjKTBNvRdCJbKLu/p1 VcHOdAszwibmmrlAcs4lqTBxOELcKDxRpbVPQo/5Wwg1MKMwNlPS0Qfx5jXYX8uIyLVNqtSiG2c 5AltumySbtNPYWxI8546SbVu4zMT5WBTYXgNmwDbX7VJsCehGINcAcZXChGHt+AJqgC2vreY914 9HtbUBszwfQe2Q222bkRSRaOoodmfDgYsDvAsb9Cta1hkra664B1urNGhhEVsz2ei3fCEhAnM3u EgfuPrsYNyFRd+eJlxD1nboT3QsO8= X-Received: by 2002:a05:7022:47:b0:128:d4be:7428 with SMTP id a92af1059eb24-12c34edee4bmr7057521c88.19.1776066255198; Mon, 13 Apr 2026 00:44:15 -0700 (PDT) Received: from wujing. ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12c347fa2c9sm12884610c88.15.2026.04.13.00.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2026 00:44:14 -0700 (PDT) From: Qiliang Yuan Date: Mon, 13 Apr 2026 15:43:11 +0800 Subject: [PATCH v2 05/12] genirq: Support dynamic migration for managed interrupts Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260413-wujing-dhm-v2-5-06df21caba5d@gmail.com> References: <20260413-wujing-dhm-v2-0-06df21caba5d@gmail.com> In-Reply-To: <20260413-wujing-dhm-v2-0-06df21caba5d@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Anna-Maria Behnsen , Ingo Molnar , Thomas Gleixner , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Waiman Long , Chen Ridong , =?utf-8?q?Michal_Koutn=C3=BD?= , Jonathan Corbet , Shuah Khan , Shuah Khan Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Qiliang Yuan X-Mailer: b4 0.13.0 Managed interrupts currently have their affinity determined once, honoring boot-time isolation settings. There is no mechanism to migrate them when housekeeping boundaries change at runtime. Enable managed interrupts to respond dynamically to housekeeping updates. This ensures that managed interrupts are migrated away from newly isolated CPUs or redistributed when housekeeping CPUs are added. Signed-off-by: Qiliang Yuan --- kernel/irq/manage.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 2e80724378267..31e263d9f40d0 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -2801,3 +2801,52 @@ bool irq_check_status_bit(unsigned int irq, unsigned int bitmask) return res; } EXPORT_SYMBOL_GPL(irq_check_status_bit); + +#ifdef CONFIG_SMP +static int irq_housekeeping_reconfigure(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct housekeeping_update *upd = data; + unsigned int irq; + + if (action != HK_UPDATE_MASK || upd->type != HK_TYPE_MANAGED_IRQ) + return NOTIFY_OK; + + irq_lock_sparse(); + for_each_active_irq(irq) { + struct irq_data *irqd; + struct irq_desc *desc; + + desc = irq_to_desc(irq); + if (!desc) + continue; + + scoped_guard(raw_spinlock_irqsave, &desc->lock) { + irqd = irq_desc_get_irq_data(desc); + if (!irqd_affinity_is_managed(irqd) || !desc->action || + !irq_data_get_irq_chip(irqd)) + continue; + + /* + * Re-apply existing affinity to honor the new + * housekeeping mask via __irq_set_affinity() logic. + */ + irq_set_affinity_locked(irqd, irq_data_get_affinity_mask(irqd), false); + } + } + irq_unlock_sparse(); + + return NOTIFY_OK; +} + +static struct notifier_block irq_housekeeping_nb = { + .notifier_call = irq_housekeeping_reconfigure, +}; + +static int __init irq_init_housekeeping_notifier(void) +{ + housekeeping_register_notifier(&irq_housekeeping_nb); + return 0; +} +core_initcall(irq_init_housekeeping_notifier); +#endif -- 2.43.0