[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230119155800.fiypvvzoalnfavse@linux.intel.com>
Date: Thu, 19 Jan 2023 23:58:00 +0800
From: Yu Zhang <yu.c.zhang@...ux.intel.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
seanjc@...gle.com, Michal Luczaj <mhal@...x.co>,
David Woodhouse <dwmw@...zon.co.uk>
Subject: Re: [PATCH] KVM: x86: fix deadlock for KVM_XEN_EVTCHN_RESET
Hi Paolo,
> diff --git a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
> index 721f6a693799..dae510c263b4 100644
> --- a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
> +++ b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
> @@ -962,6 +962,12 @@ int main(int argc, char *argv[])
> }
>
> done:
> + struct kvm_xen_hvm_attr evt_reset = {
> + .type = KVM_XEN_ATTR_TYPE_EVTCHN,
> + .u.evtchn.flags = KVM_XEN_EVTCHN_RESET,
> + };
> + vm_ioctl(vm, KVM_XEN_HVM_SET_ATTR, &evt_reset);
> +
> alarm(0);
> clock_gettime(CLOCK_REALTIME, &max_ts);
>
This change generates a build failure with error message:
"error: a label can only be part of a statement and a declaration is not a statement".
Moving the definition of evt_reset to the beginning of main() can fix it:
diff --git a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
index dae510c263b4..d71f1508bb21 100644
--- a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
+++ b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
@@ -623,6 +623,10 @@ int main(int argc, char *argv[])
rs->state = 0x5a;
bool evtchn_irq_expected = false;
+ struct kvm_xen_hvm_attr evt_reset = {
+ .type = KVM_XEN_ATTR_TYPE_EVTCHN,
+ .u.evtchn.flags = KVM_XEN_EVTCHN_RESET,
+ };
for (;;) {
volatile struct kvm_run *run = vcpu->run;
@@ -962,10 +966,6 @@ int main(int argc, char *argv[])
}
done:
- struct kvm_xen_hvm_attr evt_reset = {
- .type = KVM_XEN_ATTR_TYPE_EVTCHN,
- .u.evtchn.flags = KVM_XEN_EVTCHN_RESET,
- };
vm_ioctl(vm, KVM_XEN_HVM_SET_ATTR, &evt_reset);
alarm(0);
B.R.
Yu
Powered by blists - more mailing lists