diff mbox

[RFC,v2,5/8] hmp: support "without_bql"

Message ID 1503471071-2233-6-git-send-email-peterx@redhat.com
State New
Headers show

Commit Message

Peter Xu Aug. 23, 2017, 6:51 a.m. UTC
Introducing new option "without_bql" for HMP commands.  It works just
like QMP "without-bql", but for HMP commands.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 monitor.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Dr. David Alan Gilbert Aug. 23, 2017, 5:46 p.m. UTC | #1
* Peter Xu (peterx@redhat.com) wrote:
> Introducing new option "without_bql" for HMP commands.  It works just
> like QMP "without-bql", but for HMP commands.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>

It's going to be interesting when we have hmp commands that just call
their qmp equivalent that we need to check for no mistakes.

Dave

> ---
>  monitor.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/monitor.c b/monitor.c
> index 3d4ecff..c26c797 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -125,6 +125,8 @@ typedef struct mon_cmd_t {
>      const char *args_type;
>      const char *params;
>      const char *help;
> +    /* Whether this command can be run without taking BQL? */
> +    bool without_bql;
>      void (*cmd)(Monitor *mon, const QDict *qdict);
>      /* @sub_table is a list of 2nd level of commands. If it does not exist,
>       * cmd should be used. If it exists, sub_table[?].cmd should be
> @@ -3154,6 +3156,14 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline)
>          return;
>      }
>  
> +    if (cmd->without_bql) {
> +        /*
> +         * This is similar to QMP's "without-bql".  See comments in
> +         * do_qmp_dispatch().
> +         */
> +        take_bql = false;
> +    }
> +
>      if (take_bql) {
>          qemu_mutex_lock_iothread();
>      }
> -- 
> 2.7.4
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Peter Xu Aug. 25, 2017, 5:44 a.m. UTC | #2
On Wed, Aug 23, 2017 at 06:46:29PM +0100, Dr. David Alan Gilbert wrote:
> * Peter Xu (peterx@redhat.com) wrote:
> > Introducing new option "without_bql" for HMP commands.  It works just
> > like QMP "without-bql", but for HMP commands.
> > 
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> 
> It's going to be interesting when we have hmp commands that just call
> their qmp equivalent that we need to check for no mistakes.

But we don't have any QMP & HMP mapping between them, do we?  Then I
have no good idea on how we can do the check.
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index 3d4ecff..c26c797 100644
--- a/monitor.c
+++ b/monitor.c
@@ -125,6 +125,8 @@  typedef struct mon_cmd_t {
     const char *args_type;
     const char *params;
     const char *help;
+    /* Whether this command can be run without taking BQL? */
+    bool without_bql;
     void (*cmd)(Monitor *mon, const QDict *qdict);
     /* @sub_table is a list of 2nd level of commands. If it does not exist,
      * cmd should be used. If it exists, sub_table[?].cmd should be
@@ -3154,6 +3156,14 @@  static void handle_hmp_command(Monitor *mon, const char *cmdline)
         return;
     }
 
+    if (cmd->without_bql) {
+        /*
+         * This is similar to QMP's "without-bql".  See comments in
+         * do_qmp_dispatch().
+         */
+        take_bql = false;
+    }
+
     if (take_bql) {
         qemu_mutex_lock_iothread();
     }