public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	John Sperbeck <jsperbeck@google.com>,
	"Lendacky, Thomas" <Thomas.Lendacky@amd.com>
Subject: Re: [RFC] perf/x86: Fix a warning on x86_pmu_stop()
Date: Tue, 24 Nov 2020 09:09:51 +0100	[thread overview]
Message-ID: <20201124080951.GE2414@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CAM9d7cji+M+qVm4g48Jcgnfjm-=3HVVtv49ntDpksQx8aBdSyQ@mail.gmail.com>

On Tue, Nov 24, 2020 at 02:01:39PM +0900, Namhyung Kim wrote:

> Yes, it's not about __intel_pmu_pebs_event().  I'm looking at
> intel_pmu_drain_pebs_nhm() specifically.  There's code like
> 
>         /* log dropped samples number */
>         if (error[bit]) {
>             perf_log_lost_samples(event, error[bit]);
> 
>             if (perf_event_account_interrupt(event))
>                 x86_pmu_stop(event, 0);
>         }
> 
>         if (counts[bit]) {
>             __intel_pmu_pebs_event(event, iregs, base,
>                            top, bit, counts[bit],
>                            setup_pebs_fixed_sample_data);
>         }
> 
> There's a path to x86_pmu_stop() when an error bit is on.

That would seem to suggest you try something like this:

diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index 31b9e58b03fe..8c6ee8be8b6e 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -1945,7 +1945,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs, struct perf_sample_d
 		if (error[bit]) {
 			perf_log_lost_samples(event, error[bit]);
 
-			if (perf_event_account_interrupt(event))
+			if (iregs && perf_event_account_interrupt(event))
 				x86_pmu_stop(event, 0);
 		}
 

  reply	other threads:[~2020-11-24  8:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-21  2:50 [RFC] perf/x86: Fix a warning on x86_pmu_stop() Namhyung Kim
2020-11-23 14:23 ` Peter Zijlstra
2020-11-24  5:01   ` Namhyung Kim
2020-11-24  8:09     ` Peter Zijlstra [this message]
2020-11-24  8:19       ` Stephane Eranian
2020-11-25  7:36         ` Peter Zijlstra
2020-11-25  7:22       ` Namhyung Kim

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=20201124080951.GE2414@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Thomas.Lendacky@amd.com \
    --cc=bp@alien8.de \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jsperbeck@google.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --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