From patchwork Fri Jun 17 23:12:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9185151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 71B36601C0 for ; Fri, 17 Jun 2016 23:14:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FF30208C2 for ; Fri, 17 Jun 2016 23:14:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5483424B44; Fri, 17 Jun 2016 23:14:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id DB845208C2 for ; Fri, 17 Jun 2016 23:14:49 +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 1bE2wh-0003ts-Ut; Fri, 17 Jun 2016 23:13:03 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bE2wg-0003sg-Ks for xen-devel@lists.xenproject.org; Fri, 17 Jun 2016 23:13:02 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 43/7B-09256-EF384675; Fri, 17 Jun 2016 23:13:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLIsWRWlGSWpSXmKPExsXiVRvkpPu3OSX c4HS7lMX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmrF73WfWghvyFXseqDcw/hbrYuTiEBKYwSjx 58ghNhCHRWANq8TJjTOZQBwJgUusEjcuTQZyOIGcGIk1zZ8YIewqicNH1rCD2EICKhI3t69ig hi1gEni87GPzCAJYQE9iSNHf7BD2HYSszqesYHYbAIGEm927GUFsUUElCTurZoM1sws0MAoMe HxLiCHA+gOVYm1601AangFvCX2f58I1ssp4Cux+souNojFPhIXzz0Cs0UF5CRWXm5hhagXlDg 58wkLyBhmAU2J9bv0QcLMAvIS29/OYZ7AKDILSdUshKpZSKoWMDKvYlQvTi0qSy3SNdRLKspM zyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMfgYg2MG487nTIUZJDiYlUd4rlSnhQnxJ+ SmVGYnFGfFFpTmpxYcYNTg4BCacnTudSYolLz8vVUmCd0MTUJ1gUWp6akVaZg4wPmFKJTh4lE R4q0DSvMUFibnFmekQqVOMuhxbpt5byyQENkNKnFcTpEgApCijNA9uBCxVXGKUlRLmZQQ6UIi nILUoN7MEVf4VozgHo5Iw70yQKTyZeSVwm14BHcEEdITmvGSQI0oSEVJSDYw2lRWnZe6suXVV pi7+CyN3cl1ZcOKDTIOanna/xGvWu1n6CzJkBGcX9D9LLO6Pe7r1+wE2MaGolAeO+tPfXjtWZ +amwvlHYupWhdWf+qLFHM6zvL5kfG2nRyPPjXeG/qf3t1w4cc4ozYtxsXJMZdmHP1cX1njVN7 XfcWm52/QqRerG3tjTtUosxRmJhlrMRcWJAMWb0l8QAwAA X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1466205181!19506759!1 X-Originating-IP: [74.125.82.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17830 invoked from network); 17 Jun 2016 23:13:01 -0000 Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by server-8.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jun 2016 23:13:01 -0000 Received: by mail-wm0-f66.google.com with SMTP id k184so1086542wme.2 for ; Fri, 17 Jun 2016 16:13:01 -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=BbE7z9rjMX3ggOgDVLxLT0Cb80hR6UIbs3obVoITM5E=; b=irZW5FnMXwp7SxKKI9hxngp1GJ4w0oQ7Osw/pfNAjD9PKxaUmP2afpq+i0d2zQoooF NVbthQUafsbx3LI9WZ4H6si2+j1q+m+Ha9KdmjxWjJSBfSmeels+3hQ5uFeC/gpnyRIK FyuLxca8ON5wDQAzIGszxipQdhWjITy4eBLefs3DN0+d5zLv69IqyW1rf2mvcwHSdvyC 4ODG/wTs15ZWp94vfUGqTskh2Hw6KZH9Lc9yUsEqQFTt4lhuT65ap0q74QEwfBb0r4LZ Fl88G4Q6GDh5wDAFn4ts4EwbocH9/Mq4Fb7tgm3EY3UKx10JsfwLY9h0uO53PwwmvehW 4xIA== 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=BbE7z9rjMX3ggOgDVLxLT0Cb80hR6UIbs3obVoITM5E=; b=l+hpquTTbyce4zI8PXmrDLnFPjq/3iK1RreopT5CznWh1WF014oWg29ZI/+CBpetfR PxrzADHezIQv+WOtEzrPe/iLkdsedi3N94dp3m3hG+qYQHCMXjcr+shVG9aI0I7zv7OU +dn3DxnvfexG+LuYlDMcULUpwXfYYj1tPuCXB28rWuc3FcusRiK9rTIhfv2BEXjQ9EtJ sXFDb0A73KpnX/aVAORKsN2NBYWIky+nCgUONoKRmcY0t1RgImt1+Pjtlp+mHfEQQdn+ 7FgtGGuzrnsAojFIFPA9rEd3liJt+VU5VelHu5iiDgwbRNzv0THZScxUT0+Q0Phgv4+E 7DIA== X-Gm-Message-State: ALyK8tJxHzcpvx05hHfoTUq9SefL3x0cZ/J0lqRNTZafY+oScljeqSYU5x2rPRE6atrsIA== X-Received: by 10.194.41.170 with SMTP id g10mr4385521wjl.176.1466205181043; Fri, 17 Jun 2016 16:13:01 -0700 (PDT) Received: from Solace.fritz.box (net-93-65-149-191.cust.vodafonedsl.it. [93.65.149.191]) by smtp.gmail.com with ESMTPSA id h8sm50868177wjg.9.2016.06.17.16.12.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jun 2016 16:13:00 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Sat, 18 Jun 2016 01:12:58 +0200 Message-ID: <146620517863.29766.7999578465463906558.stgit@Solace.fritz.box> In-Reply-To: <146620492155.29766.10321123657058307698.stgit@Solace.fritz.box> References: <146620492155.29766.10321123657058307698.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Anshul Makkar , George Dunlap , David Vrabel Subject: [Xen-devel] [PATCH 14/19] xen: credit2: add yet some more tracing 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-Virus-Scanned: ClamAV using ClamSMTP (and fix the style of two labels as well.) Signed-off-by: Dario Faggioli Acked-by: George Dunlap --- Cc: George Dunlap Cc: Anshul Makkar Cc: David Vrabel --- xen/common/sched_credit2.c | 58 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index ba3a78a..e9f3f13 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -46,6 +46,9 @@ #define TRC_CSCHED2_TICKLE_NEW TRC_SCHED_CLASS_EVT(CSCHED2, 13) #define TRC_CSCHED2_RUNQ_MAX_WEIGHT TRC_SCHED_CLASS_EVT(CSCHED2, 14) #define TRC_CSCHED2_MIGRATE TRC_SCHED_CLASS_EVT(CSCHED2, 15) +#define TRC_CSCHED2_LOAD_CHECK TRC_SCHED_CLASS_EVT(CSCHED2, 16) +#define TRC_CSCHED2_LOAD_BALANCE TRC_SCHED_CLASS_EVT(CSCHED2, 17) +#define TRC_CSCHED2_PICKED_CPU TRC_SCHED_CLASS_EVT(CSCHED2, 19) /* * WARNING: This is still in an experimental phase. Status and work can be found at the @@ -709,6 +712,8 @@ update_load(const struct scheduler *ops, struct csched2_runqueue_data *rqd, struct csched2_vcpu *svc, int change, s_time_t now) { + trace_var(TRC_CSCHED2_UPDATE_LOAD, 1, 0, NULL); + __update_runq_load(ops, rqd, change, now); if ( svc ) __update_svc_load(ops, svc, change, now); @@ -1484,6 +1489,23 @@ csched2_cpu_pick(const struct scheduler *ops, struct vcpu *vc) out_up: spin_unlock(&prv->lock); + /* TRACE */ + { + struct { + uint64_t b_avgload; + unsigned vcpu:16, dom:16; + unsigned rq_id:16, new_cpu:16; + } d; + d.b_avgload = prv->rqd[min_rqi].b_avgload; + d.dom = vc->domain->domain_id; + d.vcpu = vc->vcpu_id; + d.rq_id = c2r(ops, new_cpu); + d.new_cpu = new_cpu; + trace_var(TRC_CSCHED2_PICKED_CPU, 1, + sizeof(d), + (unsigned char *)&d); + } + return new_cpu; } @@ -1611,7 +1633,7 @@ static void balance_load(const struct scheduler *ops, int cpu, s_time_t now) bool_t inner_load_updated = 0; balance_state_t st = { .best_push_svc = NULL, .best_pull_svc = NULL }; - + /* * Basic algorithm: Push, pull, or swap. * - Find the runqueue with the furthest load distance @@ -1677,6 +1699,20 @@ static void balance_load(const struct scheduler *ops, int cpu, s_time_t now) if ( i > cpus_max ) cpus_max = i; + /* TRACE */ + { + struct { + unsigned lrq_id:16, orq_id:16; + unsigned load_delta; + } d; + d.lrq_id = st.lrqd->id; + d.orq_id = st.orqd->id; + d.load_delta = st.load_delta; + trace_var(TRC_CSCHED2_LOAD_CHECK, 1, + sizeof(d), + (unsigned char *)&d); + } + /* * If we're under 100% capacaty, only shift if load difference * is > 1. otherwise, shift if under 12.5% @@ -1705,6 +1741,21 @@ static void balance_load(const struct scheduler *ops, int cpu, s_time_t now) if ( unlikely(st.orqd->id < 0) ) goto out_up; + /* TRACE */ + { + struct { + uint64_t lb_avgload, ob_avgload; + unsigned lrq_id:16, orq_id:16; + } d; + d.lrq_id = st.lrqd->id; + d.lb_avgload = st.lrqd->b_avgload; + d.orq_id = st.orqd->id; + d.ob_avgload = st.orqd->b_avgload; + trace_var(TRC_CSCHED2_LOAD_BALANCE, 1, + sizeof(d), + (unsigned char *)&d); + } + now = NOW(); /* Look for "swap" which gives the best load average @@ -1756,10 +1807,9 @@ static void balance_load(const struct scheduler *ops, int cpu, s_time_t now) if ( st.best_pull_svc ) migrate(ops, st.best_pull_svc, st.lrqd, now); -out_up: + out_up: spin_unlock(&st.orqd->lock); - -out: + out: return; }