* [bug report] KVM: arm64: Relax invariance of KVM_ARM_VCPU_POWER_OFF
@ 2023-06-22 12:49 Dan Carpenter
2023-06-22 17:20 ` Oliver Upton
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-06-22 12:49 UTC (permalink / raw)
To: oliver.upton; +Cc: kvmarm
Hello Oliver Upton,
The patch e3c1c0cae31e: "KVM: arm64: Relax invariance of
KVM_ARM_VCPU_POWER_OFF" from Jun 9, 2023, leads to the following
Smatch static checker warning:
arch/arm64/kvm/arm.c:1283 kvm_arch_vcpu_ioctl_vcpu_init()
warn: bitwise AND condition is false here
arch/arm64/kvm/arm.c
1272 static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
1273 struct kvm_vcpu_init *init)
1274 {
1275 bool power_off = false;
1276 int ret;
1277
1278 /*
1279 * Treat the power-off vCPU feature as ephemeral. Clear the bit to avoid
1280 * reflecting it in the finalized feature set, thus limiting its scope
1281 * to a single KVM_ARM_VCPU_INIT call.
1282 */
--> 1283 if (init->features[0] & KVM_ARM_VCPU_POWER_OFF) {
Prior to this commit KVM_ARM_VCPU_POWER_OFF was a bit number. I think
it still should be. As in:
#define KVM_ARM_VCPU_POWER_OFF BIT(0)
1284 init->features[0] &= ~KVM_ARM_VCPU_POWER_OFF;
1285 power_off = true;
1286 }
1287
1288 ret = kvm_vcpu_set_target(vcpu, init);
1289 if (ret)
1290 return ret;
1291
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] KVM: arm64: Relax invariance of KVM_ARM_VCPU_POWER_OFF
2023-06-22 12:49 [bug report] KVM: arm64: Relax invariance of KVM_ARM_VCPU_POWER_OFF Dan Carpenter
@ 2023-06-22 17:20 ` Oliver Upton
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Upton @ 2023-06-22 17:20 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kvmarm
Hey Dan,
On Thu, Jun 22, 2023 at 03:49:18PM +0300, Dan Carpenter wrote:
> Hello Oliver Upton,
>
> The patch e3c1c0cae31e: "KVM: arm64: Relax invariance of
> KVM_ARM_VCPU_POWER_OFF" from Jun 9, 2023, leads to the following
> Smatch static checker warning:
>
> arch/arm64/kvm/arm.c:1283 kvm_arch_vcpu_ioctl_vcpu_init()
> warn: bitwise AND condition is false here
>
> arch/arm64/kvm/arm.c
> 1272 static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
> 1273 struct kvm_vcpu_init *init)
> 1274 {
> 1275 bool power_off = false;
> 1276 int ret;
> 1277
> 1278 /*
> 1279 * Treat the power-off vCPU feature as ephemeral. Clear the bit to avoid
> 1280 * reflecting it in the finalized feature set, thus limiting its scope
> 1281 * to a single KVM_ARM_VCPU_INIT call.
> 1282 */
> --> 1283 if (init->features[0] & KVM_ARM_VCPU_POWER_OFF) {
>
> Prior to this commit KVM_ARM_VCPU_POWER_OFF was a bit number. I think
> it still should be. As in:
>
> #define KVM_ARM_VCPU_POWER_OFF BIT(0)
>
> 1284 init->features[0] &= ~KVM_ARM_VCPU_POWER_OFF;
> 1285 power_off = true;
> 1286 }
> 1287
> 1288 ret = kvm_vcpu_set_target(vcpu, init);
> 1289 if (ret)
> 1290 return ret;
> 1291
Thanks for the bug report. I had to go find my brown paper bag, but the
fix is now queued up for 6.5:
https://lore.kernel.org/kvmarm/20230622160922.1925530-1-oliver.upton@linux.dev/
--
Thanks,
Oliver
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-22 17:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-22 12:49 [bug report] KVM: arm64: Relax invariance of KVM_ARM_VCPU_POWER_OFF Dan Carpenter
2023-06-22 17:20 ` Oliver Upton
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.