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: <20161024122639.GN3102@twins.programming.kicks-ass.net>
Date:   Mon, 24 Oct 2016 14:26:39 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Michael Ellerman <mpe@...erman.id.au>,
        Michael Neuling <mikey@...ling.org>,
        Paul Mackerras <paulus@...ba.org>,
        Jiri Olsa <jolsa@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jan Stancek <jstancek@...hat.com>
Subject: Re: [PATCHv2] perf powerpc: Don't call perf_event_disable from
 atomic context




On Thu, Oct 06, 2016 at 02:33:01PM +0200, Jiri Olsa wrote:
> diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
> index aec9a1b1d25b..4d3bcbbf626a 100644
> --- a/arch/powerpc/kernel/hw_breakpoint.c
> +++ b/arch/powerpc/kernel/hw_breakpoint.c
> @@ -275,7 +275,7 @@ int __kprobes hw_breakpoint_handler(struct die_args *args)
>  	if (!stepped) {
>  		WARN(1, "Unable to handle hardware breakpoint. Breakpoint at "
>  			"0x%lx will be disabled.", info->address);
> -		perf_event_disable(bp);
> +		perf_event_disable_inatomic(bp);
>  		goto out;
>  	}
>  	/*
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 5c5362584aba..c794fd84a595 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -1248,6 +1248,7 @@ extern u64 perf_swevent_set_period(struct perf_event *event);
>  extern void perf_event_enable(struct perf_event *event);
>  extern void perf_event_disable(struct perf_event *event);
>  extern void perf_event_disable_local(struct perf_event *event);
> +extern void perf_event_disable_inatomic(struct perf_event *event);
>  extern void perf_event_task_tick(void);
>  #else /* !CONFIG_PERF_EVENTS: */
>  static inline void *
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 7c0d263f6bc5..3d650ccf4def 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -1960,6 +1960,13 @@ void perf_event_disable(struct perf_event *event)
>  }
>  EXPORT_SYMBOL_GPL(perf_event_disable);
>  
> +void perf_event_disable_inatomic(struct perf_event *event)
> +{
> +	event->pending_kill    = POLL_HUP;
> +	event->pending_disable = 1;
> +	irq_work_queue(&event->pending);
> +}
> +
>  static void perf_set_shadow_time(struct perf_event *event,
>  				 struct perf_event_context *ctx,
>  				 u64 tstamp)
> @@ -7074,9 +7081,7 @@ static int __perf_event_overflow(struct perf_event *event,
>  	event->pending_kill = POLL_IN;
>  	if (events && atomic_dec_and_test(&event->event_limit)) {
>  		ret = 1;
> -		event->pending_kill = POLL_HUP;
> -		event->pending_disable = 1;
> -		irq_work_queue(&event->pending);
> +		perf_event_disable_inatomic(event);
>  	}
>  
>  	event->overflow_handler(event, data, regs);


I'm a wee bit confused on the event->pending_kill assignment in that
helper. AFAICT that's not actually used in the PPC case, and if for some
reason, pending_wakeup gets set, do we want to deliver a HUP? The old
code didn't do that.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ