qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] s390x/misc_helper.c: wrap s390_virtio_hypercall in BQL
@ 2017-04-23 22:32 Aurelien Jarno
  2017-04-23 22:38 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Aurelien Jarno @ 2017-04-23 22:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Graf, Richard Henderson, Aurelien Jarno

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 */
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] s390x/misc_helper.c: wrap s390_virtio_hypercall in BQL
  2017-04-23 22:32 [Qemu-devel] [PATCH v2] s390x/misc_helper.c: wrap s390_virtio_hypercall in BQL Aurelien Jarno
@ 2017-04-23 22:38 ` Philippe Mathieu-Daudé
  2017-04-23 22:47   ` Aurelien Jarno
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-04-23 22:38 UTC (permalink / raw)
  To: Aurelien Jarno, qemu-devel; +Cc: Alexander Graf, Richard Henderson

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 */
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] s390x/misc_helper.c: wrap s390_virtio_hypercall in BQL
  2017-04-23 22:38 ` Philippe Mathieu-Daudé
@ 2017-04-23 22:47   ` Aurelien Jarno
  2017-04-23 23:09     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Aurelien Jarno @ 2017-04-23 22:47 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Alexander Graf, Richard Henderson

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.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] s390x/misc_helper.c: wrap s390_virtio_hypercall in BQL
  2017-04-23 22:47   ` Aurelien Jarno
@ 2017-04-23 23:09     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-04-23 23:09 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: Richard Henderson, qemu-devel, Alexander Graf

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-23 23:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-23 22:32 [Qemu-devel] [PATCH v2] s390x/misc_helper.c: wrap s390_virtio_hypercall in BQL Aurelien Jarno
2017-04-23 22:38 ` Philippe Mathieu-Daudé
2017-04-23 22:47   ` Aurelien Jarno
2017-04-23 23:09     ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).