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:	Tue, 28 Jun 2011 12:53:35 +0200
From:	Robert Richter <robert.richter@....com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
CC:	"linux-tip-commits@...r.kernel.org" 
	<linux-tip-commits@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"hpa@...or.com" <hpa@...or.com>,
	"mingo@...hat.com" <mingo@...hat.com>,
	"francis.moro@...il.com" <francis.moro@...il.com>,
	"tglx@...utronix.de" <tglx@...utronix.de>,
	"mingo@...e.hu" <mingo@...e.hu>
Subject: Re: [tip:perf/core] perf: Ignore non-sampling overflows

On 26.11.10 10:04:56, tip-bot for Peter Zijlstra wrote:
> Commit-ID:  963988262c3c8f4234f64a0dde59446a295e07bb
> Gitweb:     http://git.kernel.org/tip/963988262c3c8f4234f64a0dde59446a295e07bb
> Author:     Peter Zijlstra <a.p.zijlstra@...llo.nl>
> AuthorDate: Wed, 24 Nov 2010 18:55:29 +0100
> Committer:  Ingo Molnar <mingo@...e.hu>
> CommitDate: Fri, 26 Nov 2010 15:14:55 +0100
> 
> perf: Ignore non-sampling overflows
> 
> Some arch implementations call perf_event_overflow() by 'accident',
> ignore this.
> 
> Reported-by: Francis Moreau <francis.moro@...il.com>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@...e.hu>
> ---
>  kernel/perf_event.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index 98c5549..af1e63f 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -4240,6 +4240,13 @@ static int __perf_event_overflow(struct perf_event *event, int nmi,
>  	struct hw_perf_event *hwc = &event->hw;
>  	int ret = 0;
>  
> +	/*
> +	 * Non-sampling counters might still use the PMI to fold short
> +	 * hardware counters, ignore those.
> +	 */
> +	if (unlikely(!is_sampling_event(event)))
> +		return 0;
> +

Peter,

do you remember the background of this change. This check silently
drops data of non-sampling events. I want to use perf_event_overflow()
to write to the buffer and want to modify the check, but don't see
which 'accidentally' interrupts may occur that must be ignored.

I was thinking of modifying the check to something like:

static inline bool is_sampling_event(struct perf_event *event)
{
        return event->attr.sample_type != 0;
}

or

	if (unlikely(!is_sampling_event(event) && !event->attr.sample_type))
		...

Thanks,

-Robert

>  	if (!throttle) {
>  		hwc->interrupts++;
>  	} else {
> --
> 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/
> 

-- 
Advanced Micro Devices, Inc.
Operating System Research Center

--
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