xen/arm: vcpu_yield on WFE
v2 cover xen/arm: vcpu_yield on WFE
Hi all,
the patches should be self-explanatory.
Changes in v2:
- do not change parameters and return value of do_yield.
Stefano Stabellini (2):
xen: export do_yield as vcpu_yield
xen/arm: call vcpu_yield on WFE trap
xen/arch/arm/traps.c | 2 +- xen/common/schedule.c | 6 +++--- xen/include/xen/sched.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-)
PATCH v2 1/2 xen: export do_yield as vcpu_yield
Changes in v2:
- do not change paramters and return value of do_yield.
--- xen/common/schedule.c | 6 +++--- xen/include/xen/sched.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
xen/common/schedule.c +3 -3
@@ -795,7 +795,7 @@ static long do_poll(struct sched_poll *sched_poll) }/* Voluntarily yield the processor for this allocation. */ -static long do_yield (void ) +long vcpu_yield (void ) {struct vcpu * v=current;spinlock_t *lock =vcpu_schedule_lock_irq (v);
@@ -888,7 +888,7 @@ long do_sched_op_compat(int cmd, unsigned long arg) {case SCHEDOP_yield: { - ret =do_yield (); + ret =vcpu_yield ();break ; }
@@ -925,7 +925,7 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) {case SCHEDOP_yield: { - ret =do_yield (); + ret =vcpu_yield ();break ; }
xen/include/xen/sched.h +1 -0
@@ -634,6 +634,7 @@ int sched_id(void);void sched_tick_suspend (void );void sched_tick_resume (void );void vcpu_wake (struct vcpu *v); +long vcpu_yield (void );void vcpu_sleep_nosync (struct vcpu *v);void vcpu_sleep_sync (struct vcpu *v);
Signature · 1 line
1.7.10.4
Re: [PATCH v2 1/2] xen: export do_yield as vcpu_yield
Quoted 3 lines · Stefano Stabellini
Quoted 51 lines
Changes in v2:
- do not change paramters and return value ofdo_yield.--- xen/common/schedule.c | 6 +++--- xen/include/xen/sched.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)xen/common/schedule.c +3
-3@@ -795,7 +795,7 @@ static long do_poll(struct sched_poll *sched_poll) }/* Voluntarily yield the processor for this allocation. */ -static long do_yield (void ) +long vcpu_yield (void ) {struct vcpu * v=current;spinlock_t *lock =vcpu_schedule_lock_irq (v);@@ -888,7 +888,7 @@ long do_sched_op_compat(int cmd, unsigned long arg) {case SCHEDOP_yield: { - ret =do_yield (); + ret =vcpu_yield ();break ; }@@ -925,7 +925,7 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) {case SCHEDOP_yield: { - ret =do_yield (); + ret =vcpu_yield ();break ; }xen/include/xen/sched.h +1
-0@@ -634,6 +634,7 @@ int sched_id(void);void sched_tick_suspend (void );void sched_tick_resume (void );void vcpu_wake (struct vcpu *v); +long vcpu_yield (void );void vcpu_sleep_nosync (struct vcpu *v);void vcpu_sleep_sync (struct vcpu *v);
PATCH v2 2/2 xen/arm: call vcpu_yield on WFE trap
In reply to Stefano StabelliniNo need to call vcpu_force_reschedule, is too expensive.
--- xen/arch/arm/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/traps.c +1 -1
@@ -1805,7 +1805,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs) }if ( hsr.wfi_wfe.ti ) {/* Yield the VCPU for WFE */ -vcpu_force_reschedule (current); +vcpu_yield (); }else {/* Block the VCPU for WFI */ vcpu_block_unless_event_pending (current);
Signature · 1 line
1.7.10.4
Quoted 1 line · Stefano Stabellini
Hi all,
Hi Stefano,
Quoted 1 line
the patches should be self-explanatory.
I gave a try of this series on midway and hackbench get stuck after few minutes.
FYI, I'm not able to reproduce on our local midway node.
Regards,
Quoted 13 lines
Changes in v2:
- do not change parameters and return value ofdo_yield.Stefano Stabellini (2):
xen: exportdo_yieldasvcpu_yield
xen/arm: callvcpu_yieldon WFE trapxen/arch/arm/traps.c | 2 +- xen/common/schedule.c | 6 +++--- xen/include/xen/sched.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
Julien Grall
Quoted 9 lines · Julien Grall
Quoted 1 line · Stefano Stabellini
Hi all,
Hi Stefano,
Quoted 1 line
the patches should be self-explanatory.
I gave a try of this series on midway and hackbench get stuck after few minutes.
Just as a confirmation, you did run hackbench before on midway and it didn't get stuck, right?
Quoted 1 line
FYI, I'm not able to reproduce on our local midway node.
Without a reproducing environment is going to be very hard to fix it. It might be worth living it running in a loop for a few hours...
Quoted 20 lines
Regards,
Quoted 13 lines
Changes in v2:
- do not change parameters and return value ofdo_yield.Stefano Stabellini (2):
xen: exportdo_yieldasvcpu_yield
xen/arm: callvcpu_yieldon WFE trapxen/arch/arm/traps.c | 2 +- xen/common/schedule.c | 6 +++--- xen/include/xen/sched.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-)Signature · 1 line
Julien Grall
Quoted 6 lines · Stefano Stabellini
Quoted 5 lines · Julien Grall
Quoted 1 line · Stefano Stabellini
Hi all,
Hi Stefano,
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
the patches should be self-explanatory.
I gave a try of this series on midway and hackbench get stuck after few minutes.
Just as a confirmation, you did run hackbench before on midway and it didn't get stuck, right?
Yes. The latest working version is c047211.
I got 2 different kind of errors with a guest setup with 2 VCPUs:
1) Hackbench gets stuck and use 100% of the CPU.
2) Hackbench heap gets corrupted
For the former, I was thinking about a possible missing SGI.
Quoted 4 lines
Quoted 1 line
FYI, I'm not able to reproduce on our local midway node.
Without a reproducing environment is going to be very hard to fix it. It might be worth living it running in a loop for a few hours...
Sorry I meant I'm able. I spent my afternoon to set up the same environment as the CI loop.
It looks like the bug is likely the same on the Arndale, even if WFE is not trap. I will try to bisect on this board.
Regards,
Signature · 1 line
Julien Grall
Quoted 25 lines · Julien Grall
Quoted 6 lines · Stefano Stabellini
Quoted 5 lines · Julien Grall
Quoted 1 line · Stefano Stabellini
Hi all,
Hi Stefano,
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
the patches should be self-explanatory.
I gave a try of this series on midway and hackbench get stuck after few minutes.
Just as a confirmation, you did run hackbench before on midway and it didn't get stuck, right?
Yes. The latest working version is c047211.
I got 2 different kind of errors with a guest setup with 2 VCPUs:
1) Hackbench gets stuck and use 100% of the CPU.
2) Hackbench heap gets corruptedFor the former, I was thinking about a possible missing SGI.
Quoted 2 lines
Quoted 1 line
FYI, I'm not able to reproduce on our local midway node.
Quoted 8 lines
Quoted 2 lines
Without a reproducing environment is going to be very hard to fix it. It might be worth living it running in a loop for a few hours...
Sorry I meant I'm able. I spent my afternoon to set up the same environment as the CI loop.
It looks like the bug is likely the same on the Arndale, even if WFE is not trap. I will try to bisect on this board.
Hrmmmm, I misread the CI log [1]. The Arndale is working fine without this patch.
I'm able to confirm to confirm this behavior locally on my board. So both Midway and the Arndale is impacted with this bug. Even though it took a bit longer to reproduce the issue on the Arndale.
With your series, the benchmark is broken on midway and working on the Arndale. So there is a hidden bug at least on ARM32.
Signature · 1 line
Julien Grall
Ian Campbell
AppliedQuoted 3 lines · Stefano Stabellini
Stefano Stabellini (2):
xen: exportdo_yieldasvcpu_yield
xen/arm: callvcpu_yieldon WFE trap
Applied.
Ian.