Skip to contentSkip to conversation

x86/hvm: Change return error for offline vcpus

PATCH In review Alexandru Isaila 3 participants 6 messages Sep 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86/hvm: Change return error for offline vcpus

This patch is needed in order to have a different return error for invalid vcpu and offline vcpu on the per vcpu king.

---
Changes since V1:
- Add conditional statement in order to have a difference between per_vcpu and per_dom return error.

---
 xen/arch/x86/hvm/save.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/save.c +2 -1
index d520898843..1764fb0918 100644
@@ -165,7 +165,8 @@ int hvm_save_one(struct domain *d, unsigned int typecode, unsigned int instance,
     if ( (rv = hvm_sr_handlers[typecode].save(v, &ctxt)) != 0 )
         printk(XENLOG_G_ERR "HVM%d save: failed to save type %"PRIu16" (%d)\n",
                d->domain_id, typecode, rv);
-    else if ( rv = -ENOENT, ctxt.cur >= sizeof(*desc) )
+    else if ( rv = hvm_sr_handlers[typecode].kind == HVMSR_PER_VCPU ?
+              -ENODATA : -ENOENT, ctxt.cur >= sizeof(*desc) )
     {
         uint32_t off;
 
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 2 lines · Alexandru Isaila

This patch is needed in order to have a different return error for invalid vcpu and offline vcpu on the per vcpu king.

Sorry, I can't parse this sentence. What is "per vcpu king"?

Quoted 28 lines

---
Changes since V1:
- Add conditional statement in order to have a difference between per_vcpu and per_dom return error.

---
 xen/arch/x86/hvm/save.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/save.c +2 -1
index d520898843..1764fb0918 100644
@@ -165,7 +165,8 @@ int hvm_save_one(struct domain *d, unsigned int typecode, unsigned int instance,
     if ( (rv = hvm_sr_handlers[typecode].save(v, &ctxt)) != 0 )
         printk(XENLOG_G_ERR "HVM%d save: failed to save type %"PRIu16" (%d)\n",
                d->domain_id, typecode, rv);
-    else if ( rv = -ENOENT, ctxt.cur >= sizeof(*desc) )
+    else if ( rv = hvm_sr_handlers[typecode].kind == HVMSR_PER_VCPU ?
+              -ENODATA : -ENOENT, ctxt.cur >= sizeof(*desc) )
     {
         uint32_t off;
 
Signature · 1 line
2.17.1

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

#2 lore raw
Quoted 5 lines · Wei Liu
Quoted 2 lines · Alexandru Isaila

This patch is needed in order to have a different return error for invalid vcpu and offline vcpu on the per vcpu king.

Sorry, I can't parse this sentence. What is "per vcpu king"?

Oh, "king" should be "kind".

Quoted 26 lines
Quoted 26 lines

---
Changes since V1:
- Add conditional statement in order to have a difference between per_vcpu and per_dom return error.

---
 xen/arch/x86/hvm/save.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/save.c +2 -1
index d520898843..1764fb0918 100644
@@ -165,7 +165,8 @@ int hvm_save_one(struct domain *d, unsigned int typecode, unsigned int instance,
     if ( (rv = hvm_sr_handlers[typecode].save(v, &ctxt)) != 0 )
         printk(XENLOG_G_ERR "HVM%d save: failed to save type %"PRIu16" (%d)\n",
                d->domain_id, typecode, rv);
-    else if ( rv = -ENOENT, ctxt.cur >= sizeof(*desc) )
+    else if ( rv = hvm_sr_handlers[typecode].kind == HVMSR_PER_VCPU ?
+              -ENODATA : -ENOENT, ctxt.cur >= sizeof(*desc) )
     {
         uint32_t off;
 
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.17.1

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

#3 lore raw
Quoted 9 lines · Wei Liu
Quoted 6 lines · Wei Liu
Quoted 3 lines · Alexandru Isaila

This patch is needed in order to have a different return error for invalid vcpu
and offline vcpu on the per vcpu king.

Sorry, I can't parse this sentence. What is "per vcpu king"?

Oh, "king" should be "kind".

Yes, king = kind, sorry for that

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines

---
Changes since V1:
- Add conditional statement in order to have a difference
between
per_vcpu and per_dom return error.

---
 xen/arch/x86/hvm/save.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/save.c +1 -1
index d520898843..1764fb0918 100644
@@ -165,7 +165,8 @@ int hvm_save_one(struct domain *d, unsigned
 int typecode, unsigned int instance,
     if ( (rv = hvm_sr_handlers[typecode].save(v, &ctxt)) != 0 )
         printk(XENLOG_G_ERR "HVM%d save: failed to save type
 %"PRIu16" (%d)\n",
                d->domain_id, typecode, rv);
-    else if ( rv = -ENOENT, ctxt.cur >= sizeof(*desc) )
+    else if ( rv = hvm_sr_handlers[typecode].kind ==

HVMSR_PER_VCPU ?
+ -ENODATA : -ENOENT, ctxt.cur >= sizeof(*desc) )

     {
         uint32_t off;
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.17.1

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

Acked-by on v2 1/1
#4 lore raw
In reply to Alexandru Isaila

xen/arch/x86/hvm/save.c int hvm_save_one(struct domain *d, unsigned int typecode, unsigned int instance, · line 169

Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 21.09.18 at 09:30, <[email protected]> wrote:
xen/arch/x86/hvm/save.c +2 -1
@@ -165,7 +165,8 @@ int hvm_save_one(struct domain *d, unsigned int typecode, unsigned int instance,
     if ( (rv = hvm_sr_handlers[typecode].save(v, &ctxt)) != 0 )
         printk(XENLOG_G_ERR "HVM%d save: failed to save type %"PRIu16" (%d)\n",
                d->domain_id, typecode, rv);
-    else if ( rv = -ENOENT, ctxt.cur >= sizeof(*desc) )
+    else if ( rv = hvm_sr_handlers[typecode].kind == HVMSR_PER_VCPU ?
+              -ENODATA : -ENOENT, ctxt.cur >= sizeof(*desc) )

This very certainly needs parenthesizes, since if asked explicitly I don't think many people will be able to quickly answer the question of precedence between the ?: and , operators. I'm happy to add these while committing, and with them in place

Jan

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

#5 lore raw
Quoted 19 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 21.09.18 at 09:30, <[email protected]> wrote:
xen/arch/x86/hvm/save.c +1 -1
@@ -165,7 +165,8 @@ int hvm_save_one(struct domain *d, unsigned int
 typecode, unsigned int instance,
     if ( (rv = hvm_sr_handlers[typecode].save(v, &ctxt)) != 0 )
         printk(XENLOG_G_ERR "HVM%d save: failed to save type
 %"PRIu16" (%d)\n",
                d->domain_id, typecode, rv);
-    else if ( rv = -ENOENT, ctxt.cur >= sizeof(*desc) )
+    else if ( rv = hvm_sr_handlers[typecode].kind ==
Quoted 2 lines

HVMSR_PER_VCPU ?
+ -ENODATA : -ENOENT, ctxt.cur >= sizeof(*desc) )

This very certainly needs parenthesizes, since if asked explicitly I don't think many people will be able to quickly answer the question of precedence between the ?: and , operators. I'm happy to add these while committing, and with them in place

Quoted 2 lines

Ok, thanks for the help.

Alex

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