All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] perf/x86/intel: Add INST_RETIRED.ALL workarounds
@ 2018-03-15  9:03 Dan Carpenter
  2018-03-15  9:30 ` Walter Harms
  2018-03-16 14:54 ` Andi Kleen
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-03-15  9:03 UTC (permalink / raw)
  To: kernel-janitors

Hello Andi Kleen,

The patch 294fe0f52a44: "perf/x86/intel: Add INST_RETIRED.ALL
workarounds" from Feb 17, 2015, leads to the following static checker
warning:

	arch/x86/events/intel/core.c:3213 bdw_limit_period()
	warn: was expecting a 64 bit value instead of '63'

arch/x86/events/intel/core.c
  3207  static u64 bdw_limit_period(struct perf_event *event, u64 left)
                                                              ^^^^^^^^
  3208  {
  3209          if ((event->hw.config & INTEL_ARCH_EVENT_MASK) =
  3210                          X86_CONFIG(.event=0xc0, .umask=0x01)) {
  3211                  if (left < 128)
  3212                          left = 128;
  3213                  left &= ~0x3fu;
                        ^^^^^^^^^^^^^^
You're clearing the high 32 bits as well as the low 6.  It should be
~0x3full.

  3214          }
  3215          return left;
  3216  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] perf/x86/intel: Add INST_RETIRED.ALL workarounds
  2018-03-15  9:03 [bug report] perf/x86/intel: Add INST_RETIRED.ALL workarounds Dan Carpenter
@ 2018-03-15  9:30 ` Walter Harms
  2018-03-16 14:54 ` Andi Kleen
  1 sibling, 0 replies; 3+ messages in thread
From: Walter Harms @ 2018-03-15  9:30 UTC (permalink / raw)
  To: kernel-janitors

Am 15.03.2018 10:03, schrieb Dan Carpenter:
> Hello Andi Kleen,
> 
> The patch 294fe0f52a44: "perf/x86/intel: Add INST_RETIRED.ALL
> workarounds" from Feb 17, 2015, leads to the following static checker
> warning:
> 
> 	arch/x86/events/intel/core.c:3213 bdw_limit_period()
> 	warn: was expecting a 64 bit value instead of '63'
> 
> arch/x86/events/intel/core.c
>   3207  static u64 bdw_limit_period(struct perf_event *event, u64 left)
>                                                               ^^^^^^^^
>   3208  {
>   3209          if ((event->hw.config & INTEL_ARCH_EVENT_MASK) =
>   3210                          X86_CONFIG(.event=0xc0, .umask=0x01)) {
>   3211                  if (left < 128)
>   3212                          left = 128;
>   3213                  left &= ~0x3fu;
>                         ^^^^^^^^^^^^^^
> You're clearing the high 32 bits as well as the low 6.  It should be
> ~0x3full.

please use 0x3fULL
i tend to read 0x3full as 0x3"full" i guess others will have the same problem
and it is common practise to use uppercase characters.

just my 2 cents,

re
 wh 

> 
>   3214          }
>   3215          return left;
>   3216  }
> 
> regards,
> dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] perf/x86/intel: Add INST_RETIRED.ALL workarounds
  2018-03-15  9:03 [bug report] perf/x86/intel: Add INST_RETIRED.ALL workarounds Dan Carpenter
  2018-03-15  9:30 ` Walter Harms
@ 2018-03-16 14:54 ` Andi Kleen
  1 sibling, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2018-03-16 14:54 UTC (permalink / raw)
  To: kernel-janitors

On Thu, Mar 15, 2018 at 12:03:46PM +0300, Dan Carpenter wrote:
> Hello Andi Kleen,
> 
> The patch 294fe0f52a44: "perf/x86/intel: Add INST_RETIRED.ALL
> workarounds" from Feb 17, 2015, leads to the following static checker
> warning:
> 
> 	arch/x86/events/intel/core.c:3213 bdw_limit_period()
> 	warn: was expecting a 64 bit value instead of '63'
> 
> arch/x86/events/intel/core.c
>   3207  static u64 bdw_limit_period(struct perf_event *event, u64 left)
>                                                               ^^^^^^^^
>   3208  {
>   3209          if ((event->hw.config & INTEL_ARCH_EVENT_MASK) =
>   3210                          X86_CONFIG(.event=0xc0, .umask=0x01)) {
>   3211                  if (left < 128)
>   3212                          left = 128;
>   3213                  left &= ~0x3fu;
>                         ^^^^^^^^^^^^^^
> You're clearing the high 32 bits as well as the low 6.  It should be
> ~0x3full.

Thanks. Looks good.

Please submit the patch. I don't think it will make much difference
in practice though because periods are rarely >32bit.

-Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-16 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-15  9:03 [bug report] perf/x86/intel: Add INST_RETIRED.ALL workarounds Dan Carpenter
2018-03-15  9:30 ` Walter Harms
2018-03-16 14:54 ` Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.