Linux Perf Users
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@amd.com>
To: <sashiko-reviews@lists.linux.dev>
Cc: <linux-perf-users@vger.kernel.org>,
	Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH 3/3] perf/amd/ibs: Simplify event state handling with IBS_CAPS_DIS
Date: Thu, 15 Oct 2026 12:19:39 +0530	[thread overview]
Message-ID: <b65d8983-aedc-46c3-986c-6353b56e472f@amd.com> (raw)
In-Reply-To: <sashiko-outbox-172339@kernel.org>

>> +     if (ibs_caps & IBS_CAPS_DIS) {
>> +             /*
>> +              *      IBS HW                     SW
>> +              *
>> +              *  o Capture sample       o ->stop()
>> +              *  o Set VAL bit            CTL2[Dis] = 1
>> +              *  o Raise NMI --.        o ...
>> +              *                 \       o ->start()
>> +              *                  \        wrmsr(IBS_{FETCH|OP}_CTL, new value);
>> +              *                   \       (wrmsr clears the VAL bit)
>> +              *                    `--> o Receives delayed NMI
>> +              *                           (Unknown NMI since VAL bit is cleared)
>> +              *
>> +              * Handle this with induced delay.
>> +              */
>> +             rdmsrq(hwc->config_base, ctl);
>> +             while ((ctl & perf_ibs->valid_mask) && delay--) {
>> +                     udelay(1);
>> +                     rdmsrq(hwc->config_base, ctl);
>> +             }
> 
> [Severity: High]
> What happens if the delayed NMI takes longer than 50us to arrive, for
> example due to hypervisor scheduling, nested virtualization, or SMIs?
> 
> If this delay loop expires, the code proceeds to call
> perf_ibs_enable_event() which clears the VAL and CTL2[Dis] bits. When the
> delayed NMI eventually arrives, it appears it will be treated as an
> unhandled NMI.

A delay exceeding 50us is highly unlikely in practice, and even if it
occurs, the consequence is "Unknown NMI", which is not fatal.

Thanks,
Ravi

      reply	other threads:[~2026-10-15  6:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  6:04 [PATCH 0/3] perf/amd/ibs: Assorted fixes Ravi Bangoria
2026-10-15  6:04 ` [PATCH 1/3] perf/amd/ibs: Reset CPU0 IBS state on syscore resume Ravi Bangoria
2026-10-15  6:15   ` sashiko-bot
2026-10-15  6:04 ` [PATCH 2/3] perf/amd/ibs: Fix kernel address leak via REGS_USER Ravi Bangoria
2026-10-15  6:13   ` sashiko-bot
2026-10-15  6:04 ` [PATCH 3/3] perf/amd/ibs: Simplify event state handling with IBS_CAPS_DIS Ravi Bangoria
2026-10-15  6:24   ` sashiko-bot
2026-10-15  6:49     ` Ravi Bangoria [this message]

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=b65d8983-aedc-46c3-986c-6353b56e472f@amd.com \
    --to=ravi.bangoria@amd.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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