mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
Cc: rafael@kernel.org, len.brown@intel.com, linux-pm@vger.kernel.org,
	akpm@linux-foundation.org, dianders@chromium.org,
	tglx@linutronix.de, song@kernel.org, liusong@linux.alibaba.com,
	yaoma@linux.alibaba.com, kjlx@templeofstupid.com,
	lizhe.67@bytedance.com, linux@weissschuh.net,
	j.granados@samsung.com, linux-kernel@vger.kernel.org,
	"CobeChen@zhaoxin.com" <CobeChen@zhaoxin.com>,
	"TimGuo@zhaoxin.com" <TimGuo@zhaoxin.com>,
	SilviaZhao@zhaoxin.com,
	"Linda Chai(BJ-RD)" <LindaChai@zhaoxin.com>,
	Felixzhang@zhaoxin.com
Subject: Re: Unknown NMI after S4 resume
Date: Thu, 25 Jul 2024 10:27:04 +0200	[thread overview]
Message-ID: <ZqIMWDWn5W9+9RMA@duo.ucw.cz> (raw)
In-Reply-To: <14cf0b83-7030-4ec5-97b1-40c90424fe3f@zhaoxin.com>

[-- Attachment #1: Type: text/plain, Size: 2400 bytes --]

Hi!

> When running S4 test on Zhaoxin platform with Ubuntu22.04 kernel-6.10 we got
> unknown NMI messages after S4 resumed:
> 
> [  115.792224] Uhhuh. NMI received for unknown reason 2d on CPU 0.
> [  115.792226] Do you have a strange power saving mode enabled?
> [  115.792228] Dazed and confused, but trying to continue
> 
> And reproduced on Intel platform.
> 
> After tracing, we find that the reason for this Unknown NMI occurs is as
> follows:
> a, 1st kernel starts normally and NMI watchdog is enabled on all cores;
> b, NMI watchdog is disabled on all cores through the sys interface, then
> variable active_events goto zero;
> c, Start hibernate, create & save hibernation image, then go hibernated;
> d, S4 resume event happened, 2nd kernel starts normally and NMI watchdog is
> enabled on All cores;
> e, 2nd kernel find S4 image and try to restore S4 image;
> f, 2nd kernel disable non-boot CPUs, which would disable NMI watchdog for
> APs;
> g, Restore S4 image saved at step c;
> h, 1st-hibernated kernel restore, re-enable non-boot CPUs, as NMI watchdog
> is disabled in step b, this which would keep APs NMI watchdog disabled;
> Besides, the variable active_events is restored to zero;
> 
> But BSP NMI watchdog is still enabled, and the PMC will trigger NMI
> interrupt periodically.
> If PMC NMI triggered, perf_event_nmi_handler will be called, but it would
> see active_events is zero, so it goes out directly and return NMI_DONE;
> This then leads to unknown NMI messages.
> 
> static int
> perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs)
> {
>        u64 start_clock;
>        u64 finish_clock;
>        int ret;
> 
>        /*
>        * All PMUs/events that share this PMI handler should make sure to
>        * increment active_events for their events.
>        */
>        if (!atomic_read(&active_events))
>               return NMI_DONE;
> ......
> 
> It seems that the BSP does not refer to the settings of the NMI watchdog sys
> interface previously saved to the S4 image to configure the NMI watchdog
> when doing S4 resume.
> Should consider this situation and patch it?

Yes, please.

The watchdog driver should get suspend/resume hooks, and probably do
same init on boot and on resume.

Best regards,

								Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2024-07-25  8:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-25  2:31 Tony W Wang-oc
2024-07-25  8:27 ` Pavel Machek [this message]
2024-07-26 11:35   ` Tony W Wang-oc

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=ZqIMWDWn5W9+9RMA@duo.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=CobeChen@zhaoxin.com \
    --cc=Felixzhang@zhaoxin.com \
    --cc=LindaChai@zhaoxin.com \
    --cc=SilviaZhao@zhaoxin.com \
    --cc=TimGuo@zhaoxin.com \
    --cc=TonyWWang-oc@zhaoxin.com \
    --cc=akpm@linux-foundation.org \
    --cc=dianders@chromium.org \
    --cc=j.granados@samsung.com \
    --cc=kjlx@templeofstupid.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=liusong@linux.alibaba.com \
    --cc=lizhe.67@bytedance.com \
    --cc=rafael@kernel.org \
    --cc=song@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=yaoma@linux.alibaba.com \
    /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®