From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751383AbdFDUFU (ORCPT ); Sun, 4 Jun 2017 16:05:20 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:48638 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751362AbdFDUFK (ORCPT ); Sun, 4 Jun 2017 16:05:10 -0400 Date: Sun, 4 Jun 2017 22:04:53 +0200 (CEST) From: Thomas Gleixner To: Chen Yu cc: Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , Len Brown , "Rafael J . Wysocki" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][RFC] x86: Fix the irq affinity in fixup_cpus In-Reply-To: <1493020011-18536-1-git-send-email-yu.c.chen@intel.com> Message-ID: References: <1493020011-18536-1-git-send-email-yu.c.chen@intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Apr 2017, Chen Yu wrote: > fixup_cpus() is to set appropriate irq affinity once the CPU > has been brought down, however we should also adjust the > desc->irq_common_data.affinity otherwise we will get an > incorrect irqmask during cpu offline: > > cat /proc/irq/31/smp_affinity > 00000000,80000000 > echo 0 > /sys/devices/system/cpu/cpu31/online > cat /proc/irq/31/smp_affinity > 00000000,80000000 > > This might bring potential problems, as reported we > saw plenty of irq flood during hibernation restore: > do_IRQ: 1.51 No irq handler for vector > Maybe it is due to some drivers get incorrect irq mask > during hibernation. > > Fix this by invoking the interface of irq_set_affinity_locked() > to also update the desc->irq_common_data.affinity. > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=188281 > Reported-and-tested-by: Thomas Mitterfellner > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: "H. Peter Anvin" > Cc: Borislav Petkov > Cc: Len Brown > Cc: Rafael J. Wysocki > Cc: x86@kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Chen Yu > --- > arch/x86/kernel/irq.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c > index 4d8183b..a108ed2 100644 > --- a/arch/x86/kernel/irq.c > +++ b/arch/x86/kernel/irq.c > @@ -480,13 +480,14 @@ void fixup_irqs(void) > if (!irqd_can_move_in_process_context(data) && chip->irq_mask) > chip->irq_mask(data); > > - if (chip->irq_set_affinity) { > - ret = chip->irq_set_affinity(data, affinity, true); > - if (ret == -ENOSPC) > + ret = irq_set_affinity_locked(data, affinity, true); This can't work. For interrupts which cannot set the affinity in normal context irq_set_affinity_locked() will queue the interrupt to move at the next arrival of an interrupt. So the irq stays affine to the dying CPU. After looking at the callsites, it's safe to change irq_set_affinity_locked() so that it uses the direct affinity setter function when force == true. So we need that change first, before we can switch fixups_irqs() over. Thanks, tglx