From patchwork Fri Mar 18 19:04:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 8623241 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4580E9F6E1 for ; Fri, 18 Mar 2016 19:06:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A86F2022A for ; Fri, 18 Mar 2016 19:06:42 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F9A120306 for ; Fri, 18 Mar 2016 19:06:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agzgz-0008Pq-T7; Fri, 18 Mar 2016 19:04:13 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agzgz-0008PU-AE for xen-devel@lists.xenproject.org; Fri, 18 Mar 2016 19:04:13 +0000 Received: from [193.109.254.147] by server-3.bemta-14.messagelabs.com id A0/0A-03304-C215CE65; Fri, 18 Mar 2016 19:04:12 +0000 X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1458327851!32369307!1 X-Originating-IP: [74.125.82.67] X-SpamReason: No, hits=0.2 required=7.0 tests=RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 45020 invoked from network); 18 Mar 2016 19:04:11 -0000 Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by server-10.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Mar 2016 19:04:11 -0000 Received: by mail-wm0-f67.google.com with SMTP id l124so8117582wmf.2 for ; Fri, 18 Mar 2016 12:04:11 -0700 (PDT) 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-transfer-encoding; bh=0E/ejmN829qL83s4tyJkh5VFkLRcUCT07PZSxang9RQ=; b=jWi9lNSMSRfiu62gL+CMkmDy0pY/nKYf5cCaCxuAvDugyjbcG0HkALu4Srz4NywhXi DdBbMNmDCX66BblD/pTVI/np7aqM111236N9YL8ikTYZGFdhyVh6KHll2++OjjHRMqVx BKUVRcSmOx1SwLM8acIi/+yovK1hHA1Y1fRWNW9AtODLTbdp5QXQYS4J2K85UFhZTWWk YkRvGGBHYE+2Gzphjrbt9q7uMD5mfxO+mrz11fEm0C52ua7Id6DH+M8MJaNWHKNDiJH4 W6zmFqzEqstbRaR30sEFCyv63awC76dtgLRFGFtZZefA7AV/L5DNWdZKkEGdPdGL8O7B qe4A== 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-transfer-encoding; bh=0E/ejmN829qL83s4tyJkh5VFkLRcUCT07PZSxang9RQ=; b=Efh3pipnSW8cQ4B2OyjBIcPep5gha5I2kKICvbqWqoOBjPBfJaqS0IbhiOYtiZaTUW //xEMG8CaZbgYwdc0/sofiUUHsm2BjwQiDmMIenDBAvmLmoybL+JJzelg2mOl3BQIfIt UVP2i3XdA3LpIrS4sAX/Qe0Aor+cw19UyVq5sdxrwd/i6x2Wxc4gZCIXoF2CVZ67Uo/B 17z/MIWJpUlurydvfcMugbJq22BS0LG9WURS84IF/k/kCdH2tHnFA5trmub0/IIrTKfn TokE9w59XTPyGmPXQ647Eqpat0hdEkvHTrCOSV7/AA1wzFOTPGhFHgjPvGhoUVts7CnY OjcQ== X-Gm-Message-State: AD7BkJKw5WLxIIpoppKVI4mfA42iw34IFdiBywiWcB01qp/S65JqskE+zP+60gRTlNn7Fw== X-Received: by 10.194.94.138 with SMTP id dc10mr20004273wjb.37.1458327851566; Fri, 18 Mar 2016 12:04:11 -0700 (PDT) Received: from Solace.station (net-2-35-170-8.cust.vodafonedsl.it. [2.35.170.8]) by smtp.gmail.com with ESMTPSA id l135sm562771wmb.13.2016.03.18.12.04.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Mar 2016 12:04:10 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 18 Mar 2016 20:04:08 +0100 Message-ID: <20160318190408.8117.13604.stgit@Solace.station> In-Reply-To: <20160318185524.8117.74837.stgit@Solace.station> References: <20160318185524.8117.74837.stgit@Solace.station> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap , Juergen Gross Subject: [Xen-devel] [PATCH 02/16] xen: sched: add .init_pdata hook to the scheduler interface X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" 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 with the purpose of decoupling the allocation phase and the initialization one, for per-pCPU data of the schedulers. This makes it possible to perform the initialization later in the pCPU bringup/assignement process, when more information (for instance, the host CPU topology) are available. This, for now, is important only for Credit2, but it can well be useful to other schedulers. Signed-off-by: Dario Faggioli Reviewed-by: Juergen Gross Reviewed-by: George Dunlap --- Cc: George Dunlap Cc: Juergen Gross --- Changes from v1: * in schedule_cpu_switch(), call to init_pdata() moved up, close to the call to alloc_pdata() (for consistency with other call sites) and prototype slightly changed. --- During v1 review, it was agreed to add ASSERTS() and comments to clarify the use of schedule_cpu_switch(). This can't be found here, but only because it has happened in another patch. --- xen/common/schedule.c | 7 +++++++ xen/include/xen/sched-if.h | 1 + 2 files changed, 8 insertions(+) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index e57b659..0627eb5 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1517,10 +1517,15 @@ static int cpu_schedule_callback( struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; + struct scheduler *sched = per_cpu(scheduler, cpu); + struct schedule_data *sd = &per_cpu(schedule_data, cpu); int rc = 0; switch ( action ) { + case CPU_STARTING: + SCHED_OP(sched, init_pdata, sd->sched_priv, cpu); + break; case CPU_UP_PREPARE: rc = cpu_schedule_up(cpu); break; @@ -1597,6 +1602,7 @@ void __init scheduler_init(void) if ( ops.alloc_pdata && !(this_cpu(schedule_data).sched_priv = ops.alloc_pdata(&ops, 0)) ) BUG(); + SCHED_OP(&ops, init_pdata, this_cpu(schedule_data).sched_priv, 0); } /* @@ -1640,6 +1646,7 @@ int schedule_cpu_switch(unsigned int cpu, struct cpupool *c) ppriv = SCHED_OP(new_ops, alloc_pdata, cpu); if ( ppriv == NULL ) return -ENOMEM; + SCHED_OP(new_ops, init_pdata, ppriv, cpu); vpriv = SCHED_OP(new_ops, alloc_vdata, idle, idle->domain->sched_priv); if ( vpriv == NULL ) { diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h index 825f1ad..70c08c6 100644 --- a/xen/include/xen/sched-if.h +++ b/xen/include/xen/sched-if.h @@ -133,6 +133,7 @@ struct scheduler { void *); void (*free_pdata) (const struct scheduler *, void *, int); void * (*alloc_pdata) (const struct scheduler *, int); + void (*init_pdata) (const struct scheduler *, void *, int); void (*free_domdata) (const struct scheduler *, void *); void * (*alloc_domdata) (const struct scheduler *, struct domain *);