Message ID | 20170423223240.17917-1-aurelien@aurel32.net |
---|---|
State | New |
Headers | show |
Hi Aurelien! Why don't lock inside s390_virtio_hypercall() directly round the diag500 dispatch call? regards, Phil. On 04/23/2017 07:32 PM, Aurelien Jarno wrote: > s390_virtio_hypercall can trigger IO events and interrupts, most notably > when using virtio-ccw devices. > > Reviewed-by: Alexander Graf <agraf@suse.de> > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> > --- > target/s390x/misc_helper.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c > index 4946b56ab3..aec737d707 100644 > --- a/target/s390x/misc_helper.c > +++ b/target/s390x/misc_helper.c > @@ -307,7 +307,9 @@ void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num) > switch (num) { > case 0x500: > /* KVM hypercall */ > + qemu_mutex_lock_iothread(); > r = s390_virtio_hypercall(env); > + qemu_mutex_unlock_iothread(); > break; > case 0x44: > /* yield */ >
On 2017-04-23 19:38, Philippe Mathieu-Daudé wrote: > Hi Aurelien! > > Why don't lock inside s390_virtio_hypercall() directly round the diag500 > dispatch call? s390_virtio_hypercall is shared between TCG and KVM. For KVM the lock is already done before calling s390_virtio_hypercall in kvm_arch_handle_exit.
On 04/23/2017 07:47 PM, Aurelien Jarno wrote: > On 2017-04-23 19:38, Philippe Mathieu-Daudé wrote: >> Hi Aurelien! >> >> Why don't lock inside s390_virtio_hypercall() directly round the diag500 >> dispatch call? > > s390_virtio_hypercall is shared between TCG and KVM. For KVM the lock is > already done before calling s390_virtio_hypercall in kvm_arch_handle_exit. Fair enough! Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 4946b56ab3..aec737d707 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -307,7 +307,9 @@ void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num) switch (num) { case 0x500: /* KVM hypercall */ + qemu_mutex_lock_iothread(); r = s390_virtio_hypercall(env); + qemu_mutex_unlock_iothread(); break; case 0x44: /* yield */