mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org, acme@kernel.org,
	tglx@linutronix.de, jolsa@redhat.com, eranian@google.com,
	ak@linux.intel.com
Subject: Re: [PATCH V4 1/5] perf/x86/intel: Fix event update for auto-reload
Date: Wed, 21 Feb 2018 08:43:47 -0500	[thread overview]
Message-ID: <cac32cb6-e99a-2df7-e756-0498cf06598d@linux.intel.com> (raw)
In-Reply-To: <20180221103247.GL25181@hirez.programming.kicks-ass.net>



On 2/21/2018 5:32 AM, Peter Zijlstra wrote:
> On Mon, Feb 12, 2018 at 02:20:31PM -0800, kan.liang@linux.intel.com wrote:
>> @@ -1389,8 +1456,22 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
>>   
>>   	ds->pebs_index = ds->pebs_buffer_base;
>>   
>> -	if (unlikely(base >= top))
>> +	if (unlikely(base >= top)) {
>> +		/*
>> +		 * The drain_pebs() could be called twice in a short period
>> +		 * for auto-reload event in pmu::read(). There are no
>> +		 * overflows have happened in between.
>> +		 * It needs to call intel_pmu_save_and_restart_reload() to
>> +		 * update the event->count for this case.
>> +		 */
>> +		for_each_set_bit(bit, (unsigned long *)&cpuc->pebs_enabled,
>> +				 x86_pmu.max_pebs_events) {
>> +			event = cpuc->events[bit];
>> +			if (event->hw.flags & PERF_X86_EVENT_AUTO_RELOAD)
>> +				intel_pmu_save_and_restart_reload(event, 0);
>> +		}
>>   		return;
>> +	}
>>   
>>   	for (at = base; at < top; at += x86_pmu.pebs_record_size) {
>>   		struct pebs_record_nhm *p = at;
> 
> Is there a reason you didn't do intel_pmu_drain_pebs_core() ?
>

Right, I forgot that the drain_pebs_core() also has auto_reload support.
Sorry for that.
I will re-send all patches.

Thanks,
Kan

> 
> --- a/arch/x86/events/intel/ds.c
> +++ b/arch/x86/events/intel/ds.c
> @@ -1435,8 +1435,11 @@ static void intel_pmu_drain_pebs_core(st
>   		return;
>   
>   	n = top - at;
> -	if (n <= 0)
> +	if (n <= 0) {
> +		if (event->hw.flags & PERF_X86_EVENT_AUTO_RELOAD)
> +			intel_pmu_save_and_restart_reload(event, 0);
>   		return;
> +	}
>   
>   	__intel_pmu_pebs_event(event, iregs, at, top, 0, n);
>   }
> 

  reply	other threads:[~2018-02-21 13:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 22:20 [PATCH V4 0/5] bugs fix for auto-reload mmap read and rdpmc read kan.liang
2018-02-12 22:20 ` [PATCH V4 1/5] perf/x86/intel: Fix event update for auto-reload kan.liang
2018-02-17  6:21   ` [perf/x86/intel] 41e062cd2e: WARNING:at_arch/x86/events/intel/ds.c:#intel_pmu_save_and_restart_reload kernel test robot
2018-02-19 12:44     ` Peter Zijlstra
2018-02-20 18:59       ` Liang, Kan
2018-03-09  9:08         ` [tip:perf/core] perf/x86/intel: Properly save/restore the PMU state in the NMI handler tip-bot for Kan Liang
2018-02-21 10:32   ` [PATCH V4 1/5] perf/x86/intel: Fix event update for auto-reload Peter Zijlstra
2018-02-21 13:43     ` Liang, Kan [this message]
2018-02-21 13:45       ` Peter Zijlstra
2018-03-09  9:08   ` [tip:perf/core] " tip-bot for Kan Liang
2018-02-12 22:20 ` [PATCH V4 2/5] perf/x86: Introduce read function for x86_pmu kan.liang
2018-03-09  9:09   ` [tip:perf/core] perf/x86: Introduce a ->read() callback in 'struct x86_pmu' tip-bot for Kan Liang
2018-02-12 22:20 ` [PATCH V4 3/5] perf/x86/intel/ds: Introduce read function for auto-reload event kan.liang
2018-03-09  9:09   ` [tip:perf/core] perf/x86/intel/ds: Introduce ->read() function for auto-reload events and flush the PEBS buffer there tip-bot for Kan Liang
2018-02-12 22:20 ` [PATCH V4 4/5] perf/x86/intel: Fix pmu read for auto-reload kan.liang
2018-03-09  9:10   ` [tip:perf/core] perf/x86/intel: Fix PMU " tip-bot for Kan Liang
2018-02-12 22:20 ` [PATCH V4 5/5] perf/x86: Fix: disable userspace RDPMC usage for large PEBS kan.liang
2018-03-09  9:10   ` [tip:perf/core] perf/x86/intel: Disable " tip-bot for Kan Liang
2018-03-09 14:31     ` Vince Weaver
2018-03-09 17:42       ` Peter Zijlstra
2018-03-09 18:53         ` Liang, Kan
2018-03-09 19:10         ` Vince Weaver
2018-03-12 14:08           ` Liang, Kan
2018-03-20 11:15   ` [tip:perf/urgent] " tip-bot for Kan Liang

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=cac32cb6-e99a-2df7-e756-0498cf06598d@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome