mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julian Vetter <julian@outer-limits.org>
To: Adrian Hunter <adrian.hunter@intel.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	James Clark <james.clark@linaro.org>,
	Thomas Gleixner <tglx@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Johan Hovold <johan@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Jiayuan Chen <jiayuan.chen@linux.dev>,
	"Steven Rostedt (Google)" <rostedt@goodmis.org>,
	"Vineeth Pillai (Google)" <vineeth@bitbyteword.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, driver-core@lists.linux.dev
Subject: Re: [PATCH 1/6] irq_work: Re-raise pending irq_work after system resume
Date: Mon, 9 Nov 2026 15:29:48 +0100	[thread overview]
Message-ID: <c479d14a-aedf-4815-b191-a5ebf41c1844@outer-limits.org> (raw)
In-Reply-To: <56198a93-670e-4187-86a3-99ae54295998@intel.com>

On 11/4/26 8:48 AM, Adrian Hunter wrote:
> On 04/11/2026 09:32, Sebastian Andrzej Siewior wrote:
>> On 2026-11-03 17:46:32 [+0200], Adrian Hunter wrote:
>>> On 02/11/2026 18:39, Sebastian Andrzej Siewior wrote:
>>>> On 2026-11-02 12:54:22 [+0200], Adrian Hunter wrote:
>>>>>
>>>>> Yes CPUs remain online for suspend2idle, but currently the choice between
>>>>> suspend2idle and "deep" (S3) suspend is a user space choice,
>>>>> refer /sys/power/mem_sleep.  Many modern systems do not support S3
>>>>> anymore, but it has not gone away.
>>>>>
>>>>>>
>>>>>> Anyway, I'm torn; I would much rather make this trigger a WARN and have
>>>>>
>>>>> AI now also identifies ftrace, BPF, GHES NMI, and #MC as possible causes,
>>>>> not just perf.  I haven't tried to confirm any of those.
>>>>>
>>>>> And, belatedly, AI is now saying an irq_work raised before lapic_resume()
>>>>> might result in #GP if the APIC is left in xAPIC mode at resume.  Also
>>>>> not confirmed.
>>>>
>>>> Could we flush this before similarly to what happens during CPU-hotplug.
>>>> The question is if this event can stay enqueued during suspend (and
>>>> handled on resume) or should be taken care before entering suspend.
>>>
>>> WRT "might result in #GP if the APIC is left in xAPIC mode at resume",
>>> the systems I have checked restore the APIC in x2APIC mode, so the
>>> issue is theoretical at this point, although I can get "unchecked MSR
>>> access error: WRMSR to 0x83f" if I deliberately add code to change
>>> x2APIC to xAPIC early in S3 wake (in x86_acpi_suspend_lowlevel()),
>>> and then do:
>>>
>>>    perf record -e power:suspend_resume --filter 'action == "machine_suspend" && start == 0' --no-buffering -C 0 -o /tmp/x.data &
>>>    rtcwake -m mem -s 10
>>>
>>> The error can be avoided with:
>>
>> I meant flush it via irq_work_run_cpu() like in smpcfd_dead_cpu() (the
>> CPU-hotplug path) and not go via APIC. You should do it late once the
>> interrupts are disabled so no new irq-work can be enqueued.
> Disabling IRQs doesn't stop NMI or syscore enqueues, and the resume-side
> raise still goes through the APIC

Hello Adrian,
I ran into the same lost irq_work self-IPI independently, in a different
context. I triggered that same issue with a live migration of Xen HVM 
guests. I sent a fix for it, but the posting only reached xen-devel and 
the maintainers, and not the Linux mailinglist (because my company email 
has some issues), so here is a short summary for everyone on this thread:

My Setup: XCP-ng 8.3 (Xen 4.17), Ubuntu 26.04 cloud image (kernel 
7.0.0-38), 4 vCPUs, "console=tty1 console=ttyS0". After a live migration 
the guest hangs, e.g. "systemctl restart systemd-resolved" never 
returns, and fsnotify/SRCU users block.

Mechanism: On Xen, live migration suspends the guest through 
xen_suspend() (drivers/xen/manage.c), which runs inside stop_machine():

syscore_suspend()        -> lapic_suspend() disables the local APIC
HYPERVISOR_suspend()
gnttab_resume(), xen_irq_resume(), ...   -> printk()
syscore_resume()

With the 8250 console being nbcon, the printk() in that window queues
nbcon_irq_work to the raised_list on CPU0 and then sends the self-IPI. 
But, the APIC is disabled at that point, so it's dropped. Afterwards, 
the raised_list stays non-empty, so irq_work_queue() never raises the 
IPI again and we are in that same situation.

In mainline the nbcon trigger is hidden by 560f4deda327 ("printk/nbcon: 
Change nbcon_irq_work to IRQ_WORK_LAZY"), but the underlying problem is 
still there for any non-lazy irq_work queued in that window. To 
reproduce it on mainline I reverted 560f4deda327 on top of v7.4-rc1:

v7.4-rc1 + revert of 560f4deda327 -> hangs after the first migration

v7.4-rc1 + revert of 560f4deda327 + this patch (1/6 only) -> 6 live 
migrations between two hosts, no hang, no SRCU or hung-task warnings, 
systemctl returns immediately

Since xen_suspend() calls syscore_resume() after the window above, this 
fix with the new irq_work_resend() functions covers the Xen case as 
well, without any Xen-specific changes.

Regarding the flush-before-suspend: In the Xen case that would not help. 
The lost irq_work is queued by printk() after syscore_suspend() has 
already disabled the local APIC, with interrupts off, so there is 
nothing to flush yet when suspend starts.

Tested-by: Julian Vetter <julian.vetter@vates.tech>

Thank you,
Julian

  reply	other threads:[~2026-11-09 14:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  7:40 [PATCH 0/6] perf/x86/intel/pt: Fix tracing across kexec, kdump and suspend Adrian Hunter
2026-11-02  7:40 ` [PATCH 1/6] irq_work: Re-raise pending irq_work after system resume Adrian Hunter
2026-11-02  9:06   ` Peter Zijlstra
2026-11-02 10:54     ` Adrian Hunter
2026-11-02 16:39       ` Sebastian Andrzej Siewior
2026-11-03 15:46         ` Adrian Hunter
2026-11-04  7:32           ` Sebastian Andrzej Siewior
2026-11-04  7:48             ` Adrian Hunter
2026-11-09 14:29               ` Julian Vetter [this message]
2026-11-02  7:40 ` [PATCH 2/6] perf/x86/intel/pt: Stop tracing if VMXON has not yet happened Adrian Hunter
2026-11-02  9:57   ` Peter Zijlstra
2026-11-02 11:04     ` Adrian Hunter
2026-11-02 11:07       ` Peter Zijlstra
2026-11-02  7:40 ` [PATCH 3/6] perf/x86/intel/pt: Stop tracing at syscore shutdown Adrian Hunter
2026-11-02 10:04   ` Peter Zijlstra
2026-11-02 10:23     ` Adrian Hunter
2026-11-02 11:01       ` Peter Zijlstra
2026-11-02 16:15   ` Andi Kleen
2026-11-02 16:27     ` Adrian Hunter
2026-11-02 17:45       ` Andi Kleen
2026-11-02 18:13         ` Adrian Hunter
2026-11-02  7:40 ` [PATCH 4/6] perf/x86/intel/pt: Clear TraceEn in hardware in cpu_emergency_stop_pt() Adrian Hunter
2026-11-02 10:07   ` Peter Zijlstra
2026-11-02 18:41     ` Adrian Hunter
2026-11-02  7:40 ` [PATCH 5/6] perf/x86/intel/pt: Reset stale MSR state on CPU start and resume Adrian Hunter
2026-11-02  7:40 ` [PATCH 6/6] perf/x86/intel/pt: Stop tracing across system suspend Adrian Hunter
2026-11-02 10:10 ` [PATCH 0/6] perf/x86/intel/pt: Fix tracing across kexec, kdump and suspend Peter Zijlstra
2026-11-02 12:22   ` Adrian Hunter

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=c479d14a-aedf-4815-b191-a5ebf41c1844@outer-limits.org \
    --to=julian@outer-limits.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=bp@alien8.de \
    --cc=dakr@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=driver-core@lists.linux.dev \
    --cc=frederic@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jiayuan.chen@linux.dev \
    --cc=johan@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=pavel@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@kernel.org \
    --cc=vineeth@bitbyteword.org \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®