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: <20191128083045.GB1209@krava>
Date:   Thu, 28 Nov 2019 09:30:45 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Song Liu <songliubraving@...com>
Cc:     linux-kernel@...r.kernel.org, kernel-team@...com, davidca@...com,
        Peter Zijlstra <peterz@...radead.org>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Alexey Budankov <alexey.budankov@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH v7] perf: Sharing PMU counters across compatible events

On Fri, Nov 15, 2019 at 03:55:04PM -0800, Song Liu wrote:

SNIP

>  		add_event_to_ctx(event, ctx);
>  	}
> @@ -2745,21 +2998,26 @@ static void __perf_event_enable(struct perf_event *event,
>  {
>  	struct perf_event *leader = event->group_leader;
>  	struct perf_event_context *task_ctx;
> +	int was_active;
> +	int event_type;
>  
>  	if (event->state >= PERF_EVENT_STATE_INACTIVE ||
>  	    event->state <= PERF_EVENT_STATE_ERROR)
>  		return;
>  
> +	event_type = perf_event_can_share(event) ? EVENT_ALL : EVENT_TIME;
> +	was_active = ctx->is_active;
>  	if (ctx->is_active)
> -		ctx_sched_out(ctx, cpuctx, EVENT_TIME);
> +		ctx_sched_out(ctx, cpuctx, event_type);

you're scheduling everything out in here, so cpuctx->task_ctx
will become NULL and trigger the check below

I dont think you need to do it here, ctx_resched will do that
for you later, this here is just to keep the time updated

jirka

>  
>  	perf_event_set_state(event, PERF_EVENT_STATE_INACTIVE);
> +	perf_event_setup_dup(event, ctx);
>  
> -	if (!ctx->is_active)
> +	if (!was_active)
>  		return;
>  
>  	if (!event_filter_match(event)) {
> -		ctx_sched_in(ctx, cpuctx, EVENT_TIME, current);
> +		ctx_sched_in(ctx, cpuctx, event_type, current);
>  		return;
>  	}
>  
> @@ -2767,8 +3025,8 @@ static void __perf_event_enable(struct perf_event *event,
>  	 * If the event is in a group and isn't the group leader,
>  	 * then don't put it on unless the group is on.
>  	 */
> -	if (leader != event && leader->state != PERF_EVENT_STATE_ACTIVE) {
> -		ctx_sched_in(ctx, cpuctx, EVENT_TIME, current);
> +	if (leader != event && leader->state <= PERF_EVENT_STATE_INACTIVE) {
> +		ctx_sched_in(ctx, cpuctx, event_type, current);
>  		return;
>  	}
>  
> @@ -2776,7 +3034,8 @@ static void __perf_event_enable(struct perf_event *event,
>  	if (ctx->task)
>  		WARN_ON_ONCE(task_ctx != ctx);
>  
> -	ctx_resched(cpuctx, task_ctx, get_event_type(event));
> +	/* if perf_event_can_share() resched EVENT_ALL */
> +	ctx_resched(cpuctx, task_ctx, get_event_type(event) | event_type);
>  }

SNIP

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ