* Re: perf/x86/intel/uncore: Add Haswell-EP uncore support
[not found] <20141013152950.11DE26610F1@gitolite.kernel.org>
@ 2014-11-25 23:20 ` Dave Jones
2014-11-26 14:14 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Dave Jones @ 2014-11-25 23:20 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: zheng.z.yan, ak, peterz, eranian
> Commit: e735b9db12d76d45f74aee78bd63bbd2f8f480e1
> Author: Yan, Zheng <zheng.z.yan@intel.com>
> AuthorDate: Thu Sep 4 16:08:26 2014 -0700
> Committer: Ingo Molnar <mingo@kernel.org>
> CommitDate: Wed Sep 24 14:48:21 2014 +0200
>
> perf/x86/intel/uncore: Add Haswell-EP uncore support
This commit added some code which looks a bit fishy, and got flagged
by coverity in yesterdays scan.
There are a few cases like this :
> +static void hswep_cbox_enable_event(struct intel_uncore_box *box,
> + struct perf_event *event)
> +{
> + struct hw_perf_event *hwc = &event->hw;
> + struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
> +
> + if (reg1->idx != EXTRA_REG_NONE) {
> + u64 filter = uncore_shared_reg_config(box, 0);
> + wrmsrl(reg1->reg, filter & 0xffffffff);
> + wrmsrl(reg1->reg + 1, filter >> 32);
> + }
> +
> + wrmsrl(hwc->config_base, hwc->config | SNBEP_PMON_CTL_EN);
> +}
given the definition of wrmsrl ..
#define wrmsrl(msr, val) \
native_write_msr((msr), (u32)((u64)(val)), (u32)((u64)(val) >> 32))
We can see that coverity got upset because it realised that the
code is turned into constant expressions.
result_independent_of_operands: (u64)(filter & 4294967295U) >> 32 is 0
regardless of the values of its operands.
a function call.
result_independent_of_operands: (u64)(filter >> 32) >> 32 is 0
regardless of the values of its operands.
I couldn't quickly decipher which MSRs we're writing to here in the SDM,
but are these really 64-bit wide registers that need 32 bits always set to zero ?
I'm wondering if these should be just wrmsr's instead of wrmsrl's.
If someone more familiar with perf hw can let me know if this is safe,
I'll dismiss the reports in coverity.
thanks,
Dave
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: perf/x86/intel/uncore: Add Haswell-EP uncore support
2014-11-25 23:20 ` perf/x86/intel/uncore: Add Haswell-EP uncore support Dave Jones
@ 2014-11-26 14:14 ` Andi Kleen
2014-11-26 15:26 ` Dave Jones
0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2014-11-26 14:14 UTC (permalink / raw)
To: Dave Jones, Linux Kernel Mailing List, zheng.z.yan, peterz,
eranian
> I couldn't quickly decipher which MSRs we're writing to here in the SDM,
> but are these really 64-bit wide registers that need 32 bits always set to zero ?
Yes the filter MSRs are only 32bit.
> I'm wondering if these should be just wrmsr's instead of wrmsrl's.
Can we just shut up coverity please?
wrmsr() is stupid and error prone and should have never been added as an
interface.
-Andi
--
ak@linux.intel.com -- Speaking for myself only
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: perf/x86/intel/uncore: Add Haswell-EP uncore support
2014-11-26 14:14 ` Andi Kleen
@ 2014-11-26 15:26 ` Dave Jones
2014-11-27 19:49 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Dave Jones @ 2014-11-26 15:26 UTC (permalink / raw)
To: Andi Kleen; +Cc: Linux Kernel Mailing List, zheng.z.yan, peterz, eranian
On Wed, Nov 26, 2014 at 06:14:22AM -0800, Andi Kleen wrote:
> > I couldn't quickly decipher which MSRs we're writing to here in the SDM,
> > but are these really 64-bit wide registers that need 32 bits always set to zero ?
>
> Yes the filter MSRs are only 32bit.
thanks for checking.
> > I'm wondering if these should be just wrmsr's instead of wrmsrl's.
>
> Can we just shut up coverity please?
I can manually dismiss them, I don't think the checker has the
information to determine this for itself.
Dave
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: perf/x86/intel/uncore: Add Haswell-EP uncore support
2014-11-26 15:26 ` Dave Jones
@ 2014-11-27 19:49 ` Andi Kleen
2014-11-27 22:30 ` Thomas Gleixner
0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2014-11-27 19:49 UTC (permalink / raw)
To: Dave Jones, Linux Kernel Mailing List, zheng.z.yan, peterz,
eranian
> > > I'm wondering if these should be just wrmsr's instead of wrmsrl's.
> >
> > Can we just shut up coverity please?
>
> I can manually dismiss them, I don't think the checker has the
> information to determine this for itself.
I suspect my out of line MSR patchkit would fix the warning
as a side effect, because there would be a function call
inbetween and the function always gets full u64.
https://lkml.org/lkml/2014/10/10/376
So far it hasn't been reviewed. I'll keep reposting.
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: perf/x86/intel/uncore: Add Haswell-EP uncore support
2014-11-27 19:49 ` Andi Kleen
@ 2014-11-27 22:30 ` Thomas Gleixner
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2014-11-27 22:30 UTC (permalink / raw)
To: Andi Kleen
Cc: Dave Jones, Linux Kernel Mailing List, zheng.z.yan, peterz,
eranian
On Thu, 27 Nov 2014, Andi Kleen wrote:
> > > > I'm wondering if these should be just wrmsr's instead of wrmsrl's.
> > >
> > > Can we just shut up coverity please?
> >
> > I can manually dismiss them, I don't think the checker has the
> > information to determine this for itself.
>
> I suspect my out of line MSR patchkit would fix the warning
> as a side effect, because there would be a function call
> inbetween and the function always gets full u64.
>
> https://lkml.org/lkml/2014/10/10/376
>
> So far it hasn't been reviewed. I'll keep reposting.
And if you do so, can you please add a proper 0/n cover letter which
explains the scope of the series. I'm tired of wading through N
patches to figure out whether this is something I should care of or
not.
Thanks,
tglx
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-27 22:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20141013152950.11DE26610F1@gitolite.kernel.org>
2014-11-25 23:20 ` perf/x86/intel/uncore: Add Haswell-EP uncore support Dave Jones
2014-11-26 14:14 ` Andi Kleen
2014-11-26 15:26 ` Dave Jones
2014-11-27 19:49 ` Andi Kleen
2014-11-27 22:30 ` Thomas Gleixner
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).