From patchwork Thu Feb 11 11:38:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 8277971 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 67FF1BEEE5 for ; Thu, 11 Feb 2016 11:41:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61EEA20364 for ; Thu, 11 Feb 2016 11:41:34 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9C61320377 for ; Thu, 11 Feb 2016 11:41:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aTpaN-0005vr-6H; Thu, 11 Feb 2016 11:38:59 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aTpaM-0005vd-DG for xen-devel@lists.xenproject.org; Thu, 11 Feb 2016 11:38:58 +0000 Received: from [193.109.254.147] by server-3.bemta-14.messagelabs.com id B2/BE-25435-1D27CB65; Thu, 11 Feb 2016 11:38:57 +0000 X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-15.tower-27.messagelabs.com!1455190736!23074761!1 X-Originating-IP: [74.125.82.65] X-SpamReason: No, hits=0.2 required=7.0 tests=RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 55497 invoked from network); 11 Feb 2016 11:38:56 -0000 Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by server-15.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 11 Feb 2016 11:38:56 -0000 Received: by mail-wm0-f65.google.com with SMTP id g62so10140135wme.2 for ; Thu, 11 Feb 2016 03:38:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=wSeYxvODaj5DN2ngQjuA3fjslEf41Ys7FGdcy2LTEA8=; b=c0p7QEALHoDcV/Bl5yBivan8shuDI+Fj4qBd7QUmAm2C2Z4qxUY7scGwZBoSNvFMOK OFI5OnipIvKwd7JaoDqi813pr2m26C2p3+lAEULEBEAm8Vxyf/Nn7L1xpSHCVI53/vGc g51dzxF4/R/1kXLtPC1Ue9wUGdJVHVDDTEuy4fY7SNZvXEzVQQcky0Kr4u6DO6jTn4jk ivm+tPps6zR569LMdM4ddKso6vT+Pmat7sWpHUcniXf27KPB5WWkjkbrx23togWMcxFE VHwWnM7lvD8uu+z7p+lHsoC1/YhwLPSBbsAjXUsFUn6ogHX6tqKAEVfkkEPS1HS5/g9K 0VwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version:content-type :content-transfer-encoding; bh=wSeYxvODaj5DN2ngQjuA3fjslEf41Ys7FGdcy2LTEA8=; b=RLabRjqhtjvVcmAXVK6k9jy0BHiujDJqzaNNX6lIVqfzxsQp1uX7x7luJxcbTJp7vF LK6rS8lNzqI8H9H3dWS9mphuwaL/CNzsiJn1dw3SAGFKvJd0IYQOY+GooG33nwvfjChB UHPUgrLxyXCg+U2VYcCAR5uhQAHkOhaNsW1uDb1LGz9GmSEHJVXyJNNXouInGJdnRJbN Wb5jV9fIzkY6pEabmiomDKaG3Bm1RWvvzJUvlQ2SBiE4y8S5lnGn6QA48pLu45t9m6Rz EC+Y2MaTWOvzrza0V2bSaKyAbQATt4LArfebHeY3MaXnxRRLTDwmzSO7N46rQXxUQwnq M9AQ== X-Gm-Message-State: AG10YOQT+ahmr2kucIWl8PKAj8J3bV6LfRNGgBYgseb2CW1jjalaLlm1qKYi3n/j/TZaYQ== X-Received: by 10.28.139.147 with SMTP id n141mr17750612wmd.53.1455190736630; Thu, 11 Feb 2016 03:38:56 -0800 (PST) Received: from Solace.station (net-2-35-170-8.cust.vodafonedsl.it. [2.35.170.8]) by smtp.gmail.com with ESMTPSA id z65sm2027129wmg.1.2016.02.11.03.38.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Feb 2016 03:38:55 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Thu, 11 Feb 2016 12:38:53 +0100 Message-ID: <20160211113853.20959.36796.stgit@Solace.station> In-Reply-To: <20160211113321.20959.53804.stgit@Solace.station> References: <20160211113321.20959.53804.stgit@Solace.station> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap , Josh Whitehead , Meng Xu , Robert VanVossen Subject: [Xen-devel] [PATCH 2/3] xen: sched: add wakeup flags to the scheduler interface X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Cc: George Dunlap Cc: Josh Whitehead Cc: Robert VanVossen Cc: Meng Xu --- 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 |