All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
Cc: aik@au1.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	paulus@ozlabs.org, mahesh@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH v8 2/6] Wrapper function to wait on condition for the main loop mutex
Date: Tue, 23 Apr 2019 16:47:37 +1000	[thread overview]
Message-ID: <20190423064737.GE31496@umbus.fritz.box> (raw)
In-Reply-To: <155591658718.20338.10108476276907741991.stgit@aravinda>

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

On Mon, Apr 22, 2019 at 12:33:07PM +0530, Aravinda Prasad wrote:
> Introduce a wrapper function to wait on condition for
> the main loop mutex. This function atomically releases
> the main loop mutex and causes the calling thread to
> block on the condition. This wrapper is required because
> qemu_global_mutex is a static variable.
> 
> Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  cpus.c                   |    5 +++++
>  include/qemu/main-loop.h |    8 ++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/cpus.c b/cpus.c
> index e83f72b..d9379e7 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1858,6 +1858,11 @@ void qemu_mutex_unlock_iothread(void)
>      qemu_mutex_unlock(&qemu_global_mutex);
>  }
>  
> +void qemu_cond_wait_iothread(QemuCond *cond)
> +{
> +    qemu_cond_wait(cond, &qemu_global_mutex);
> +}
> +
>  static bool all_vcpus_paused(void)
>  {
>      CPUState *cpu;
> diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
> index f6ba78e..a6d20b0 100644
> --- a/include/qemu/main-loop.h
> +++ b/include/qemu/main-loop.h
> @@ -295,6 +295,14 @@ void qemu_mutex_lock_iothread_impl(const char *file, int line);
>   */
>  void qemu_mutex_unlock_iothread(void);
>  
> +/*
> + * qemu_cond_wait_iothread: Wait on condition for the main loop mutex
> + *
> + * This function atomically releases the main loop mutex and causes
> + * the calling thread to block on the condition.
> + */
> +void qemu_cond_wait_iothread(QemuCond *cond);
> +
>  /* internal interfaces */
>  
>  void qemu_fd_register(int fd);
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: David Gibson <david@gibson.dropbear.id.au>
To: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
Cc: paulus@ozlabs.org, qemu-ppc@nongnu.org, aik@au1.ibm.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v8 2/6] Wrapper function to wait on condition for the main loop mutex
Date: Tue, 23 Apr 2019 16:47:37 +1000	[thread overview]
Message-ID: <20190423064737.GE31496@umbus.fritz.box> (raw)
Message-ID: <20190423064737.eJqxHxdKFQ7v5j2wWFceN8J4dS_RQwujlODhk5omwJM@z> (raw)
In-Reply-To: <155591658718.20338.10108476276907741991.stgit@aravinda>

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

On Mon, Apr 22, 2019 at 12:33:07PM +0530, Aravinda Prasad wrote:
> Introduce a wrapper function to wait on condition for
> the main loop mutex. This function atomically releases
> the main loop mutex and causes the calling thread to
> block on the condition. This wrapper is required because
> qemu_global_mutex is a static variable.
> 
> Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  cpus.c                   |    5 +++++
>  include/qemu/main-loop.h |    8 ++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/cpus.c b/cpus.c
> index e83f72b..d9379e7 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1858,6 +1858,11 @@ void qemu_mutex_unlock_iothread(void)
>      qemu_mutex_unlock(&qemu_global_mutex);
>  }
>  
> +void qemu_cond_wait_iothread(QemuCond *cond)
> +{
> +    qemu_cond_wait(cond, &qemu_global_mutex);
> +}
> +
>  static bool all_vcpus_paused(void)
>  {
>      CPUState *cpu;
> diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
> index f6ba78e..a6d20b0 100644
> --- a/include/qemu/main-loop.h
> +++ b/include/qemu/main-loop.h
> @@ -295,6 +295,14 @@ void qemu_mutex_lock_iothread_impl(const char *file, int line);
>   */
>  void qemu_mutex_unlock_iothread(void);
>  
> +/*
> + * qemu_cond_wait_iothread: Wait on condition for the main loop mutex
> + *
> + * This function atomically releases the main loop mutex and causes
> + * the calling thread to block on the condition.
> + */
> +void qemu_cond_wait_iothread(QemuCond *cond);
> +
>  /* internal interfaces */
>  
>  void qemu_fd_register(int fd);
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-04-23  7:08 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22  7:02 [Qemu-devel] [PATCH v8 0/6] target-ppc/spapr: Add FWNMI support in QEMU for PowerKVM guests Aravinda Prasad
2019-04-22  7:02 ` Aravinda Prasad
2019-04-22  7:02 ` [Qemu-devel] [PATCH v8 1/6] ppc: spapr: Handle "ibm, nmi-register" and "ibm, nmi-interlock" RTAS calls Aravinda Prasad
2019-04-22  7:02   ` Aravinda Prasad
2019-04-23  6:45   ` David Gibson
2019-04-23  6:45     ` David Gibson
2019-04-25  4:56     ` Aravinda Prasad
2019-04-25  4:56       ` Aravinda Prasad
2019-05-10  9:06   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2019-05-10  9:54     ` David Gibson
2019-05-10 14:33     ` Greg Kurz
2019-05-13  4:57       ` Aravinda Prasad
2019-05-13  4:53     ` Aravinda Prasad
2019-04-22  7:03 ` [Qemu-devel] [PATCH v8 2/6] Wrapper function to wait on condition for the main loop mutex Aravinda Prasad
2019-04-22  7:03   ` Aravinda Prasad
2019-04-23  6:47   ` David Gibson [this message]
2019-04-23  6:47     ` David Gibson
2019-05-10 13:14   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2019-04-22  7:03 ` [Qemu-devel] [PATCH v8 3/6] target/ppc: Handle NMI guest exit Aravinda Prasad
2019-04-22  7:03   ` Aravinda Prasad
2019-04-23  6:53   ` David Gibson
2019-04-23  6:53     ` David Gibson
2019-04-24  4:50     ` [Qemu-devel] [Qemu-ppc] " Aravinda Prasad
2019-04-24  4:50       ` Aravinda Prasad
2019-05-10  6:37       ` David Gibson
2019-05-10  6:58         ` Aravinda Prasad
2019-05-10 16:25   ` Greg Kurz
2019-05-13  5:40     ` Aravinda Prasad
2019-05-13  5:56       ` David Gibson
2019-04-22  7:03 ` [Qemu-devel] [PATCH v8 4/6] target/ppc: Build rtas error log upon an MCE Aravinda Prasad
2019-04-22  7:03   ` Aravinda Prasad
2019-04-23 14:38   ` Fabiano Rosas
2019-04-23 14:38     ` Fabiano Rosas
2019-04-24  4:51     ` [Qemu-devel] [Qemu-ppc] " Aravinda Prasad
2019-04-24  4:51       ` Aravinda Prasad
2019-05-10  6:42   ` [Qemu-devel] " David Gibson
2019-05-10  7:05     ` Aravinda Prasad
2019-05-10  9:52       ` David Gibson
2019-05-13  5:00         ` Aravinda Prasad
2019-05-13 11:30   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2019-05-14  0:08     ` David Gibson
2019-05-14  4:26       ` Aravinda Prasad
2019-05-14  4:40         ` David Gibson
2019-05-14  5:06           ` Aravinda Prasad
2019-05-16  1:47             ` David Gibson
2019-05-16  4:54               ` Aravinda Prasad
2019-04-22  7:03 ` [Qemu-devel] [PATCH v8 5/6] ppc: spapr: Enable FWNMI capability Aravinda Prasad
2019-04-22  7:03   ` Aravinda Prasad
2019-05-10  6:46   ` David Gibson
2019-05-10  7:15     ` [Qemu-devel] [Qemu-ppc] " Aravinda Prasad
2019-05-10  9:53       ` David Gibson
2019-05-13 10:30         ` Aravinda Prasad
2019-05-14  4:47           ` David Gibson
2019-05-14  5:32             ` Aravinda Prasad
2019-05-16  1:45               ` David Gibson
2019-05-16  4:59                 ` Aravinda Prasad
2019-04-22  7:03 ` [Qemu-devel] [PATCH v8 6/6] migration: Block migration while handling machine check Aravinda Prasad
2019-04-22  7:03   ` Aravinda Prasad
2019-05-10  6:51   ` David Gibson
2019-05-10  7:16     ` Aravinda Prasad
2019-05-29  5:46     ` [Qemu-devel] [Qemu-ppc] " Aravinda Prasad
2019-05-16 10:54   ` Greg Kurz
2019-05-16 10:59     ` Aravinda Prasad
2019-05-16 14:17       ` Dr. David Alan Gilbert
2019-05-20  5:57         ` Aravinda Prasad

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=20190423064737.GE31496@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@au1.ibm.com \
    --cc=aravinda@linux.vnet.ibm.com \
    --cc=mahesh@linux.vnet.ibm.com \
    --cc=paulus@ozlabs.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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.