Skip to contentSkip to conversation

x86/hvm: don't create a default ioreq server...

PATCH In review Paul Durrant 4 participants 5 messages Dec 9, 2016 – Dec 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: don't create a default ioreq server...

...if the domain is not under construction.

If upstream QEMU is in use then it will explicitly create an ioreq server rather than implicitly creating the default ioreq server, which is a side-effect of reading HVM_PARAM_IOREQ_PFN, HVM_PARAM_BUFIOREQ_PFN, or HVM_PARAM_BUFIOREQ_EVTCHN (as is done by legacy QEMUs).

However, if the domain is subsequently saved/migrated then those parameters are read and hence the default server will be unnecessarily instantiated.

This patch adds an extra check of the 'creation_finished' flag when those HVM params are read and will only instantiate the server if the domain is under construction, which will always be the case when QEMU is invoked.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 xen/arch/x86/hvm/hvm.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/hvm.c +10 -1
index e0f936b..c531f37 100644
@@ -5337,7 +5337,16 @@ static int hvmop_get_param(
     {
         domid_t domid;
 
-        /* May need to create server. */
+        /*
+         * It may be necessary to create a default ioreq server here,
+         * because legacy versions of QEMU are not aware of the new API
+         * for explicit ioreq server creation. However, if the domain
+         * is not under construction then it will not be QEMU querying
+         * the parameters and thus the query should have that side-effect.
+         */
+        if ( d->creation_finished )
+            break;
+
         domid = d->arch.hvm_domain.params[HVM_PARAM_DM_DOMAIN];
         rc = hvm_create_ioreq_server(d, domid, 1,
                                      HVM_IOREQSRV_BUFIOREQ_LEGACY, NULL);
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Paul Durrant

...if the domain is not under construction.

If upstream QEMU is in use then it will explicitly create an ioreq server rather than implicitly creating the default ioreq server, which is a side-effect of reading HVM_PARAM_IOREQ_PFN, HVM_PARAM_BUFIOREQ_PFN, or HVM_PARAM_BUFIOREQ_EVTCHN (as is done by legacy QEMUs).

Quoted 8 lines

However, if the domain is subsequently saved/migrated then those parameters are read and hence the default server will be unnecessarily instantiated.

This patch adds an extra check of the 'creation_finished' flag when those HVM params are read and will only instantiate the server if the domain is under construction, which will always be the case when QEMU is invoked.

CC'ing the COLO guys. Please can you test with this patch?

Quoted 19 lines

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 xen/arch/x86/hvm/hvm.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/hvm.c +3 -1
index e0f936b..c531f37 100644
@@ -5337,7 +5337,16 @@ static int hvmop_get_param(
     {
         domid_t domid;
 
-        /* May need to create server. */
+        /*
+         * It may be necessary to create a default ioreq server here,
+         * because legacy versions of QEMU are not aware of the new API

xen/arch/x86/hvm/hvm.c static int hvmop_get_param( · line 5352

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +7 -0
+         * for explicit ioreq server creation. However, if the domain
+         * is not under construction then it will not be QEMU querying
+         * the parameters and thus the query should have that side-effect.
+         */
+        if ( d->creation_finished )
+            break;
+
         domid = d->arch.hvm_domain.params[HVM_PARAM_DM_DOMAIN];
         rc = hvm_create_ioreq_server(d, domid, 1,
                                      HVM_IOREQSRV_BUFIOREQ_LEGACY, NULL);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Tested-by
#2 lore raw
Quoted 11 lines · Andrew Cooper
Quoted 10 lines · Paul Durrant

...if the domain is not under construction.

If upstream QEMU is in use then it will explicitly create an ioreq server rather than implicitly creating the default ioreq server, which is a side-effect of reading HVM_PARAM_IOREQ_PFN, HVM_PARAM_BUFIOREQ_PFN, or HVM_PARAM_BUFIOREQ_EVTCHN (as is done by legacy QEMUs).

However, if the domain is subsequently saved/migrated then those parameters are read and hence the default server will be unnecessarily instantiated.

Quoted 8 lines
Quoted 5 lines

This patch adds an extra check of the 'creation_finished' flag when those HVM params are read and will only instantiate the server if the domain is under construction, which will always be the case when QEMU is invoked.

CC'ing the COLO guys. Please can you test with this patch?

I have tested this patch, it works well on COLO!

Thanks
Zhang Chen

Quoted 34 lines
Quoted 20 lines

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
  xen/arch/x86/hvm/hvm.c | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/hvm.c +3 -1
index e0f936b..c531f37 100644
@@ -5337,7 +5337,16 @@ static int hvmop_get_param(
      {
          domid_t domid;
 
-        /* May need to create server. */
+        /*
+         * It may be necessary to create a default ioreq server here,
+         * because legacy versions of QEMU are not aware of the new API

xen/arch/x86/hvm/hvm.c static int hvmop_get_param( · line 5352

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +7 -0
+         * for explicit ioreq server creation. However, if the domain
+         * is not under construction then it will not be QEMU querying
+         * the parameters and thus the query should have that side-effect.
+         */
+        if ( d->creation_finished )
+            break;
+
          domid = d->arch.hvm_domain.params[HVM_PARAM_DM_DOMAIN];
          rc = hvm_create_ioreq_server(d, domid, 1,
                                       HVM_IOREQSRV_BUFIOREQ_LEGACY, NULL);

.

Signature · 10 lines
Thanks
zhangchen




_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw
In reply to Paul Durrant
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 09.12.16 at 18:55, <[email protected]> wrote:

...if the domain is not under construction.

I think the title will end up misleading this way. How about "x86/hvm:
don't unconditionally create a default ioreq server" with "Avoid doing so if the domain is not under construction" as the 1st sentence?

As the patch is otherwise ready to go in, that adjustment could certainly be done while committing (i.e. no re-send necessary).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 8 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 12 December 2016 07:54
To: Paul Durrant <[email protected]>
Cc: Andrew Cooper <[email protected]>; xen- [email protected]
Subject: Re: [PATCH] x86/hvm: don't create a default ioreq server...

Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 09.12.16 at 18:55, <[email protected]> wrote:

...if the domain is not under construction.

I think the title will end up misleading this way. How about "x86/hvm:
don't unconditionally create a default ioreq server" with "Avoid doing so if the domain is not under construction" as the 1st sentence?

Yes, that would avoid the shortlog being misleading.

Quoted 3 lines

As the patch is otherwise ready to go in, that adjustment could certainly be done while committing (i.e. no re-send necessary).

Thanks. I also realised there is typo in the code comment:

" the query should have that side-effect" should be " the query should *not* have that side-effect"

Please can you fix this too.

Cheers,

Paul

Quoted 1 line

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel