All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: AceLan Kao <acelan.kao@canonical.com>,
	Marc Zyngier <maz@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>
Subject: Re: There are not enough CPU0 APIC IRQs while doing IRQ migration during S3
Date: Wed, 20 Jul 2022 12:11:44 +0200	[thread overview]
Message-ID: <CAJZ5v0jYJxk1B1XORLQkGf=R9HDPbUzAjb3_2GUM0XtfmyXfZA@mail.gmail.com> (raw)
In-Reply-To: <CAAd53p7GGjqpo97VP=uXnJQstKzxCf9Si+ZCD98UsbdJ7oS=SA@mail.gmail.com>

On Wed, Jul 20, 2022 at 5:16 AM Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> [+Cc Rafael, linux-pm]
>
> On Wed, Jul 20, 2022 at 10:53 AM AceLan Kao <acelan.kao@canonical.com> wrote:
> >
> > Marc Zyngier <maz@kernel.org> 於 2022年7月19日 週二 下午6:48寫道:
> > >
> > > [- Jason]
> > >
> > > On Tue, 19 Jul 2022 06:55:21 +0100,
> > > AceLan Kao <acelan.kao@canonical.com> wrote:
> > > >
> > > > HI all,
> > > >
> > > > I encountered an issue while doing S3, it shows below message and then
> > > > failed to enter S3
> > > > [  106.731140] CPU 31 has 116 vectors, 85 available. Cannot disable CPU
> > > > [  106.731551] ACPI: \_PR_.C01F: Found 2 idle states
> > > > [  106.732610] Error taking CPU31 down: -28
> > > > [  106.732612] Non-boot CPUs are not disabled
> > > >
> > > > CPU: AMD Ryzen Threadripper PRO 3955WX 16-Cores
> > > > Kernel: v5.19-rc7
> > > > There are 5 PCI to 4 type-c ports USB cards on the machine, and It
> > > > wouldn't lead to the issue if only 4 cards are plugged. So, it looks
> > > > like it can't handle 5 cards, and failed on the IRQ migration.
> > > >
> > > > The workaround provided by kaiheng is to release the irq while
> > > > suspending and request irq while resuming.
> > > > I'm wondering do we have a better solution for this kind of issue?
> > > > Thanks.
> > > >
> > > > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> > > > index edc6881c8a1b..91c79b21cb57 100644
> > > > --- a/drivers/usb/host/xhci.c
> > > > +++ b/drivers/usb/host/xhci.c
> > > > @@ -17,6 +17,7 @@
> > > > #include <linux/slab.h>
> > > > #include <linux/dmi.h>
> > > > #include <linux/dma-mapping.h>
> > > > +#include <linux/suspend.h>
> > > >
> > > > #include "xhci.h"
> > > > #include "xhci-trace.h"
> > > > @@ -1079,6 +1080,9 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
> > > >                                __func__);
> > > >        }
> > > >
> > > > +       if (pm_suspend_via_firmware())
> > > > +               xhci_cleanup_msix(xhci);
> > >
> > > I'm a bit clueless when it comes to the combination of x86 and xhci,
> > > but doesn't this prevent resuming on a xhci interrupt?
> > The PCI cards provide 4 type-c USB ports, and in the beginning we
> > found that removing one PCI card fixed the issue, so we were trying to
> > fix the issue in xhci driver.
> > The USB ports on the PCI cards can't resume the system from S3 even
> > without the workaround,
> > but the USB ports on the rear panel of the motherboard still work with
> > the workaround.
>
> The isn't xHCI specific. The issue here is that CPU0 APIC doesn't have
> enough IRQ vector for ACPI S3 suspend.
> Ideally we don't want to tear down IRQs during suspend, but for this
> case minimizing IRQ numbers means successful S3.
>
> So maybe we can have a suspend flow like this:
> - At the beginning of suspend, check if there's enough free IRQ for
> CPU0 migration.
> - If there isn't enough free slots, hint drivers to tear down non-wake
> IRQs. Maybe use a global variable if we don't want to add a new
> parameter to current PM ops.
> - If it's still not enough, abort suspend.
>
> For suspend that doesn't unplug CPU like suspend-to-idle, no
> modification is needed.
> I wonder if that makes sense?

Quite probably, IRQs need not be migrated during system suspend, so it
should be possible to avoid doing that entirely on "hot remove" if it
is part of the suspend flow.

  reply	other threads:[~2022-07-20 10:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19  5:55 There are not enough CPU0 APIC IRQs while doing IRQ migration during S3 AceLan Kao
2022-07-19 10:48 ` Marc Zyngier
2022-07-20  2:53   ` AceLan Kao
2022-07-20  3:16     ` Kai-Heng Feng
2022-07-20 10:11       ` Rafael J. Wysocki [this message]
2022-07-21  3:02         ` Kai-Heng Feng
2022-07-28  2:07           ` AceLan Kao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJZ5v0jYJxk1B1XORLQkGf=R9HDPbUzAjb3_2GUM0XtfmyXfZA@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=acelan.kao@canonical.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.