lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 16 Dec 2013 13:00:36 +0200
From:	Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
	Namhyung Kim <namhyung@...il.com>,
	Paul Mackerras <paulus@...ba.org>,
	Stephane Eranian <eranian@...gle.com>,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v0 01/71] perf: Disable all pmus on unthrottling and rescheduling

Peter Zijlstra <peterz@...radead.org> writes:

> On Wed, Dec 11, 2013 at 02:36:13PM +0200, Alexander Shishkin wrote:
>> Currently, only one pmu in a context gets disabled during unthrottling
>> and event_sched_{out,in}, however, events in one context may belong to
>> different pmus, which results in pmus being reprogrammed while they are
>> still enabled. This patch temporarily disables pmus that correspond to
>> each event in the context while these events are being modified.
>> 
>> Signed-off-by: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
>> ---
>>  kernel/events/core.c | 27 ++++++++++++++++++++++++---
>>  1 file changed, 24 insertions(+), 3 deletions(-)
>> 
>> diff --git a/kernel/events/core.c b/kernel/events/core.c
>> index 403b781..d656cd6 100644
>> --- a/kernel/events/core.c
>> +++ b/kernel/events/core.c
>> @@ -1396,6 +1396,9 @@ event_sched_out(struct perf_event *event,
>>  	if (event->state != PERF_EVENT_STATE_ACTIVE)
>>  		return;
>>  
>> +	if (event->pmu != ctx->pmu)
>> +		perf_pmu_disable(event->pmu);
>> +
>>  	event->state = PERF_EVENT_STATE_INACTIVE;
>>  	if (event->pending_disable) {
>>  		event->pending_disable = 0;
>> @@ -1412,6 +1415,9 @@ event_sched_out(struct perf_event *event,
>>  		ctx->nr_freq--;
>>  	if (event->attr.exclusive || !cpuctx->active_oncpu)
>>  		cpuctx->exclusive = 0;
>> +
>> +	if (event->pmu != ctx->pmu)
>> +		perf_pmu_enable(event->pmu);
>>  }
>>  
>>  static void
>
> Hmm, indeed. Does it make sense to drop the conditional?
> perf_pmu_{en,dis}able() is recursive and the thinking is that if its the
> same PMU the cacheline is hot because we touched it already recently
> anyway, so the unconditional inc/dec might actually be faster.. dunno.

Well, given the disable_count check in perf_pmu_{en,dis}able, this one
indeed looks redundant to me. Should I resend this one separately?

Regards,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ