All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: mirror "-machine dirty_gfn_count" to the accelerator property
@ 2021-01-08 19:08 huangy81
  2021-01-08 20:41 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: huangy81 @ 2021-01-08 19:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Hyman, peterx

QEMU enable the dirty ring feature by specifing the "-accel" sub-parameter.
https://lore.kernel.org/qemu-devel/20210108165050.406906-10-peterx@redhat.com/
Libvirt use "-machine accel=kvm" option to specify the accelerator by default,
which is incompatible with above option.

This patch introduce the "dirty_gfn_count" sub-parameter of the "-machine"
in the way that the commit "23b089" has done. So that Libvirt can enable this
feature by adding "-machine dirty_gfn_count=xxx" to the QEMU command line.

Signed-off-by: Hyman <huangy81@chinatelecom.cn>
---
 softmmu/vl.c       | 3 ++-
 util/qemu-config.c | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index 7ddf405..d8e3dec 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1666,7 +1666,8 @@ static int machine_set_property(void *opaque,
         object_register_sugar_prop(ACCEL_CLASS_NAME("xen"), qom_name, value);
         return 0;
     }
-    if (g_str_equal(qom_name, "kvm-shadow-mem")) {
+    if (g_str_equal(qom_name, "kvm-shadow-mem") ||
+        g_str_equal(qom_name, "dirty-gfn-count")) {
         object_register_sugar_prop(ACCEL_CLASS_NAME("kvm"), qom_name, value);
         return 0;
     }
diff --git a/util/qemu-config.c b/util/qemu-config.c
index e2a700b..70f1b50 100644
--- a/util/qemu-config.c
+++ b/util/qemu-config.c
@@ -234,6 +234,10 @@ static QemuOptsList machine_opts = {
             .help = "Up to 8 chars in set of [A-Za-z0-9. ](lower case chars"
                     " converted to upper case) to pass to machine"
                     " loader, boot manager, and guest kernel",
+        },{
+            .name = "dirty_gfn_count",
+            .type = QEMU_OPT_NUMBER,
+            .help = "KVM dirty ring GFN count",
         },
         { /* End of list */ }
     }
-- 
1.8.3.1



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

* Re: [PATCH] kvm: mirror "-machine dirty_gfn_count" to the accelerator property
  2021-01-08 19:08 [PATCH] kvm: mirror "-machine dirty_gfn_count" to the accelerator property huangy81
@ 2021-01-08 20:41 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2021-01-08 20:41 UTC (permalink / raw)
  To: huangy81, qemu-devel; +Cc: peterx

On 08/01/21 20:08, huangy81@chinatelecom.cn wrote:
> QEMU enable the dirty ring feature by specifing the "-accel" sub-parameter.
> https://lore.kernel.org/qemu-devel/20210108165050.406906-10-peterx@redhat.com/
> Libvirt use "-machine accel=kvm" option to specify the accelerator by default,
> which is incompatible with above option.
> 
> This patch introduce the "dirty_gfn_count" sub-parameter of the "-machine"
> in the way that the commit "23b089" has done. So that Libvirt can enable this
> feature by adding "-machine dirty_gfn_count=xxx" to the QEMU command line.
> 
> Signed-off-by: Hyman <huangy81@chinatelecom.cn>

Libvirt should switch to "-accel kvm" instead.  The "-machine" options 
for accelerators are legacy and now there is a better mechanism.  There 
will never be a version of QEMU that supports dirty ring and doesn't 
support "-accel kvm", so it's easy for Libvirt to detect when to use 
"-accel".

Paolo

> ---
>   softmmu/vl.c       | 3 ++-
>   util/qemu-config.c | 4 ++++
>   2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 7ddf405..d8e3dec 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -1666,7 +1666,8 @@ static int machine_set_property(void *opaque,
>           object_register_sugar_prop(ACCEL_CLASS_NAME("xen"), qom_name, value);
>           return 0;
>       }
> -    if (g_str_equal(qom_name, "kvm-shadow-mem")) {
> +    if (g_str_equal(qom_name, "kvm-shadow-mem") ||
> +        g_str_equal(qom_name, "dirty-gfn-count")) {
>           object_register_sugar_prop(ACCEL_CLASS_NAME("kvm"), qom_name, value);
>           return 0;
>       }
> diff --git a/util/qemu-config.c b/util/qemu-config.c
> index e2a700b..70f1b50 100644
> --- a/util/qemu-config.c
> +++ b/util/qemu-config.c
> @@ -234,6 +234,10 @@ static QemuOptsList machine_opts = {
>               .help = "Up to 8 chars in set of [A-Za-z0-9. ](lower case chars"
>                       " converted to upper case) to pass to machine"
>                       " loader, boot manager, and guest kernel",
> +        },{
> +            .name = "dirty_gfn_count",
> +            .type = QEMU_OPT_NUMBER,
> +            .help = "KVM dirty ring GFN count",
>           },
>           { /* End of list */ }
>       }
> 



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

end of thread, other threads:[~2021-01-08 20:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 19:08 [PATCH] kvm: mirror "-machine dirty_gfn_count" to the accelerator property huangy81
2021-01-08 20:41 ` Paolo Bonzini

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.