Re: [PATCH v7 1/7] perf/amd/iommu: Misc fix up perf_iommu_read

From: Borislav Petkov
Date: Wed Jan 11 2017 - 05:32:48 EST


On Mon, Jan 09, 2017 at 09:33:41PM -0600, Suravee Suthikulpanit wrote:
> This patch contains the following minor fixup:

For the future: never say "this patch" in the commit message - just
explain *why* the patch is needed.

> * Fixed overflow handling since u64 delta would lose the MSB sign bit.

Past tense also reads funnily: "Fix overflow handling ..." sounds much
better.

> * Remove unnecessary local64_set().

But you don't remove it - you add it. Huh?

> * Coding style and make use of GENMASK_ULL macro.
>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
> ---
> arch/x86/events/amd/iommu.c | 25 +++++++++++++------------
> 1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
> index b28200d..f387baf 100644
> --- a/arch/x86/events/amd/iommu.c
> +++ b/arch/x86/events/amd/iommu.c
> @@ -319,29 +319,30 @@ 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 cnt, prev;

"count" was fine.

> + s64 delta;
> struct hw_perf_event *hwc = &event->hw;
> pr_debug("perf: amd_iommu:perf_iommu_read\n");

...

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.