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, 19 May 2014 17:01:43 +0100
From:	Will Deacon <will.deacon@....com>
To:	Vince Weaver <vincent.weaver@...ne.edu>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH 1/3] perf: disable sampled events if no PMU interrupt

On Fri, May 16, 2014 at 10:12:12PM +0100, Vince Weaver wrote:
> 
> Add common code to generate ENOTSUPP at event creation time if an 
> architecture attempts to create a sampled event and PERF_PMU_NO_INTERRUPT
> is set.
> 
> This adds a new pmu->capabilities flag.  
> Initially we only support PERF_PMU_NO_INTERRUPT (to indicate a PMU
> has no support for generating hardware interrupts) but there are 
> other capabilities that can be added later.
> 
> Signed-off-by: Vince Weaver <vincent.weaver@...ne.edu>
> 
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 3356abc..2164763 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -251,9 +251,20 @@ struct pmu {
>  	 * flush branch stack on context-switches (needed in cpu-wide mode)
>  	 */
>  	void (*flush_branch_stack)	(void);
> +
> +	/*
> +	 * various common per-pmu feature flags
> +	 */
> +	int capabilities;

Move this to the top of the struct, along with the other data fields?

Anyway, this looks really useful to me and I'd really like to use it for
ARM!

 Acked-by: Will Deacon <will.deacon@....com>

Will


> +
>  };
>  
>  /**
> + * struct pmu->capabilites flags
> + */
> +#define PERF_PMU_NO_INTERRUPT		1
> +
> +/**
>   * enum perf_event_active_state - the states of a event
>   */
>  enum perf_event_active_state {
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index f83a71a..f5d8554 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -7072,6 +7072,13 @@ SYSCALL_DEFINE5(perf_event_open,
>  		}
>  	}
>  
> +	if (is_sampling_event(event)) {
> +		if (event->pmu->capabilities & PERF_PMU_NO_INTERRUPT) {
> +			err = -ENOTSUPP;
> +			goto err_alloc;
> +		}
> +	}
> +
>  	account_event(event);
>  
>  	/*
> 
--
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