xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Josh Whitehead <josh.whitehead@dornerworks.com>,
	Meng Xu <mengxu@cis.upenn.edu>,
	Robert VanVossen <robert.vanvossen@dornerworks.com>
Subject: [PATCH 2/3] xen: sched: add wakeup flags to the scheduler interface
Date: Thu, 11 Feb 2016 12:38:53 +0100	[thread overview]
Message-ID: <20160211113853.20959.36796.stgit@Solace.station> (raw)
In-Reply-To: <20160211113321.20959.53804.stgit@Solace.station>

For making it possible to pass to the specific scheduler
code information about the nature of the wakeup, and let
it act accordingly, if necessary.

For now, this will only be useful to Credit1, that needs
to differentiate between 'regular' wakeups (happening,
for instance, because an I/O event), and wakeups
"artificially induced" for migrating a vCPU to another
pCPU.

In this patch, only the WF_wakeup flag is introduced, and
used everything. In fact, instead of changing the prototype
of vcpu_wake(), the _vcpu_wake() helper is introduced. This
can change, in case, at some point, the majority of wakeup
paths will end up wanting to pass a flag.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Josh Whitehead <josh.whitehead@dornerworks.com>
Cc: Robert VanVossen <robert.vanvossen@dornerworks.com>
Cc: Meng Xu <mengxu@cis.upenn.edu>
---
 xen/common/sched_arinc653.c |    2 +-
 xen/common/sched_credit.c   |    2 +-
 xen/common/sched_credit2.c  |    2 +-
 xen/common/sched_rt.c       |    2 +-
 xen/common/schedule.c       |    9 +++++++--
 xen/include/xen/sched-if.h  |    3 ++-
 xen/include/xen/sched.h     |    7 +++++++
 7 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c
index 0606988..b8ea596 100644
--- a/xen/common/sched_arinc653.c
+++ b/xen/common/sched_arinc653.c
@@ -537,7 +537,7 @@ a653sched_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc)
  * @param vc        Pointer to the VCPU structure for the current domain
  */
 static void
-a653sched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc)
+a653sched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc, unsigned wf)
 {
     if ( AVCPU(vc) != NULL )
         AVCPU(vc)->awake = 1;
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index 5708701..f728ddd 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -983,7 +983,7 @@ csched_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc)
 }
 
 static void
-csched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc)
+csched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc, unsigned wf)
 {
     struct csched_vcpu * const svc = CSCHED_VCPU(vc);
     const unsigned int cpu = vc->processor;
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index 78220a7..a8ba61d 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -940,7 +940,7 @@ csched2_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc)
 }
 
 static void
-csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc)
+csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc, unsigned wf)
 {
     struct csched2_vcpu * const svc = CSCHED2_VCPU(vc);
     s_time_t now = 0;
diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c
index 2e5430f..4ee1fce 100644
--- a/xen/common/sched_rt.c
+++ b/xen/common/sched_rt.c
@@ -1022,7 +1022,7 @@ out:
  * TODO: what if these two vcpus belongs to the same domain?
  */
 static void
-rt_vcpu_wake(const struct scheduler *ops, struct vcpu *vc)
+rt_vcpu_wake(const struct scheduler *ops, struct vcpu *vc, unsigned wf)
 {
     struct rt_vcpu * const svc = rt_vcpu(vc);
     s_time_t now = NOW();
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 7306d71..ea74c96 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -406,7 +406,7 @@ void vcpu_sleep_sync(struct vcpu *v)
     sync_vcpu_execstate(v);
 }
 
-void vcpu_wake(struct vcpu *v)
+static void _vcpu_wake(struct vcpu *v, unsigned wake_flags)
 {
     unsigned long flags;
     spinlock_t *lock = vcpu_schedule_lock_irqsave(v, &flags);
@@ -415,7 +415,7 @@ void vcpu_wake(struct vcpu *v)
     {
         if ( v->runstate.state >= RUNSTATE_blocked )
             vcpu_runstate_change(v, RUNSTATE_runnable, NOW());
-        SCHED_OP(VCPU2OP(v), wake, v);
+        SCHED_OP(VCPU2OP(v), wake, v, wake_flags);
     }
     else if ( !(v->pause_flags & VPF_blocked) )
     {
@@ -428,6 +428,11 @@ void vcpu_wake(struct vcpu *v)
     TRACE_2D(TRC_SCHED_WAKE, v->domain->domain_id, v->vcpu_id);
 }
 
+void vcpu_wake(struct vcpu *v)
+{
+    return _vcpu_wake(v, WF_wakeup);
+}
+
 void vcpu_unblock(struct vcpu *v)
 {
     if ( !test_and_clear_bit(_VPF_blocked, &v->pause_flags) )
diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h
index 66dc9c8..ea1cd4a 100644
--- a/xen/include/xen/sched-if.h
+++ b/xen/include/xen/sched-if.h
@@ -144,7 +144,8 @@ struct scheduler {
     void         (*remove_vcpu)    (const struct scheduler *, struct vcpu *);
 
     void         (*sleep)          (const struct scheduler *, struct vcpu *);
-    void         (*wake)           (const struct scheduler *, struct vcpu *);
+    void         (*wake)           (const struct scheduler *, struct vcpu *,
+                                    unsigned int);
     void         (*yield)          (const struct scheduler *, struct vcpu *);
     void         (*context_saved)  (const struct scheduler *, struct vcpu *);
 
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index b47a3fe..9fdcfff 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -758,6 +758,13 @@ static inline struct domain *next_domain_in_cpupool(
 #define _VPF_in_reset        7
 #define VPF_in_reset         (1UL<<_VPF_in_reset)
 
+/*
+ * VCPU wake up flags.
+ */
+/* 'Default' wakeup. */
+#define _WF_wakeup           0
+#define WF_wakeup            (1U<<_WF_wakeup)
+
 static inline int vcpu_runnable(struct vcpu *v)
 {
     return !(v->pause_flags |

  parent reply	other threads:[~2016-02-11 11:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 11:38 [PATCH 0/3] xen: sched: Credit1 shouldn't boost vcpus being migrated Dario Faggioli
2016-02-11 11:38 ` [PATCH 1/3] xen: credit1: trace vCPU boost/unboost Dario Faggioli
2016-02-11 11:38 ` Dario Faggioli [this message]
2016-02-11 13:24   ` [PATCH 2/3] xen: sched: add wakeup flags to the scheduler interface Jan Beulich
2016-02-11 17:46     ` Dario Faggioli
2016-02-11 11:39 ` [PATCH 3/3] xen: credit1: avoid boosting vCPUs being "just" migrated Dario Faggioli
2016-02-11 13:30   ` Jan Beulich
2016-02-11 17:45     ` 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=20160211113853.20959.36796.stgit@Solace.station \
    --to=dario.faggioli@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=josh.whitehead@dornerworks.com \
    --cc=mengxu@cis.upenn.edu \
    --cc=robert.vanvossen@dornerworks.com \
    --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).