From: Christoffer Dall <christoffer.dall@linaro.org>
To: Will Deacon <will.deacon@arm.com>
Cc: marc.zyngier@arm.com, kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org, shannon.zhao@linaro.org
Subject: Re: [PATCH] arm64: KVM: Add braces to multi-line if statement in virtual PMU code
Date: Fri, 1 Apr 2016 13:30:40 +0200 [thread overview]
Message-ID: <20160401113040.GD20224@cbox> (raw)
In-Reply-To: <1459509142-13524-1-git-send-email-will.deacon@arm.com>
On Fri, Apr 01, 2016 at 12:12:22PM +0100, Will Deacon wrote:
> The kernel is written in C, not python, so we need braces around
> multi-line if statements. GCC 6 actually warns about this, thanks to the
> fantastic new "-Wmisleading-indentation" flag:
We should rewrite the kernel in python!
>
> | virt/kvm/arm/pmu.c: In function ‘kvm_pmu_overflow_status’:
> | virt/kvm/arm/pmu.c:198:3: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
> | reg &= vcpu_sys_reg(vcpu, PMCNTENSET_EL0);
> | ^~~
> | arch/arm64/kvm/../../../virt/kvm/arm/pmu.c:196:2: note: ...this ‘if’ clause, but it is not
> | if ((vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E))
> | ^~
>
> As it turns out, this particular case is harmless (we just do some &=
> operations with 0), but worth fixing nonetheless.
>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
Thanks for the patch.
-Christoffer
> ---
> virt/kvm/arm/pmu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/virt/kvm/arm/pmu.c b/virt/kvm/arm/pmu.c
> index b5754c6c5508..575c7aa30d7e 100644
> --- a/virt/kvm/arm/pmu.c
> +++ b/virt/kvm/arm/pmu.c
> @@ -193,11 +193,12 @@ static u64 kvm_pmu_overflow_status(struct kvm_vcpu *vcpu)
> {
> u64 reg = 0;
>
> - if ((vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E))
> + if ((vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E)) {
> reg = vcpu_sys_reg(vcpu, PMOVSSET_EL0);
> reg &= vcpu_sys_reg(vcpu, PMCNTENSET_EL0);
> reg &= vcpu_sys_reg(vcpu, PMINTENSET_EL1);
> reg &= kvm_pmu_valid_counter_mask(vcpu);
> + }
>
> return reg;
> }
> --
> 2.1.4
>
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
WARNING: multiple messages have this Message-ID (diff)
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: KVM: Add braces to multi-line if statement in virtual PMU code
Date: Fri, 1 Apr 2016 13:30:40 +0200 [thread overview]
Message-ID: <20160401113040.GD20224@cbox> (raw)
In-Reply-To: <1459509142-13524-1-git-send-email-will.deacon@arm.com>
On Fri, Apr 01, 2016 at 12:12:22PM +0100, Will Deacon wrote:
> The kernel is written in C, not python, so we need braces around
> multi-line if statements. GCC 6 actually warns about this, thanks to the
> fantastic new "-Wmisleading-indentation" flag:
We should rewrite the kernel in python!
>
> | virt/kvm/arm/pmu.c: In function ?kvm_pmu_overflow_status?:
> | virt/kvm/arm/pmu.c:198:3: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
> | reg &= vcpu_sys_reg(vcpu, PMCNTENSET_EL0);
> | ^~~
> | arch/arm64/kvm/../../../virt/kvm/arm/pmu.c:196:2: note: ...this ?if? clause, but it is not
> | if ((vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E))
> | ^~
>
> As it turns out, this particular case is harmless (we just do some &=
> operations with 0), but worth fixing nonetheless.
>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
Thanks for the patch.
-Christoffer
> ---
> virt/kvm/arm/pmu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/virt/kvm/arm/pmu.c b/virt/kvm/arm/pmu.c
> index b5754c6c5508..575c7aa30d7e 100644
> --- a/virt/kvm/arm/pmu.c
> +++ b/virt/kvm/arm/pmu.c
> @@ -193,11 +193,12 @@ static u64 kvm_pmu_overflow_status(struct kvm_vcpu *vcpu)
> {
> u64 reg = 0;
>
> - if ((vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E))
> + if ((vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E)) {
> reg = vcpu_sys_reg(vcpu, PMOVSSET_EL0);
> reg &= vcpu_sys_reg(vcpu, PMCNTENSET_EL0);
> reg &= vcpu_sys_reg(vcpu, PMINTENSET_EL1);
> reg &= kvm_pmu_valid_counter_mask(vcpu);
> + }
>
> return reg;
> }
> --
> 2.1.4
>
next prev parent reply other threads:[~2016-04-01 11:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-01 11:12 [PATCH] arm64: KVM: Add braces to multi-line if statement in virtual PMU code Will Deacon
2016-04-01 11:12 ` Will Deacon
2016-04-01 11:30 ` Christoffer Dall [this message]
2016-04-01 11:30 ` Christoffer Dall
2016-04-01 11:36 ` Will Deacon
2016-04-01 11:36 ` Will Deacon
2016-04-01 12:10 ` Christoffer Dall
2016-04-01 12:10 ` Christoffer Dall
2016-04-01 14:23 ` Shannon Zhao
2016-04-01 14:23 ` Shannon Zhao
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=20160401113040.GD20224@cbox \
--to=christoffer.dall@linaro.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=shannon.zhao@linaro.org \
--cc=will.deacon@arm.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.