* [for-4.8 PATCH v2] xen: credit2: fix wrong assert in runq_tickle().
@ 2016-11-22 12:51 Dario Faggioli
2016-11-22 12:52 ` Wei Liu
0 siblings, 1 reply; 2+ messages in thread
From: Dario Faggioli @ 2016-11-22 12:51 UTC (permalink / raw)
To: xen-devel; +Cc: Wei Liu, George Dunlap, Jan Beulich
Since b047f888d489 ("xen: sched: leave CPUs doing tasklet
work alone") a cpu executing a tasklet, is not marked as
idle.
Therefore:
- avoid asserting that we can't find the idle vcpu running
on one of them, which is not true,
- avoid triggering a preemption on them (and add an assert
checking that).
This fixes a bug identified by OSSTest, in flight 102372
(on ARM, but it's not at all ARM specific), where the
ASSERT() was triggering like this:
(XEN) Xen call trace:
(XEN) [<0022af78>] sched_credit2.c#runq_tickle+0x3e8/0x61c (PC)
(XEN) [<0022aedc>] sched_credit2.c#runq_tickle+0x34c/0x61c (LR)
(XEN) [<0022b644>] sched_credit2.c#csched2_context_saved+0x128/0x1a4
(XEN) [<0023303c>] context_saved+0x7c/0xa4
(XEN) [<0024f660>] domain.c#schedule_tail+0x2b4/0x308
(XEN) [<0024faac>] context_switch+0x80/0x94
(XEN) [<0022ff48>] schedule.c#schedule+0x76c/0x7ec
(XEN) [<002338d4>] softirq.c#__do_softirq+0xcc/0xec
(XEN) [<00233968>] do_softirq+0x18/0x28
(XEN) [<00261084>] leave_hypervisor_tail+0x58/0x88
(XEN) [<002649d0>] entry.o#return_to_guest+0xc/0xb8
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 1:
(XEN) Assertion '!is_idle_vcpu(cur->vcpu)' failed at sched_credit2.c:1009
(XEN) ****************************************
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes from v1:
* ASSERT() moved down, as suggested during review.
---
xen/common/sched_credit2.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index 1f26553..c2c563d 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -1006,7 +1006,12 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now)
cur = CSCHED2_VCPU(curr_on_cpu(i));
- ASSERT(!is_idle_vcpu(cur->vcpu));
+ /*
+ * Even if the cpu is not in rqd->idle, it may be running the
+ * idle vcpu, if it's doing tasklet work. Just skip it.
+ */
+ if ( is_idle_vcpu(cur->vcpu) )
+ continue;
/* Update credits for current to see if we want to preempt. */
burn_credits(rqd, cur, now);
@@ -1042,6 +1047,7 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now)
return;
}
+ ASSERT(!is_idle_vcpu(curr_on_cpu(ipid)));
SCHED_STAT_CRANK(tickled_busy_cpu);
tickle:
BUG_ON(ipid == -1);
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [for-4.8 PATCH v2] xen: credit2: fix wrong assert in runq_tickle().
2016-11-22 12:51 [for-4.8 PATCH v2] xen: credit2: fix wrong assert in runq_tickle() Dario Faggioli
@ 2016-11-22 12:52 ` Wei Liu
0 siblings, 0 replies; 2+ messages in thread
From: Wei Liu @ 2016-11-22 12:52 UTC (permalink / raw)
To: Dario Faggioli; +Cc: xen-devel, Wei Liu, George Dunlap, Jan Beulich
On Tue, Nov 22, 2016 at 01:51:02PM +0100, Dario Faggioli wrote:
> Since b047f888d489 ("xen: sched: leave CPUs doing tasklet
> work alone") a cpu executing a tasklet, is not marked as
> idle.
>
> Therefore:
> - avoid asserting that we can't find the idle vcpu running
> on one of them, which is not true,
> - avoid triggering a preemption on them (and add an assert
> checking that).
>
> This fixes a bug identified by OSSTest, in flight 102372
> (on ARM, but it's not at all ARM specific), where the
> ASSERT() was triggering like this:
>
> (XEN) Xen call trace:
> (XEN) [<0022af78>] sched_credit2.c#runq_tickle+0x3e8/0x61c (PC)
> (XEN) [<0022aedc>] sched_credit2.c#runq_tickle+0x34c/0x61c (LR)
> (XEN) [<0022b644>] sched_credit2.c#csched2_context_saved+0x128/0x1a4
> (XEN) [<0023303c>] context_saved+0x7c/0xa4
> (XEN) [<0024f660>] domain.c#schedule_tail+0x2b4/0x308
> (XEN) [<0024faac>] context_switch+0x80/0x94
> (XEN) [<0022ff48>] schedule.c#schedule+0x76c/0x7ec
> (XEN) [<002338d4>] softirq.c#__do_softirq+0xcc/0xec
> (XEN) [<00233968>] do_softirq+0x18/0x28
> (XEN) [<00261084>] leave_hypervisor_tail+0x58/0x88
> (XEN) [<002649d0>] entry.o#return_to_guest+0xc/0xb8
> (XEN)
> (XEN) ****************************************
> (XEN) Panic on CPU 1:
> (XEN) Assertion '!is_idle_vcpu(cur->vcpu)' failed at sched_credit2.c:1009
> (XEN) ****************************************
>
> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-22 12:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-22 12:51 [for-4.8 PATCH v2] xen: credit2: fix wrong assert in runq_tickle() Dario Faggioli
2016-11-22 12:52 ` Wei Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).