qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
@ 2013-03-26 15:05 Satoru Moriya
  2013-03-27 15:18 ` Anthony Liguori
  2013-04-22 18:38 ` Anthony Liguori
  0 siblings, 2 replies; 9+ messages in thread
From: Satoru Moriya @ 2013-03-26 15:05 UTC (permalink / raw)
  To: qemu-devel@nongnu.org
  Cc: Anthony Liguori, satoru.moriya.br@hitachi.com, Jan Kiszka,
	mtosatti@redhat.com, dle-develop@lists.sourceforge.net,
	Tomoki Sekiyama, Paolo Bonzini, Seiji Aguchi

In certain scenario, latency induced by paging is significant and
memory locking is needed. Also, in the scenario with untrusted
guests, latency improvement due to mlock is desired.

This patch introduces a following new option to mlock guest and
qemu memory:

-realtime mlock=on|off

Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
---
ChangeLog:
v4
 - Update commit message
v3
 - Modify os_mlock() to return error code
 - Update configure_realtime() to handle return value from os_mlock()
 - Change the variable name from is_mlock to enable_mlock in configure_realtime()
 - Rebase qemu version 1.4.50

v2
 - Change option name from -mlock to -realtime mlock=on|off
 - Rebase qemu version 1.3.91
 - Update patch description

 include/sysemu/os-posix.h |  1 +
 include/sysemu/os-win32.h |  5 +++++
 os-posix.c                | 12 ++++++++++++
 qemu-options.hx           | 13 +++++++++++++
 vl.c                      | 34 ++++++++++++++++++++++++++++++++++
 5 files changed, 65 insertions(+)

diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index 7f198e4..25d0b2a 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -31,6 +31,7 @@ void os_set_proc_name(const char *s);
 void os_setup_signal_handling(void);
 void os_daemonize(void);
 void os_setup_post(void);
+int os_mlock(void);
 
 typedef struct timeval qemu_timeval;
 #define qemu_gettimeofday(tp) gettimeofday(tp, NULL)
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index 71f5fa0..bf8523a 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -106,4 +106,9 @@ static inline bool is_daemonized(void)
     return false;
 }
 
+static inline int os_mlock(void)
+{
+    return -ENOSYS;
+}
+
 #endif
diff --git a/os-posix.c b/os-posix.c
index 5c64518..d39261d 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -363,3 +363,15 @@ bool is_daemonized(void)
 {
     return daemonize;
 }
+
+int os_mlock(void)
+{
+    int ret = 0;
+
+    ret = mlockall(MCL_CURRENT | MCL_FUTURE);
+    if (ret < 0) {
+        perror("mlockall");
+    }
+
+    return ret;
+}
diff --git a/qemu-options.hx b/qemu-options.hx
index 06dd565..1ec9541 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2569,6 +2569,19 @@ STEXI
 Do not start CPU at startup (you must type 'c' in the monitor).
 ETEXI
 
+DEF("realtime", HAS_ARG, QEMU_OPTION_realtime,
+    "-realtime [mlock=on|off]\n"
+    "                run qemu with realtime features\n"
+    "                mlock=on|off controls mlock support (default: on)\n",
+    QEMU_ARCH_ALL)
+STEXI
+@item -realtime mlock=on|off
+@findex -realtime
+Run qemu with realtime features.
+mlocking qemu and guest memory can be enabled via @option{mlock=on}
+(enabled by default).
+ETEXI
+
 DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \
     "-gdb dev        wait for gdb connection on 'dev'\n", QEMU_ARCH_ALL)
 STEXI
diff --git a/vl.c b/vl.c
index aeed7f4..71bbcf1 100644
--- a/vl.c
+++ b/vl.c
@@ -521,6 +521,18 @@ static QemuOptsList qemu_tpmdev_opts = {
     },
 };
 
+static QemuOptsList qemu_realtime_opts = {
+    .name = "realtime",
+    .head = QTAILQ_HEAD_INITIALIZER(qemu_realtime_opts.head),
+    .desc = {
+        {
+            .name = "mlock",
+            .type = QEMU_OPT_BOOL,
+        },
+        { /* end of list */ }
+    },
+};
+
 const char *qemu_get_vm_name(void)
 {
     return qemu_name;
@@ -1420,6 +1432,20 @@ static void smp_parse(const char *optarg)
         max_cpus = smp_cpus;
 }
 
+static void configure_realtime(QemuOpts *opts)
+{
+    bool enable_mlock;
+
+    enable_mlock = qemu_opt_get_bool(opts, "mlock", true);
+
+    if (enable_mlock) {
+        if (os_mlock() < 0) {
+            fprintf(stderr, "qemu: locking memory failed\n");
+            exit(1);
+        }
+    }
+}
+
 /***********************************************************/
 /* USB devices */
 
@@ -2909,6 +2935,7 @@ int main(int argc, char **argv, char **envp)
     qemu_add_opts(&qemu_add_fd_opts);
     qemu_add_opts(&qemu_object_opts);
     qemu_add_opts(&qemu_tpmdev_opts);
+    qemu_add_opts(&qemu_realtime_opts);
 
     runstate_init();
 
@@ -3878,6 +3905,13 @@ int main(int argc, char **argv, char **envp)
                     exit(1);
                 }
                 break;
+            case QEMU_OPTION_realtime:
+                opts = qemu_opts_parse(qemu_find_opts("realtime"), optarg, 0);
+                if (!opts) {
+                    exit(1);
+                }
+                configure_realtime(opts);
+                break;
             default:
                 os_parse_cmd_args(popt->index, optarg);
             }
-- 
1.7.11.7


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

* Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
  2013-03-26 15:05 Satoru Moriya
@ 2013-03-27 15:18 ` Anthony Liguori
  2013-03-28  4:43   ` Satoru Moriya
  2013-04-22 18:38 ` Anthony Liguori
  1 sibling, 1 reply; 9+ messages in thread
From: Anthony Liguori @ 2013-03-27 15:18 UTC (permalink / raw)
  To: Satoru Moriya, qemu-devel@nongnu.org
  Cc: dle-develop@lists.sourceforge.net, satoru.moriya.br@hitachi.com,
	Jan Kiszka, mtosatti@redhat.com, Tomoki Sekiyama, Paolo Bonzini,
	Seiji Aguchi

Satoru Moriya <satoru.moriya@hds.com> writes:

> In certain scenario, latency induced by paging is significant and
> memory locking is needed. Also, in the scenario with untrusted
> guests, latency improvement due to mlock is desired.
>
> This patch introduces a following new option to mlock guest and
> qemu memory:
>
> -realtime mlock=on|off
>
> Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>

This patch doesn't apply because you're sending it MIME encoded and the
patch has carriage returns in it.  I think your mailer is badly munging
the patch.

Please send it via git-send-email directly from the repository.

Regards,

Anthony Liguori

> ---
> ChangeLog:
> v4
>  - Update commit message
> v3
>  - Modify os_mlock() to return error code
>  - Update configure_realtime() to handle return value from os_mlock()
>  - Change the variable name from is_mlock to enable_mlock in configure_realtime()
>  - Rebase qemu version 1.4.50
>
> v2
>  - Change option name from -mlock to -realtime mlock=on|off
>  - Rebase qemu version 1.3.91
>  - Update patch description
>
>  include/sysemu/os-posix.h |  1 +
>  include/sysemu/os-win32.h |  5 +++++
>  os-posix.c                | 12 ++++++++++++
>  qemu-options.hx           | 13 +++++++++++++
>  vl.c                      | 34 ++++++++++++++++++++++++++++++++++
>  5 files changed, 65 insertions(+)
>
> diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
> index 7f198e4..25d0b2a 100644
> --- a/include/sysemu/os-posix.h
> +++ b/include/sysemu/os-posix.h
> @@ -31,6 +31,7 @@ void os_set_proc_name(const char *s);
>  void os_setup_signal_handling(void);
>  void os_daemonize(void);
>  void os_setup_post(void);
> +int os_mlock(void);
>  
>  typedef struct timeval qemu_timeval;
>  #define qemu_gettimeofday(tp) gettimeofday(tp, NULL)
> diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
> index 71f5fa0..bf8523a 100644
> --- a/include/sysemu/os-win32.h
> +++ b/include/sysemu/os-win32.h
> @@ -106,4 +106,9 @@ static inline bool is_daemonized(void)
>      return false;
>  }
>  
> +static inline int os_mlock(void)
> +{
> +    return -ENOSYS;
> +}
> +
>  #endif
> diff --git a/os-posix.c b/os-posix.c
> index 5c64518..d39261d 100644
> --- a/os-posix.c
> +++ b/os-posix.c
> @@ -363,3 +363,15 @@ bool is_daemonized(void)
>  {
>      return daemonize;
>  }
> +
> +int os_mlock(void)
> +{
> +    int ret = 0;
> +
> +    ret = mlockall(MCL_CURRENT | MCL_FUTURE);
> +    if (ret < 0) {
> +        perror("mlockall");
> +    }
> +
> +    return ret;
> +}
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 06dd565..1ec9541 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2569,6 +2569,19 @@ STEXI
>  Do not start CPU at startup (you must type 'c' in the monitor).
>  ETEXI
>  
> +DEF("realtime", HAS_ARG, QEMU_OPTION_realtime,
> +    "-realtime [mlock=on|off]\n"
> +    "                run qemu with realtime features\n"
> +    "                mlock=on|off controls mlock support (default: on)\n",
> +    QEMU_ARCH_ALL)
> +STEXI
> +@item -realtime mlock=on|off
> +@findex -realtime
> +Run qemu with realtime features.
> +mlocking qemu and guest memory can be enabled via @option{mlock=on}
> +(enabled by default).
> +ETEXI
> +
>  DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \
>      "-gdb dev        wait for gdb connection on 'dev'\n", QEMU_ARCH_ALL)
>  STEXI
> diff --git a/vl.c b/vl.c
> index aeed7f4..71bbcf1 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -521,6 +521,18 @@ static QemuOptsList qemu_tpmdev_opts = {
>      },
>  };
>  
> +static QemuOptsList qemu_realtime_opts = {
> +    .name = "realtime",
> +    .head = QTAILQ_HEAD_INITIALIZER(qemu_realtime_opts.head),
> +    .desc = {
> +        {
> +            .name = "mlock",
> +            .type = QEMU_OPT_BOOL,
> +        },
> +        { /* end of list */ }
> +    },
> +};
> +
>  const char *qemu_get_vm_name(void)
>  {
>      return qemu_name;
> @@ -1420,6 +1432,20 @@ static void smp_parse(const char *optarg)
>          max_cpus = smp_cpus;
>  }
>  
> +static void configure_realtime(QemuOpts *opts)
> +{
> +    bool enable_mlock;
> +
> +    enable_mlock = qemu_opt_get_bool(opts, "mlock", true);
> +
> +    if (enable_mlock) {
> +        if (os_mlock() < 0) {
> +            fprintf(stderr, "qemu: locking memory failed\n");
> +            exit(1);
> +        }
> +    }
> +}
> +
>  /***********************************************************/
>  /* USB devices */
>  
> @@ -2909,6 +2935,7 @@ int main(int argc, char **argv, char **envp)
>      qemu_add_opts(&qemu_add_fd_opts);
>      qemu_add_opts(&qemu_object_opts);
>      qemu_add_opts(&qemu_tpmdev_opts);
> +    qemu_add_opts(&qemu_realtime_opts);
>  
>      runstate_init();
>  
> @@ -3878,6 +3905,13 @@ int main(int argc, char **argv, char **envp)
>                      exit(1);
>                  }
>                  break;
> +            case QEMU_OPTION_realtime:
> +                opts = qemu_opts_parse(qemu_find_opts("realtime"), optarg, 0);
> +                if (!opts) {
> +                    exit(1);
> +                }
> +                configure_realtime(opts);
> +                break;
>              default:
>                  os_parse_cmd_args(popt->index, optarg);
>              }
> -- 
> 1.7.11.7

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

* Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
  2013-03-27 15:18 ` Anthony Liguori
@ 2013-03-28  4:43   ` Satoru Moriya
  2013-04-02 15:03     ` Seiji Aguchi
  0 siblings, 1 reply; 9+ messages in thread
From: Satoru Moriya @ 2013-03-28  4:43 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel@nongnu.org
  Cc: dle-develop@lists.sourceforge.net, satoru.moriya.br@hitachi.com,
	Jan Kiszka, mtosatti@redhat.com, Tomoki Sekiyama, Paolo Bonzini,
	Seiji Aguchi

> -----Original Message-----
> From: Anthony Liguori [mailto:aliguori@us.ibm.com]
> Sent: Wednesday, March 27, 2013 11:18 AM
> To: Satoru Moriya; qemu-devel@nongnu.org
> Cc: Jan Kiszka; mtosatti@redhat.com; Paolo Bonzini; Seiji Aguchi; Tomoki Sekiyama; dle-
> develop@lists.sourceforge.net; satoru.moriya.br@hitachi.com
> Subject: Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
> 
> Satoru Moriya <satoru.moriya@hds.com> writes:
> 
> > In certain scenario, latency induced by paging is significant and
> > memory locking is needed. Also, in the scenario with untrusted guests,
> > latency improvement due to mlock is desired.
> >
> > This patch introduces a following new option to mlock guest and qemu
> > memory:
> >
> > -realtime mlock=on|off
> >
> > Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
> > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> > Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> This patch doesn't apply because you're sending it MIME encoded and the patch has carriage returns in
> it.  I think your mailer is badly munging the patch.
> 
> Please send it via git-send-email directly from the repository.

I'm sorry for bothering you...

Currently my company doesn't allow me to use git-send-email to send a email.
So now I'm trying to find work around with IT.

Once it is solved, I re-post the patch.

Regards,
Satoru

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

* Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
  2013-03-28  4:43   ` Satoru Moriya
@ 2013-04-02 15:03     ` Seiji Aguchi
  2013-04-02 19:12       ` Anthony Liguori
  2013-04-03  7:57       ` Markus Armbruster
  0 siblings, 2 replies; 9+ messages in thread
From: Seiji Aguchi @ 2013-04-02 15:03 UTC (permalink / raw)
  To: !(03/30/2013-Mitsumasa Inagaki)Satoru Moriya, Anthony Liguori,
	qemu-devel@nongnu.org
  Cc: dle-develop@lists.sourceforge.net, satoru.moriya.br@hitachi.com,
	Jan Kiszka, mtosatti@redhat.com, Tomoki Sekiyama, Paolo Bonzini

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

Anthony,

> Currently my company doesn't allow me to use git-send-email to send a email.
> So now I'm trying to find work around with IT.

Satoru and I still talk if we can use git-send-email with my company IT.
But, it seems to  take a long time...

So, I attached Satoru's patch.
Could you please apply it to your tree?

Seiji

> -----Original Message-----
> From: Satoru Moriya
> Sent: Thursday, March 28, 2013 12:43 AM
> To: Anthony Liguori; qemu-devel@nongnu.org
> Cc: Jan Kiszka; mtosatti@redhat.com; Paolo Bonzini; Seiji Aguchi; Tomoki Sekiyama; dle-develop@lists.sourceforge.net;
> satoru.moriya.br@hitachi.com
> Subject: RE: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
> 
> > -----Original Message-----
> > From: Anthony Liguori [mailto:aliguori@us.ibm.com]
> > Sent: Wednesday, March 27, 2013 11:18 AM
> > To: Satoru Moriya; qemu-devel@nongnu.org
> > Cc: Jan Kiszka; mtosatti@redhat.com; Paolo Bonzini; Seiji Aguchi;
> > Tomoki Sekiyama; dle- develop@lists.sourceforge.net;
> > satoru.moriya.br@hitachi.com
> > Subject: Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and
> > guest memory
> >
> > Satoru Moriya <satoru.moriya@hds.com> writes:
> >
> > > In certain scenario, latency induced by paging is significant and
> > > memory locking is needed. Also, in the scenario with untrusted
> > > guests, latency improvement due to mlock is desired.
> > >
> > > This patch introduces a following new option to mlock guest and qemu
> > > memory:
> > >
> > > -realtime mlock=on|off
> > >
> > > Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
> > > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> > > Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
> >
> > This patch doesn't apply because you're sending it MIME encoded and
> > the patch has carriage returns in it.  I think your mailer is badly munging the patch.
> >
> > Please send it via git-send-email directly from the repository.
> 
> I'm sorry for bothering you...
> 
> Currently my company doesn't allow me to use git-send-email to send a email.
> So now I'm trying to find work around with IT.
> 
> Once it is solved, I re-post the patch.
> 
> Regards,
> Satoru

[-- Attachment #2: 0001-Add-option-to-mlock-qemu-and-guest-memory.patch --]
[-- Type: application/octet-stream, Size: 5095 bytes --]

From cbd35a81a8a0b04dc8d519a934104417c6b4f51b Mon Sep 17 00:00:00 2001
From: Satoru Moriya <satoru.moriya@hds.com>
Date: Thu, 21 Mar 2013 16:06:37 -0400
Subject: [PATCH v4] Add option to mlock qemu and guest memory

In certain scenario, latency induced by paging is significant and
memory locking is needed. Also, in the scenario with untrusted
guests, latency improvement due to mlock is desired.

This patch introduces a following new option to mlock guest and
qemu memory:

-realtime mlock=on|off

Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
---
ChangeLog:
v4
 - Update commit message
v3
 - Modify os_mlock() to return error code
 - Update configure_realtime() to handle return value from os_mlock()
 - Change the variable name from is_mlock to enable_mlock in configure_realtime()
 - Rebase qemu version 1.4.50

v2
 - Change option name from -mlock to -realtime mlock=on|off
 - Rebase qemu version 1.3.91
 - Update patch description

 include/sysemu/os-posix.h |  1 +
 include/sysemu/os-win32.h |  5 +++++
 os-posix.c                | 12 ++++++++++++
 qemu-options.hx           | 13 +++++++++++++
 vl.c                      | 34 ++++++++++++++++++++++++++++++++++
 5 files changed, 65 insertions(+)

diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index 7f198e4..25d0b2a 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -31,6 +31,7 @@ void os_set_proc_name(const char *s);
 void os_setup_signal_handling(void);
 void os_daemonize(void);
 void os_setup_post(void);
+int os_mlock(void);
 
 typedef struct timeval qemu_timeval;
 #define qemu_gettimeofday(tp) gettimeofday(tp, NULL)
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index 71f5fa0..bf8523a 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -106,4 +106,9 @@ static inline bool is_daemonized(void)
     return false;
 }
 
+static inline int os_mlock(void)
+{
+    return -ENOSYS;
+}
+
 #endif
diff --git a/os-posix.c b/os-posix.c
index 5c64518..d39261d 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -363,3 +363,15 @@ bool is_daemonized(void)
 {
     return daemonize;
 }
+
+int os_mlock(void)
+{
+    int ret = 0;
+
+    ret = mlockall(MCL_CURRENT | MCL_FUTURE);
+    if (ret < 0) {
+        perror("mlockall");
+    }
+
+    return ret;
+}
diff --git a/qemu-options.hx b/qemu-options.hx
index 06dd565..1ec9541 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2569,6 +2569,19 @@ STEXI
 Do not start CPU at startup (you must type 'c' in the monitor).
 ETEXI
 
+DEF("realtime", HAS_ARG, QEMU_OPTION_realtime,
+    "-realtime [mlock=on|off]\n"
+    "                run qemu with realtime features\n"
+    "                mlock=on|off controls mlock support (default: on)\n",
+    QEMU_ARCH_ALL)
+STEXI
+@item -realtime mlock=on|off
+@findex -realtime
+Run qemu with realtime features.
+mlocking qemu and guest memory can be enabled via @option{mlock=on}
+(enabled by default).
+ETEXI
+
 DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \
     "-gdb dev        wait for gdb connection on 'dev'\n", QEMU_ARCH_ALL)
 STEXI
diff --git a/vl.c b/vl.c
index aeed7f4..71bbcf1 100644
--- a/vl.c
+++ b/vl.c
@@ -521,6 +521,18 @@ static QemuOptsList qemu_tpmdev_opts = {
     },
 };
 
+static QemuOptsList qemu_realtime_opts = {
+    .name = "realtime",
+    .head = QTAILQ_HEAD_INITIALIZER(qemu_realtime_opts.head),
+    .desc = {
+        {
+            .name = "mlock",
+            .type = QEMU_OPT_BOOL,
+        },
+        { /* end of list */ }
+    },
+};
+
 const char *qemu_get_vm_name(void)
 {
     return qemu_name;
@@ -1420,6 +1432,20 @@ static void smp_parse(const char *optarg)
         max_cpus = smp_cpus;
 }
 
+static void configure_realtime(QemuOpts *opts)
+{
+    bool enable_mlock;
+
+    enable_mlock = qemu_opt_get_bool(opts, "mlock", true);
+
+    if (enable_mlock) {
+        if (os_mlock() < 0) {
+            fprintf(stderr, "qemu: locking memory failed\n");
+            exit(1);
+        }
+    }
+}
+
 /***********************************************************/
 /* USB devices */
 
@@ -2909,6 +2935,7 @@ int main(int argc, char **argv, char **envp)
     qemu_add_opts(&qemu_add_fd_opts);
     qemu_add_opts(&qemu_object_opts);
     qemu_add_opts(&qemu_tpmdev_opts);
+    qemu_add_opts(&qemu_realtime_opts);
 
     runstate_init();
 
@@ -3878,6 +3905,13 @@ int main(int argc, char **argv, char **envp)
                     exit(1);
                 }
                 break;
+            case QEMU_OPTION_realtime:
+                opts = qemu_opts_parse(qemu_find_opts("realtime"), optarg, 0);
+                if (!opts) {
+                    exit(1);
+                }
+                configure_realtime(opts);
+                break;
             default:
                 os_parse_cmd_args(popt->index, optarg);
             }
-- 
1.7.11.7


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

* Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
  2013-04-02 15:03     ` Seiji Aguchi
@ 2013-04-02 19:12       ` Anthony Liguori
  2013-04-03  7:57       ` Markus Armbruster
  1 sibling, 0 replies; 9+ messages in thread
From: Anthony Liguori @ 2013-04-02 19:12 UTC (permalink / raw)
  To: Seiji Aguchi, !(03/30/2013-Mitsumasa Inagaki)Satoru Moriya,
	qemu-devel@nongnu.org
  Cc: dle-develop@lists.sourceforge.net, satoru.moriya.br@hitachi.com,
	Jan Kiszka, mtosatti@redhat.com, Tomoki Sekiyama, Paolo Bonzini

Seiji Aguchi <seiji.aguchi@hds.com> writes:

> Anthony,
>
>> Currently my company doesn't allow me to use git-send-email to send a email.
>> So now I'm trying to find work around with IT.
>
> Satoru and I still talk if we can use git-send-email with my company IT.
> But, it seems to  take a long time...
>
> So, I attached Satoru's patch.
> Could you please apply it to your tree?

Even attached, the patch still has carriage returns.  I don't have a lot
of confidence in accept a patch if it cannot be submitted in the correct
fashion at least.

Regards,

Anthony Liguori

>
> Seiji
>
>> -----Original Message-----
>> From: Satoru Moriya
>> Sent: Thursday, March 28, 2013 12:43 AM
>> To: Anthony Liguori; qemu-devel@nongnu.org
>> Cc: Jan Kiszka; mtosatti@redhat.com; Paolo Bonzini; Seiji Aguchi; Tomoki Sekiyama; dle-develop@lists.sourceforge.net;
>> satoru.moriya.br@hitachi.com
>> Subject: RE: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
>> 
>> > -----Original Message-----
>> > From: Anthony Liguori [mailto:aliguori@us.ibm.com]
>> > Sent: Wednesday, March 27, 2013 11:18 AM
>> > To: Satoru Moriya; qemu-devel@nongnu.org
>> > Cc: Jan Kiszka; mtosatti@redhat.com; Paolo Bonzini; Seiji Aguchi;
>> > Tomoki Sekiyama; dle- develop@lists.sourceforge.net;
>> > satoru.moriya.br@hitachi.com
>> > Subject: Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and
>> > guest memory
>> >
>> > Satoru Moriya <satoru.moriya@hds.com> writes:
>> >
>> > > In certain scenario, latency induced by paging is significant and
>> > > memory locking is needed. Also, in the scenario with untrusted
>> > > guests, latency improvement due to mlock is desired.
>> > >
>> > > This patch introduces a following new option to mlock guest and qemu
>> > > memory:
>> > >
>> > > -realtime mlock=on|off
>> > >
>> > > Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
>> > > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>> > > Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
>> >
>> > This patch doesn't apply because you're sending it MIME encoded and
>> > the patch has carriage returns in it.  I think your mailer is badly munging the patch.
>> >
>> > Please send it via git-send-email directly from the repository.
>> 
>> I'm sorry for bothering you...
>> 
>> Currently my company doesn't allow me to use git-send-email to send a email.
>> So now I'm trying to find work around with IT.
>> 
>> Once it is solved, I re-post the patch.
>> 
>> Regards,
>> Satoru

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

* Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
  2013-04-02 15:03     ` Seiji Aguchi
  2013-04-02 19:12       ` Anthony Liguori
@ 2013-04-03  7:57       ` Markus Armbruster
  1 sibling, 0 replies; 9+ messages in thread
From: Markus Armbruster @ 2013-04-03  7:57 UTC (permalink / raw)
  To: Seiji Aguchi
  Cc: dle-develop@lists.sourceforge.net, satoru.moriya.br@hitachi.com,
	Jan Kiszka, mtosatti@redhat.com, Anthony Liguori,
	qemu-devel@nongnu.org,
	!(03/30/2013-Mitsumasa Inagaki)Satoru Moriya, Tomoki Sekiyama,
	Paolo Bonzini

Seiji Aguchi <seiji.aguchi@hds.com> writes:

> Anthony,
>
>> Currently my company doesn't allow me to use git-send-email to send a email.
>> So now I'm trying to find work around with IT.
>
> Satoru and I still talk if we can use git-send-email with my company IT.
> But, it seems to  take a long time...
>
> So, I attached Satoru's patch.
> Could you please apply it to your tree?

If your company's e-mail is broken, consider using a non-broken,
non-company e-mail provider for patch submissions.

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

* Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
@ 2013-04-22  5:16 Chegu Vinod
  2013-04-23  3:47 ` Satoru Moriya
  0 siblings, 1 reply; 9+ messages in thread
From: Chegu Vinod @ 2013-04-22  5:16 UTC (permalink / raw)
  To: Satoru Moriya, qemu-devel qemu-devel

Hi Satoru,

FYI... I had tried to use this change earlier and it did show some 
improvements in perf. (due to reduced exits).

But as expected mlockall () on large sized guests adds a considerable 
delay in boot time. For e.g. on an 8 socket Westmere box => a 256G guest 
: took an additional ~2+ mins to boot and a 512G guest took an 
additional ~5+ mins to boot. This is mainly due to long time spent in 
trying to clear all the pages.

     77.96%         35728  qemu-system-x86  [kernel.kallsyms]     [k] 
clear_page_c
             |
             --- clear_page_c
                 hugetlb_no_page
                 hugetlb_fault
                 follow_hugetlb_page
                 __get_user_pages
                 __mlock_vma_pages_range
                 __mm_populate
                 vm_mmap_pgoff
                 sys_mmap_pgoff
                 sys_mmap
                 system_call
                 __GI___mmap64
                 qemu_ram_alloc_from_ptr
                 qemu_ram_alloc
                 memory_region_init_ram
                 pc_memory_init
                 pc_init1
                 pc_init_pci
                 main
                 __libc_start_main

Need to have a faster way to clear pages.
Vinod

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

* Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
  2013-03-26 15:05 Satoru Moriya
  2013-03-27 15:18 ` Anthony Liguori
@ 2013-04-22 18:38 ` Anthony Liguori
  1 sibling, 0 replies; 9+ messages in thread
From: Anthony Liguori @ 2013-04-22 18:38 UTC (permalink / raw)
  To: Satoru Moriya, qemu-devel@nongnu.org
  Cc: satoru.moriya.br@hitachi.com, Jan Kiszka, mtosatti@redhat.com,
	dle-develop@lists.sourceforge.net, Tomoki Sekiyama, Paolo Bonzini

Applied.  Thanks.

Regards,

Anthony Liguori

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

* Re: [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory
  2013-04-22  5:16 [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory Chegu Vinod
@ 2013-04-23  3:47 ` Satoru Moriya
  0 siblings, 0 replies; 9+ messages in thread
From: Satoru Moriya @ 2013-04-23  3:47 UTC (permalink / raw)
  To: Chegu Vinod; +Cc: qemu-devel qemu-devel

Hi Vinod,

Thank you for your report.

(2013/04/22 14:16), Chegu Vinod wrote:
> FYI... I had tried to use this change earlier and it did show some
> improvements in perf. (due to reduced exits).
>
> But as expected mlockall () on large sized guests adds a considerable
> delay in boot time. 

Yes, it is expected.

> For e.g. on an 8 socket Westmere box => a 256G guest :
> took an additional ~2+ mins to boot and a 512G guest took an additional
> ~5+ mins to boot. This is mainly due to long time spent in trying to clear
> all the pages.
>
>     77.96%         35728  qemu-system-x86  [kernel.kallsyms]     [k] clear_page_c
>             |
>             --- clear_page_c
>                 hugetlb_no_page
>                 hugetlb_fault
>                 follow_hugetlb_page
>                 __get_user_pages
>                 __mlock_vma_pages_range
>                 __mm_populate
>                 vm_mmap_pgoff
>                 sys_mmap_pgoff
>                 sys_mmap
>                 system_call
>                 __GI___mmap64
>                 qemu_ram_alloc_from_ptr
>                 qemu_ram_alloc
>                 memory_region_init_ram
>                 pc_memory_init
>                 pc_init1
>                 pc_init_pci
>                 main
>                 __libc_start_main
>
> Need to have a faster way to clear pages.

Hmm, clear_page() just calls memset(page, 0, PAGE_SIZE)...
The patch has just merged today. I'll start to think of the issue above.

Regards,
Satoru

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

end of thread, other threads:[~2013-04-23  3:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-22  5:16 [Qemu-devel] [PATCH v4] Add option to mlock qemu and guest memory Chegu Vinod
2013-04-23  3:47 ` Satoru Moriya
  -- strict thread matches above, loose matches on Subject: below --
2013-03-26 15:05 Satoru Moriya
2013-03-27 15:18 ` Anthony Liguori
2013-03-28  4:43   ` Satoru Moriya
2013-04-02 15:03     ` Seiji Aguchi
2013-04-02 19:12       ` Anthony Liguori
2013-04-03  7:57       ` Markus Armbruster
2013-04-22 18:38 ` Anthony Liguori

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).