From patchwork Fri Jul 15 14:49:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9232165 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 D492A6075D for ; Fri, 15 Jul 2016 14:52:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C69C527AC2 for ; Fri, 15 Jul 2016 14:52:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB32627F94; Fri, 15 Jul 2016 14:52:29 +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 4932327AC2 for ; Fri, 15 Jul 2016 14:52:29 +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 1bO4RG-00067M-Al; Fri, 15 Jul 2016 14:50:02 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bO4RE-00062z-Mr for xen-devel@lists.xenproject.org; Fri, 15 Jul 2016 14:50:00 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 75/D5-21406-718F8875; Fri, 15 Jul 2016 14:49:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLIsWRWlGSWpSXmKPExsXiVRvkoiv+oyP cYMZKCYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNePQy11MBVPkKjZdmMnUwHhBtIuRk0NIYDqj xLQtll2MXBwsAmtYJU7ufskM4kgIXGKV6J3QydTFyAHkxEhM38UC0iAhUC5xunE5O0SzisTN7 auYQOqFBBYzSTRcW8MEkhAW0JM4cvQHO4TtKPH/2Bc2EJtNwEDizY69rCC2iICSxL1Vk8GamQ UaGCUmPN4F1swioCrRPfsGWAOvgJfE2cbVYIM4BXwlnt9fwwKx2Ufixd3ZYPWiAnISKy+3sEL UC0qcnPmEBeRoZgFNifW79EHCzALyEtvfzmGewCgyC0nVLISqWUiqFjAyr2JUL04tKkst0jXU SyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQIDH4GINjBuPO50yFGSQ4mJVHejSkd4 UJ8SfkplRmJxRnxRaU5qcWHGDU4OAQmnJ07nUmKJS8/L1VJgvfZN6A6waLU9NSKtMwcYHzClE pw8CiJ8L4DSfMWFyTmFmemQ6ROMepybJl6by2TENgMKXHehSBFAiBFGaV5cCNgqeISo6yUMC8 j0IFCPAWpRbmZJajyrxjFORiVhHl/gEzhycwrgdv0CugIJqAjrM3bQY4oSURISTUwynG7d9dY trGevnJI/dY5tXQWtTTXA2EbbC36vkmWpYXqGHqL2/z/rD5x+Q7xhRsD5y08/vylSWZs+7SQD bWbbrlJLPQv1ppg97ZrXqSVY/envh+8f72sLjec5ImrL/PrXndqw562X7/+mFv+bz211ujiL2 PzuF91amtEbNJX7iyd3id2NniWEktxRqKhFnNRcSIAKPXDLBADAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1468594199!24103629!1 X-Originating-IP: [74.125.82.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2809 invoked from network); 15 Jul 2016 14:49:59 -0000 Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by server-9.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 15 Jul 2016 14:49:59 -0000 Received: by mail-wm0-f68.google.com with SMTP id x83so2441867wma.3 for ; Fri, 15 Jul 2016 07:49:59 -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=tC52tUU5e2sN3VE63yK00ZigfF/ez2tsnussu3olgqc=; b=omCsvNlfB/Ja9dYbt3sreIEPjJXK0rzUJfyH2D9s8WAeUnywdB3nMLy01B5qVkwz/Z 6ZLo18wuf2QT0fE4/8jk5Edsnchqj1rCts/TSA0VExtChacERLhjZCVvfl9jvRMQ2oAl WE12630GsPUafgRfkKzAVitrHbk8WKi312Dc/bcbvQhkvclbn0Y1XAdRzL5tO0+OAtn0 1GkkogB6QiVKQkthe+NFHl3+2RLLGKQs4llkKzL/w5XzZW2vDD6JDx/HOyGsZmXOF3/T bMbDVOM66r2GoOsnu9menFUrSXC+u6KBp21VR9x1kIy1uHyVkU9nEVUsubtXgj8rBpTK 68GQ== 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=tC52tUU5e2sN3VE63yK00ZigfF/ez2tsnussu3olgqc=; b=GsTnWX9XRDHEn3zJZjrAeIN4kFTruDWxQsX1qNbXKb1+HxoKuENI2axkCbC0kJV9uH Hyqwt+k15g/KjOO2GMrcanI1rXjGO+2hIu2JmNUoAeK17HoWSi44kB06z9f/rW8DsGoR Qgh3podbw2CwPJ7zY0qh7RFFPg960yHassHEDStNe7VOhVSQrV1fbaGz3ckMnO6lmL1I P3NWTDUmIEYLMyoUV5kx+lm8WvhBrsLzzpVjilf8BBJNEW/znS8m2vlAhY5X4O6ddrQs QQhas5i5IWh4A8XARSl5GjRzD3YAfg8hOGiJeY5Tb7bi1x++LFJP8lk7BEjQ35yPi63O agfQ== X-Gm-Message-State: ALyK8tLPLxlkhawZwxJIHn2PrOdc7emtNGn1clItq77oHQCAPLUtUwRNpl9/UA4hCWdhgw== X-Received: by 10.28.10.66 with SMTP id 63mr42262055wmk.54.1468594198804; Fri, 15 Jul 2016 07:49:58 -0700 (PDT) Received: from Solace.fritz.box (net-188-217-84-158.cust.vodafonedsl.it. [188.217.84.158]) by smtp.gmail.com with ESMTPSA id m125sm6305873wmm.8.2016.07.15.07.49.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jul 2016 07:49:58 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 15 Jul 2016 16:49:56 +0200 Message-ID: <146859419689.10217.257677956053735988.stgit@Solace.fritz.box> In-Reply-To: <146859397891.10217.10155969474613302167.stgit@Solace.fritz.box> References: <146859397891.10217.10155969474613302167.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 v2 07/11] 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: 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 d72f530..a4aec73 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -51,6 +51,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 @@ -711,6 +714,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); @@ -1486,6 +1491,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 @@ -1676,6 +1698,20 @@ retry: 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% @@ -1704,6 +1740,21 @@ retry: 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); + } + /* Look for "swap" which gives the best load average * FIXME: O(n^2)! */ @@ -1753,10 +1804,9 @@ retry: 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; }