From: Dave Jones <davej@redhat.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: zheng.z.yan@intel.com, ak@linux.intel.com, peterz@infradead.org,
eranian@google.com
Subject: Re: perf/x86/intel/uncore: Add Haswell-EP uncore support
Date: Tue, 25 Nov 2014 18:20:50 -0500 [thread overview]
Message-ID: <20141125232050.GA9408@redhat.com> (raw)
In-Reply-To: <20141013152950.11DE26610F1@gitolite.kernel.org>
> 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
next parent reply other threads:[~2014-11-25 23:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20141013152950.11DE26610F1@gitolite.kernel.org>
2014-11-25 23:20 ` Dave Jones [this message]
2014-11-26 14:14 ` perf/x86/intel/uncore: Add Haswell-EP uncore support Andi Kleen
2014-11-26 15:26 ` Dave Jones
2014-11-27 19:49 ` Andi Kleen
2014-11-27 22:30 ` Thomas Gleixner
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=20141125232050.GA9408@redhat.com \
--to=davej@redhat.com \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=zheng.z.yan@intel.com \
/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 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.