Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp665035lqd; Wed, 24 Apr 2024 13:05:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVr0pR052PSlvwGbOec1j4OeIdJU1cVeYl75wy3IBtY68EYq8Yqm5BKbZBOzopRUFMH0nbdRty03mS/c0pYtCDSshRrsmsgI4t5GKj7QQ== X-Google-Smtp-Source: AGHT+IGmOuPtGcXsCZq2/2b3sJG806tY+cPamxCWBNPFXnJwQxEF48QUlN2KT3EG4k3Uxrx4jiZu X-Received: by 2002:a17:906:490c:b0:a52:225b:602a with SMTP id b12-20020a170906490c00b00a52225b602amr3115622ejq.7.1713989149705; Wed, 24 Apr 2024 13:05:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713989149; cv=pass; d=google.com; s=arc-20160816; b=qBrIgUISXBIaqyFaS6mhkrvmk1KWDl2OJFh4KRdahIvmKkyBowY4lv1KInriJPZUiK F4YVca0fygL3aRPKHqz1h6MKh8ohN0PfTYcdPZ/Vyj7KQmbe7n7C76i3NxCySEL1e/0j yVU6FigAcJeIONVJJFlB1UyUd90JrejIZ8rTT7Oru+78+0AzA+Lb5XlqE2v6BlQc/SWa 0aQSR+XHc4u3vEMgZE0sl7zi3aeLhdnj0e9t06Rh4YB0j2FgNprPPdefUx3XvUdRnmNd o3mmA1zNxWsKJ1hng9l/AP7HRRzfj+pe2u0RjNempO414BJL6SVItw2ifbv6CeOveWZJ 3Ikg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=iItQc4w+NZqDaeNu10psZYVHMhWDkTFJZCM1bZhMdW0=; fh=UHw7tqVM9PxAIHnvJNXNxSAzC11BhYv7C7V1KoQPBLA=; b=q4Z/PaTxSJjlmAHHBg6qOFEG4s7EJ6u+1PQNy8oyFZfn2Lfk+F99CsZ7Jcw8vhmfsL byyVNpzKiE9WhOzM/wPSutUCO4wJQ1TpqgdftsTa8SFM50Wq5A+/yXbSzX7Li0oEBGCI UG/pTKrrSWKPswoLNPzzhgSYYDvHBG5xZKg+VZYVymXmLLa5SPoW9HXvou+JdcKRFl+0 0L8pb/bPWUVwpeo6+nx+2bZ9kKO3hsvdA/iP6Hyt11Wk94VZ2gtgU91zJvD3og4JkGp+ oxKcC2OutIJ5nuZJa7o9uWq+XUFUVLAIaj4PMyIt1eVy6kwYC7N9NIaALn8TjwbbfbbI OjRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TTfv5PWu; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=k43vECvE; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-157652-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157652-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j16-20020a170906279000b00a51a97c5fd4si8374970ejc.543.2024.04.24.13.05.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 13:05:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157652-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TTfv5PWu; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=k43vECvE; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-157652-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157652-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6F4121F2467B for ; Wed, 24 Apr 2024 20:05:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8985E145348; Wed, 24 Apr 2024 20:04:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="TTfv5PWu"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="k43vECvE" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9F8BB143C5A; Wed, 24 Apr 2024 20:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713989056; cv=none; b=lcBH70cg6qseZcy01bMj3ji5WYb2ZSZ+Mkjv/nCETVF2xFlsEISUebSlq69h9oEvsEjiEN0erdj3+8Z6LKLBbMYfGpbh/avOTv6HtKI3pfcLYJIUL/iUNb7GuDQraNSfL0aucimpUwu0gWL97waMVX7HHL1KYkvADjN3DYvW2Lw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713989056; c=relaxed/simple; bh=tJaUYhyR6gQweoog88TjkZBTj5uT7xjIlUIQAj2YIcw=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=AEgwLBcgyleQ2biuidt0omY8Jz/716thVHHATQHilK+ERTQrzjDdDNHx1Q3KYoDkZeB2Ll9EwIT1qqcXzJmaeseCXpNus7YZ9NOeoNh91MpNadc3ZT4Rr5rzbEEWj/B3fAn8aGZ90bASCC7m0dEUsGh3e+GM4aRC0FX9GolJmxI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=TTfv5PWu; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=k43vECvE; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 24 Apr 2024 20:04:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713989048; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iItQc4w+NZqDaeNu10psZYVHMhWDkTFJZCM1bZhMdW0=; b=TTfv5PWuJHvJPvZ74B7Rq0pC2T+q1LNlml5ANWMa0n9Hzx0arlB4YsEFmT0qHryekb5jZM zoklznt0ZBEGfvDtmOGi/Jhtxx06e3iGsRbiojzs7H4cCF0yynkPXZqbFOJWIR/LiuaetH L2o7o2Z+JswRWoEH0PDvey1iBAtG6nJ6SxymzHEywCxQqNlcsy/ijVLT42F02fWJilyLhA eumGUv0tljclmz7yfU1VM3HKzXHWS6BollzXeFQ9ga5E1Sb1RNn43tHh9dDXjPmmEfEszb q1LV+kuE5e7Xg4sgtrJT+LElYVQHte/FiBI2/CSdlIk/TkEGUBhdAUM8btqwTw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713989048; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iItQc4w+NZqDaeNu10psZYVHMhWDkTFJZCM1bZhMdW0=; b=k43vECvEOhX5ar7wSOCfNqL+Q5kaISE7hZ+rfqyQdcIigJVDHiA7z0e9XPR5V09jNcQjt8 EOjSevXknTZ/MZBg== From: "tip-bot2 for David Stevens" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] genirq/cpuhotplug: Skip suspended interrupts when restoring affinity Cc: David Stevens , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20240424090341.72236-1-stevensd@chromium.org> References: <20240424090341.72236-1-stevensd@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171398904821.10875.12381201257490919108.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the irq/core branch of tip: Commit-ID: a60dd06af674d3bb76b40da5d722e4a0ecefe650 Gitweb: https://git.kernel.org/tip/a60dd06af674d3bb76b40da5d722e4a0ecefe650 Author: David Stevens AuthorDate: Wed, 24 Apr 2024 18:03:41 +09:00 Committer: Thomas Gleixner CommitterDate: Wed, 24 Apr 2024 20:42:57 +02:00 genirq/cpuhotplug: Skip suspended interrupts when restoring affinity irq_restore_affinity_of_irq() restarts managed interrupts unconditionally when the first CPU in the affinity mask comes online. That's correct during normal hotplug operations, but not when resuming from S3 because the drivers are not resumed yet and interrupt delivery is not expected by them. Skip the startup of suspended interrupts and let resume_device_irqs() deal with restoring them. This ensures that irqs are not delivered to drivers during the noirq phase of resuming from S3, after non-boot CPUs are brought back online. Signed-off-by: David Stevens Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240424090341.72236-1-stevensd@chromium.org --- kernel/irq/cpuhotplug.c | 11 ++++++++--- kernel/irq/manage.c | 12 ++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c index 1ed2b17..43340e0 100644 --- a/kernel/irq/cpuhotplug.c +++ b/kernel/irq/cpuhotplug.c @@ -195,10 +195,15 @@ static void irq_restore_affinity_of_irq(struct irq_desc *desc, unsigned int cpu) !irq_data_get_irq_chip(data) || !cpumask_test_cpu(cpu, affinity)) return; - if (irqd_is_managed_and_shutdown(data)) { - irq_startup(desc, IRQ_RESEND, IRQ_START_COND); + /* + * Don't restore suspended interrupts here when a system comes back + * from S3. They are reenabled via resume_device_irqs(). + */ + if (desc->istate & IRQS_SUSPENDED) return; - } + + if (irqd_is_managed_and_shutdown(data)) + irq_startup(desc, IRQ_RESEND, IRQ_START_COND); /* * If the interrupt can only be directed to a single target diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index ad3eaf2..29c378d 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -800,10 +800,14 @@ void __enable_irq(struct irq_desc *desc) irq_settings_set_noprobe(desc); /* * Call irq_startup() not irq_enable() here because the - * interrupt might be marked NOAUTOEN. So irq_startup() - * needs to be invoked when it gets enabled the first - * time. If it was already started up, then irq_startup() - * will invoke irq_enable() under the hood. + * interrupt might be marked NOAUTOEN so irq_startup() + * needs to be invoked when it gets enabled the first time. + * This is also required when __enable_irq() is invoked for + * a managed and shutdown interrupt from the S3 resume + * path. + * + * If it was already started up, then irq_startup() will + * invoke irq_enable() under the hood. */ irq_startup(desc, IRQ_RESEND, IRQ_START_FORCE); break;