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]
Message-ID: <20240802183841.GG37996@noisy.programming.kicks-ass.net>
Date: Fri, 2 Aug 2024 20:38:41 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: "Liang, Kan" <kan.liang@...ux.intel.com>
Cc: Namhyung Kim <namhyung@...nel.org>, Ingo Molnar <mingo@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Ravi Bangoria <ravi.bangoria@....com>,
	Stephane Eranian <eranian@...gle.com>,
	Ian Rogers <irogers@...gle.com>, Mingwei Zhang <mizhang@...gle.com>
Subject: Re: [PATCH v2] perf/core: Optimize event reschedule for a PMU

On Fri, Aug 02, 2024 at 02:30:19PM -0400, Liang, Kan wrote:
> > @@ -2792,7 +2833,14 @@ static int  __perf_install_in_context(void *info)
> >  	if (reprogram) {
> >  		ctx_sched_out(ctx, EVENT_TIME);
> >  		add_event_to_ctx(event, ctx);
> > -		ctx_resched(cpuctx, task_ctx, get_event_type(event));
> > +		if (ctx->nr_events == 1) {
> > +			/* The first event needs to set ctx->is_active. */
> > +			ctx_resched(cpuctx, task_ctx, NULL, get_event_type(event));
> > +		} else {
> > +			ctx_resched(cpuctx, task_ctx, event->pmu_ctx->pmu,
> > +				    get_event_type(event));
> > +			ctx_sched_in(ctx, EVENT_TIME);
> 
> The changelog doesn't mention the time difference much. As my
> understanding, the time is shared among PMUs in the same ctx.
> When perf does ctx_resched(), the time is deducted.
> There is no problem to stop and restart the global time when perf
> re-schedule all PMUs.
> But if only one PMU is re-scheduled while others are still running, it
> may be a problem to stop and restart the global time. Other PMUs will be
> impacted.

ctx_sched_in(EVENT_TIME) will onlt start time if it wasn't already
running. Also note that none of the sched_out calls have EVENT_TIME on.
So it will not stop time, only start time if if wasn't already running.

At the same time, that's likely only the case when nr_events==1, and in
that case it already calls the full fat version.

Anyway, this exception is part of the reason I don't like any of this
much. I'm staring to see if there's not something saner hiding inside
all this.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ