linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Kim Phillips <kim.phillips@amd.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org,
	Stephane Eranian <eranian@google.com>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] perf/x86/amd/ibs: Fix sample bias for dispatched micro-ops
Date: Wed, 28 Aug 2019 10:02:59 +0200	[thread overview]
Message-ID: <20190828080259.GM2332@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190826195730.30614-1-kim.phillips@amd.com>

On Mon, Aug 26, 2019 at 02:57:30PM -0500, Kim Phillips wrote:

> diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
> index 62f317c9113a..f2625b4a5a8b 100644
> --- a/arch/x86/events/amd/ibs.c
> +++ b/arch/x86/events/amd/ibs.c
> @@ -663,8 +663,15 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
>  out:
>  	if (throttle)
>  		perf_ibs_stop(event, 0);
> -	else
> -		perf_ibs_enable_event(perf_ibs, hwc, period >> 4);
> +	else {

Coding Style requires braces on both legs of a conditional.

> +		period >>= 4;
> +
> +		if ((ibs_caps & IBS_CAPS_RDWROPCNT) &&
> +		    (*config & IBS_OP_CNT_CTL))
> +			period |= *config & IBS_OP_CUR_CNT_RAND;
> +
> +		perf_ibs_enable_event(perf_ibs, hwc, period);
> +	}
>  
>  	perf_event_update_userpage(event);
>  
> diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
> index 1392d5e6e8d6..67d94696a1d6 100644
> --- a/arch/x86/include/asm/perf_event.h
> +++ b/arch/x86/include/asm/perf_event.h
> @@ -259,9 +259,12 @@ struct pebs_lbr {
>  #define IBS_FETCH_CNT		0xFFFF0000ULL
>  #define IBS_FETCH_MAX_CNT	0x0000FFFFULL
>  
> -/* ibs op bits/masks */
> -/* lower 4 bits of the current count are ignored: */
> -#define IBS_OP_CUR_CNT		(0xFFFF0ULL<<32)
> +/* ibs op bits/masks
> + * The lower 7 bits of the current count are random bits
> + * preloaded by hardware and ignored in software
> + */

Malformed comment style.

> +#define IBS_OP_CUR_CNT		(0xFFF80ULL<<32)
> +#define IBS_OP_CUR_CNT_RAND	(0x0007FULL<<32)
>  #define IBS_OP_CNT_CTL		(1ULL<<19)
>  #define IBS_OP_VAL		(1ULL<<18)
>  #define IBS_OP_ENABLE		(1ULL<<17)

Fixed up both issues and applied.

Thanks!

  reply	other threads:[~2019-08-28  8:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 19:57 [PATCH] perf/x86/amd/ibs: Fix sample bias for dispatched micro-ops Kim Phillips
2019-08-28  8:02 ` Peter Zijlstra [this message]
2019-08-31  9:06 ` [tip: perf/urgent] " tip-bot2 for Kim Phillips

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190828080259.GM2332@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=kim.phillips@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).