credit2: fix credit reset happening too few times
authorDario Faggioli <dfaggioli@suse.com>
Fri, 3 Apr 2020 08:46:53 +0000 (10:46 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 3 Apr 2020 08:46:53 +0000 (10:46 +0200)
commitdae7b62e976b28af9c8efa150618c25501bf1650
tree60c2acebaaaa1215bf403c416cd9786282c590b3
parent36f3662f27dec32d76c0edb4c6b62b9628d6869d
credit2: fix credit reset happening too few times

There is a bug in commit 5e4b4199667b9 ("xen: credit2: only reset
credit on reset condition"). In fact, the aim of that commit was to
make sure that we do not perform too many credit reset operations
(which are not super cheap, and in an hot-path). But the check used
to determine whether a reset is necessary was the wrong one.

In fact, knowing just that some vCPUs have been skipped, while
traversing the runqueue (in runq_candidate()), is not enough. We
need to check explicitly whether the first vCPU in the runqueue
has a negative amount of credit.

Since a trace record is changed, this patch updates xentrace format file
and xenalyze as well

This should be backported.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
tools/xentrace/formats
tools/xentrace/xenalyze.c
xen/common/sched/credit2.c