xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Haoran Li <naroahlee@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: mengxu@cis.upenn.edu, naroahlee <naroahlee@gmail.com>
Subject: [RTDS Patch for Xen4.8] xen: sched_rt.c Check not_tickled Mask
Date: Wed, 22 Feb 2017 16:16:34 -0600	[thread overview]
Message-ID: <1487801794-5506-1-git-send-email-naroahlee@gmail.com> (raw)

From: naroahlee <naroahlee@gmail.com>

   Modify: xen/common/sched_rt.c runq_tickle(): Check not_tickled Mask
for a Cache-Preferenced-PCPU  

The bug is introduced in Xen 4.7 when we converted RTDS scheduler from
quantum-driven model to event-driven model. We assumed whenever 
runq_tickle() is invoked, we will find a PCPU via a NOT-tickled mask.
However, in runq_tickle(): Case1: Pick Cache Preference
IDLE-PCPU is NOT masked by the not-tickled CPU mask.

Buggy behavior:
When two VCPUs tried to tickle a IDLE-VCPU, which is now on their
cache-preference PCPU, these two VCPU will tickle the same PCPU in a row.
However, only one VCPU is guranteed to be scheduled, because runq_pick()
would be executed only once in rt_schedule().
That means, another VCPU will lost (be descheduled) a Period.

Bug Analysis:
We need to exclude tickled VCPUs when trying to evaluate runq_tickle() case 1

Signed-off-by: Haoran Li <naroahlee@gmail.com>
---
 xen/common/sched_rt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c
index 1b30014..777192f 100644
--- a/xen/common/sched_rt.c
+++ b/xen/common/sched_rt.c
@@ -1175,7 +1175,8 @@ runq_tickle(const struct scheduler *ops, struct rt_vcpu *new)
     cpumask_andnot(&not_tickled, &not_tickled, &prv->tickled);
 
     /* 1) if new's previous cpu is idle, kick it for cache benefit */
-    if ( is_idle_vcpu(curr_on_cpu(new->vcpu->processor)) )
+    if ( is_idle_vcpu(curr_on_cpu(new->vcpu->processor)) &&
+         cpumask_test_cpu(new->vcpu->processor, &not_tickled))
     {
         SCHED_STAT_CRANK(tickled_idle_cpu);
         cpu_to_tickle = new->vcpu->processor;
-- 
1.9.1

---
CC: <mengxu@cis.upenn.edu>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

             reply	other threads:[~2017-02-22 22:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22 22:16 Haoran Li [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-02-22 22:59 [RTDS Patch for Xen4.8] xen: sched_rt.c Check not_tickled Mask Meng Xu
2017-02-24 16:58 ` Dario Faggioli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487801794-5506-1-git-send-email-naroahlee@gmail.com \
    --to=naroahlee@gmail.com \
    --cc=mengxu@cis.upenn.edu \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).