Skip to contentSkip to conversation

x86/shim: fix ballooning up the guest

PATCH In review Igor Druzhinin 3 participants 4 messages Mar 16, 2020 – Mar 18, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/shim: fix ballooning up the guest

args.preempted as meaningless here and doesn't show if the hypercall was preempted before. Use start_extent instead which is correct.

---
This fixes ballooning for 64-bit PV guests inside shim. 32-bit PV guests require a little bit more work due to compat layer being involved.

---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/memory.c +1 -1
index 444c081..5fdd2a2 100644
@@ -1191,7 +1191,7 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         }
 
 #ifdef CONFIG_X86
-        if ( pv_shim && op != XENMEM_decrease_reservation && !args.preempted )
+        if ( pv_shim && op != XENMEM_decrease_reservation && !start_extent )
             /* Avoid calling pv_shim_online_memory when preempted. */
             pv_shim_online_memory(args.nr_extents, args.extent_order);
 #endif
Signature · 7 lines
2.7.4


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

args.preempted as meaningless here and doesn't show if the hypercall was preempted before. Use start_extent instead which is correct.

... as long as the hypercall was invoked in a "normal" way.

Quoted 13 lines

---
This fixes ballooning for 64-bit PV guests inside shim. 32-bit PV guests require a little bit more work due to compat layer being involved.

---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/memory.c +0 -0
index 444c081..5fdd2a2 100644

xen/common/memory.c long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) · line 1196

Quoted 7 lines
xen/common/memory.c +1 -1
@@ -1191,7 +1191,7 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         }
 
 #ifdef CONFIG_X86
-        if ( pv_shim && op != XENMEM_decrease_reservation && !args.preempted )
+        if ( pv_shim && op != XENMEM_decrease_reservation && !start_extent )
             /* Avoid calling pv_shim_online_memory when preempted. */
             pv_shim_online_memory(args.nr_extents, args.extent_order);

The code change can have my R-b, but I'd like the comment to also be changed then - it shouldn't talk about preemption in the way it does. Perhaps "... when this is a continuation"? I'd be okay making this change while committing.

As an aside, it would probably have been a good idea to also Cc Roger as the original author of this code.

Jan

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

#2 lore raw
Quoted 21 lines · Jan Beulich
Quoted 2 lines · Igor Druzhinin

args.preempted as meaningless here and doesn't show if the hypercall was preempted before. Use start_extent instead which is correct.

... as long as the hypercall was invoked in a "normal" way.

Quoted 15 lines

---
This fixes ballooning for 64-bit PV guests inside shim. 32-bit PV guests require a little bit more work due to compat layer being involved.

---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/memory.c +0 -0
index 444c081..5fdd2a2 100644
@@ -1191,7 +1191,7 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         }
 
Quoted 10 lines

xen/common/memory.c long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) · line 1196

Quoted 5 lines
xen/common/memory.c +1 -1
 #ifdef CONFIG_X86
-        if ( pv_shim && op != XENMEM_decrease_reservation && !args.preempted )
+        if ( pv_shim && op != XENMEM_decrease_reservation && !start_extent )
             /* Avoid calling pv_shim_online_memory when preempted. */
             pv_shim_online_memory(args.nr_extents, args.extent_order);

The code change can have my R-b, but I'd like the comment to also be changed then - it shouldn't talk about preemption in the way it does. Perhaps "... when this is a continuation"? I'd be okay making this change while committing.

Sure, if you like.

Quoted 2 lines

As an aside, it would probably have been a good idea to also Cc Roger as the original author of this code.

I didn't check "git blame" and he wasn't on a maintainers list.

Igor

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

Reviewed-by on v1 1/1
#3 lore raw
In reply to Igor Druzhinin
Quoted 1 line · Igor Druzhinin

args.preempted as meaningless here and doesn't show if the hypercall

^ is ^ as it doesn't signal whether the hypercall ...

Quoted 3 lines

was preempted before. Use start_extent instead which is correct.

FWIW, I agree with the change to the comment requested by Jan, I think this can all be done while committing.

Thanks, Roger.

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