xen/arch/x86/hvm/hvm.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/hvm/viridian/viridian.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/common/sched/core.c | 2 +- xen/include/xen/sched.h | 1 + 6 files changed, 6 insertions(+), 5 deletions(-)
do_sched_op(SCHEDOP_yield) just calls vcpu_yield(). Remove the indirection
through the hypercall handler and use the function directly.
Perform the same for SCHEDOP_block.
Not a functional change.
Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
---
v2:
- For SCHEDOP_block case: export and use vcpu_block_enable_events instead
---
xen/arch/x86/hvm/hvm.c | 2 +-
xen/arch/x86/hvm/svm/svm.c | 2 +-
xen/arch/x86/hvm/viridian/viridian.c | 2 +-
xen/arch/x86/hvm/vmx/vmx.c | 2 +-
xen/common/sched/core.c | 2 +-
xen/include/xen/sched.h | 1 +
6 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 4cb2e13046..e2720daf1e 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1736,7 +1736,7 @@ void hvm_hlt(unsigned int eflags)
if ( unlikely(!(eflags & X86_EFLAGS_IF)) )
return hvm_vcpu_down(curr);
- do_sched_op(SCHEDOP_block, guest_handle_from_ptr(NULL, void));
+ vcpu_block_enable_events();
TRACE(TRC_HVM_HLT, /* pending = */ vcpu_runnable(curr));
}
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index e33a38c1e4..b0bcd4b1e7 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2159,7 +2159,7 @@ static void svm_vmexit_do_pause(struct cpu_user_regs *regs)
* Do something useful, like reschedule the guest
*/
perfc_incr(pauseloop_exits);
- do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
+ vcpu_yield();
}
static void
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 33d54e587e..7ea6c90168 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -959,7 +959,7 @@ int viridian_hypercall(struct cpu_user_regs *regs)
/*
* See section 14.5.1 of the specification.
*/
- do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
+ vcpu_yield();
break;
case HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE:
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d8879c304e..1b9fbc4f4e 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4768,7 +4768,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
case EXIT_REASON_PAUSE_INSTRUCTION:
perfc_incr(pauseloop_exits);
- do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
+ vcpu_yield();
break;
case EXIT_REASON_XSETBV:
diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 9043414290..b1e831df9d 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -1431,7 +1431,7 @@ void vcpu_block(void)
}
}
-static void vcpu_block_enable_events(void)
+void vcpu_block_enable_events(void)
{
local_event_delivery_enable();
vcpu_block();
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index fe53d4fab7..45bc40ed07 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1030,6 +1030,7 @@ static inline bool vcpu_cpu_dirty(const struct vcpu *v)
}
void vcpu_block(void);
+void vcpu_block_enable_events(void);
void vcpu_unblock(struct vcpu *v);
void vcpu_pause(struct vcpu *v);
--
2.50.1
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
On 31.07.25 11:10, Teddy Astie wrote: > do_sched_op(SCHEDOP_yield) just calls vcpu_yield(). Remove the indirection > through the hypercall handler and use the function directly. > > Export vcpu_block_enable_events() to perform the same for SCHEDOP_block. > > Not a functional change. > > Signed-off-by: Teddy Astie <teddy.astie@vates.tech> > Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Juergen Gross <jgross@suse.com> Juergen
On 23/07/2025 10:05 am, Teddy Astie wrote: > do_sched_op(SCHEDOP_yield) just calls vcpu_yield(). Remove the indirection > through the hypercall handler and use the function directly. > > Perform the same for SCHEDOP_block. > > Not a functional change. > > Signed-off-by: Teddy Astie <teddy.astie@vates.tech> > --- > v2: > - For SCHEDOP_block case: export and use vcpu_block_enable_events instead You need to adjust the commit message for this change, now that you're exporting vcpu_block_enable_events(). With that adjusted, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> If there are no other changes needed, you can propose some updated wording here and it can be adjusted on commit. ~Andrew
Le 23/07/2025 à 13:16, Andrew Cooper a écrit : > On 23/07/2025 10:05 am, Teddy Astie wrote: >> do_sched_op(SCHEDOP_yield) just calls vcpu_yield(). Remove the indirection >> through the hypercall handler and use the function directly. >> >> Perform the same for SCHEDOP_block. >> >> Not a functional change. >> >> Signed-off-by: Teddy Astie <teddy.astie@vates.tech> >> --- >> v2: >> - For SCHEDOP_block case: export and use vcpu_block_enable_events instead > > You need to adjust the commit message for this change, now that you're > exporting vcpu_block_enable_events(). > > With that adjusted, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> > > If there are no other changes needed, you can propose some updated > wording here and it can be adjusted on commit. > Are you ok with Export vcpu_block_enable_events() to perform the same for SCHEDOP_block. (in place of "Perform the same for SCHEDOP_block") ? > ~Andrew Teddy Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
On 23/07/2025 12:57 pm, Teddy Astie wrote: > Le 23/07/2025 à 13:16, Andrew Cooper a écrit : >> On 23/07/2025 10:05 am, Teddy Astie wrote: >>> do_sched_op(SCHEDOP_yield) just calls vcpu_yield(). Remove the indirection >>> through the hypercall handler and use the function directly. >>> >>> Perform the same for SCHEDOP_block. >>> >>> Not a functional change. >>> >>> Signed-off-by: Teddy Astie <teddy.astie@vates.tech> >>> --- >>> v2: >>> - For SCHEDOP_block case: export and use vcpu_block_enable_events instead >> You need to adjust the commit message for this change, now that you're >> exporting vcpu_block_enable_events(). >> >> With that adjusted, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> >> >> If there are no other changes needed, you can propose some updated >> wording here and it can be adjusted on commit. >> > Are you ok with > > Export vcpu_block_enable_events() to perform the same for SCHEDOP_block. > > (in place of "Perform the same for SCHEDOP_block") > > ? Yeah, that looks fine. ~Andrew
© 2016 - 2025 Red Hat, Inc.