Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1562555
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v8 3/9] perf/amd/iommu: Misc fix up perf_iommu_read |
| Date | 2017-01-19 11:10 +0100 |
| Message-ID | <t1hPj-8P-9@gated-at.bofh.it> (permalink) |
| References | <t0E1A-mt-13@gated-at.bofh.it> <t1hPj-8P-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> Subject: Re: [PATCH v8 3/9] perf/amd/iommu: Misc fix up perf_iommu_read
Please be a bit more thorough when writing your commit messages. What is
a "misc fix up"? Perhaps it is ok for a quick'n'dirty local patch but
not when it is for upstream.
Also, function names end with "()" to denote they're functions.
On Mon, Jan 16, 2017 at 01:23:30AM -0600, Suravee Suthikulpanit wrote:
> * Fix overflow handling since u64 delta would lose the MSB sign bit.
> * Remove unnecessary local64_cmpxchg().
> * Coding style and make use of GENMASK_ULL macro.
That last one doesn't read like a sentence.
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Borislav Petkov <bp@alien8.de>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
> arch/x86/events/amd/iommu.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
> index 1aa25d8..3f1c18a 100644
> --- a/arch/x86/events/amd/iommu.c
> +++ b/arch/x86/events/amd/iommu.c
> @@ -320,9 +320,8 @@ static void perf_iommu_start(struct perf_event *event, int flags)
>
> static void perf_iommu_read(struct perf_event *event)
> {
> - u64 count = 0ULL;
> - u64 prev_raw_count = 0ULL;
> - u64 delta = 0ULL;
> + u64 count, prev;
> + s64 delta;
> struct hw_perf_event *hwc = &event->hw;
>
> amd_iommu_pc_get_set_reg_val(_GET_DEVID(event),
> @@ -330,18 +329,20 @@ static void perf_iommu_read(struct perf_event *event)
> IOMMU_PC_COUNTER_REG, &count, false);
>
> /* IOMMU pc counter register is only 48 bits */
> - count &= 0xFFFFFFFFFFFFULL;
> + count &= GENMASK_ULL(48, 0);
GENMASK_ULL(48, 0) gives 0x1ffffffffffff, however. Which is 49 bits.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH v8 3/9] perf/amd/iommu: Misc fix up perf_iommu_read Borislav Petkov <bp@alien8.de> - 2017-01-19 11:10 +0100
csiph-web