From patchwork Thu Feb 9 13:59:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9564639 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 808E9601C3 for ; Thu, 9 Feb 2017 14:01:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BDB62849B for ; Thu, 9 Feb 2017 14:01:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60CA1284EB; Thu, 9 Feb 2017 14:01:54 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,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 BEAB52849B for ; Thu, 9 Feb 2017 14:01:53 +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 1cbpFu-0004EA-L8; Thu, 09 Feb 2017 13:59:26 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbpFt-0004DS-NY for xen-devel@lists.xenproject.org; Thu, 09 Feb 2017 13:59:25 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id C4/7A-25093-DB57C985; Thu, 09 Feb 2017 13:59:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDIsWRWlGSWpSXmKPExsVyMbThiO6e0jk RBh8eiVp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBl3z29mK+jQqVjxx6eB8aJCFyMXh5DATEaJ 8z8esoM4LAJrWCW2HN4D5kgIXGKV2PT7PGsXIyeQEyOxfcJndgi7UuLH7Z8sILaQgIrEze2rm CDsX4wSB97xgdjCAnoSR47+YIewfSVObJsPNodNwEDizY69YLaIgJLEvVWTgXo5OJgF9CVWf+ UBCbMIqEr0b/gBNpJXwEtiXvsKMJtTwFvi/b217BCrvCSW/V0KdoKogJzEysstrBD1ghInZz5 hgRipKbF+lz5ImFlAXmL72znMExhFZiGpmoVQNQtJ1QJG5lWMGsWpRWWpRbpG5npJRZnpGSW5 iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmbGIGhzwAEOxgXrw08xCjJwaQkyitbMCdCiC8pP6UyI 7E4I76oNCe1+BCjDAeHkgSvQAlQTrAoNT21Ii0zBxiFMGkJDh4lEd5IkDRvcUFibnFmOkTqFK MlR0/X6ZdMHKdugMg9uy6/ZBJiycvPS5US560CaRAAacgozYMbB0sUlxhlpYR5GYEOFOIpSC3 KzSxBlX/FKM7BqCTMWwgyhSczrwRu6yugg5iADrp+ehbIQSWJCCmpBsa8IL4Gp8uSx6Y/EvTz v2q3UidcyGXCRlGVQze96mYGn9Gb/UDP+KaZhdDcH9Ke9TFrTp9/vq/nAtvt1VsCwsR3vFzOF XP821OhpQu3J6+12t/WX1Hh/0bF5fkvy8klN2/oLQ55uKj+R753z/r31W82/Tq/573PNIPZOx 98/XtvRtYVxmcKHk91lViKMxINtZiLihMBtxaBkg8DAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-13.tower-21.messagelabs.com!1486648764!51063339!1 X-Originating-IP: [209.85.128.196] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 59473 invoked from network); 9 Feb 2017 13:59:24 -0000 Received: from mail-wr0-f196.google.com (HELO mail-wr0-f196.google.com) (209.85.128.196) by server-13.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 9 Feb 2017 13:59:24 -0000 Received: by mail-wr0-f196.google.com with SMTP id k90so11990821wrc.3 for ; Thu, 09 Feb 2017 05:59:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=gKsDstcS9M0XB6eNCOMbdXs/qq/xzdNzktYJuNcfqS4=; b=mwnQacyDDETV7MRykyY1zgNW1Gpdj8wjTafl1g+UM04L2yVZcTKHZcm6WvK3iqo3yn Sa8EjL7RykvS1+UhlARwdgPvVSx+p32UbbpcTLrd2Nqssm7Sa7dcKB7fiooEjGH3JItm j1B5Anm8VFOYs2eZ2wWJ+5qOuJgXnlhrOHIImk4bw1yWG+SRJI4HXs3bOU5wmCN/7CdB hRf+e0s1Tkw10MwAls3dBvzax2g1FwXiyi2cMNYo/pl0na0+5IDv/loWpDQg3zwQCrel bM4e3dkPIFbxmSKhez7pZpZCivAIXTeLKw8TM4U7uKX913WCssGVx3tKzEw0Op+H/Kx4 RBIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; 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=gKsDstcS9M0XB6eNCOMbdXs/qq/xzdNzktYJuNcfqS4=; b=RuWbLHdHXSIP2alJgtYb9d0cv2xAkLm2RdWeJCcb3/Q/zp48k6X/Ko9ZyKLBSdN3Vl S+7asZUiJiHXzHF/zBifEVdzpgXiUq+vrHOA+b+wSG9V70GTzEpr86Ao48vIB2kwZP/z PgQTejZGkXcmRe8Oj6/H6cM4kyCOnMX70lknlffXopz80S/pmSfVUKTSLGDKN8KApszB g8cpzxWntotfF7SmoWOLJPC6DFwUVzuLkZ5uKJkeUtEQpDcejv+L9i3nEgU9qQzdZ6qS XWuI3EbJhDpDu+vg0CaScZbcO46OIfCxz3zPGLYCWjE8DIuzx8uB3ssnHS/E8UQ9iP8+ v+Dw== X-Gm-Message-State: AMke39lH3BRhjkit6yVPD8etBMmsbzNbj3jqGH8GOWD7CnwoDCnOOaUNQ5mIeMCgFE2xtA== X-Received: by 10.223.175.49 with SMTP id z46mr3525150wrc.84.1486648763914; Thu, 09 Feb 2017 05:59:23 -0800 (PST) Received: from Solace.fritz.box ([80.66.223.139]) by smtp.gmail.com with ESMTPSA id 40sm18720780wry.22.2017.02.09.05.59.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 05:59:23 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Thu, 09 Feb 2017 14:59:22 +0100 Message-ID: <148664876211.595.17986015821032981184.stgit@Solace.fritz.box> In-Reply-To: <148664844741.595.10506268024432565895.stgit@Solace.fritz.box> References: <148664844741.595.10506268024432565895.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap Subject: [Xen-devel] [PATCH v2 09/10] xen/tools: tracing: trace (Credit2) runq traversal. 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 When traversing a Credit2 runqueue to select the best candidate vCPU to be run next, show in the trace which vCPUs we consider. A bit verbose, but quite useful, considering that we may end up looking at, but then discarding, one of more vCPU. This will help understand which ones are skipped and why. Also, add how much credits the chosen vCPU has (in the TRC_CSCHED2_RUNQ_CANDIDATE record). And, while there, fix a bug in tools/xentrace/formats (still in the output of TRC_CSCHED2_RUNQ_CANDIDATE). Signed-off-by: Dario Faggioli Acked-by: George Dunlap --- Cc: George Dunlap --- tools/xentrace/formats | 3 ++- tools/xentrace/xenalyze.c | 15 +++++++++++++-- xen/common/sched_credit2.c | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/tools/xentrace/formats b/tools/xentrace/formats index db89f92..72c0b24 100644 --- a/tools/xentrace/formats +++ b/tools/xentrace/formats @@ -65,9 +65,10 @@ 0x00022210 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched2:load_check [ lrq_id[16]:orq_id[16] = 0x%(1)08x, delta = %(2)d ] 0x00022211 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched2:load_balance [ l_bavgload = 0x%(2)08x%(1)08x, o_bavgload = 0x%(4)08x%(3)08x, lrq_id[16]:orq_id[16] = 0x%(5)08x ] 0x00022212 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched2:pick_cpu [ b_avgload = 0x%(2)08x%(1)08x, dom:vcpu = 0x%(3)08x, rq_id[16]:new_cpu[16] = %(4)d ] -0x00022213 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched2:runq_candidate [ dom:vcpu = 0x%(1)08x, skipped_vcpus = %(2)d tickled_cpu = %(3)d ] +0x00022213 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched2:runq_candidate [ dom:vcpu = 0x%(1)08x, credit = %(4)d, skipped_vcpus = %(3)d, tickled_cpu = %(2)d ] 0x00022214 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched2:schedule [ rq:cpu = 0x%(1)08x, tasklet[8]:idle[8]:smt_idle[8]:tickled[8] = %(2)08x ] 0x00022215 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched2:ratelimit [ dom:vcpu = 0x%(1)08x, runtime = %(2)d ] +0x00022216 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched2:runq_cand_chk [ dom:vcpu = 0x%(1)08x ] 0x00022801 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) rtds:tickle [ cpu = %(1)d ] 0x00022802 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) rtds:runq_pick [ dom:vcpu = 0x%(1)08x, cur_deadline = 0x%(3)08x%(2)08x, cur_budget = 0x%(5)08x%(4)08x ] diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c index a90da20..2678e2a 100644 --- a/tools/xentrace/xenalyze.c +++ b/tools/xentrace/xenalyze.c @@ -7825,12 +7825,13 @@ void sched_process(struct pcpu_info *p) struct { unsigned vcpuid:16, domid:16; unsigned tickled_cpu, skipped; + int credit; } *r = (typeof(r))ri->d; - printf(" %s csched2:runq_candidate d%uv%u, " + printf(" %s csched2:runq_candidate d%uv%u, credit = %d, " "%u vcpus skipped, ", ri->dump_header, r->domid, r->vcpuid, - r->skipped); + r->credit, r->skipped); if (r->tickled_cpu == (unsigned)-1) printf("no cpu was tickled\n"); else @@ -7864,6 +7865,16 @@ void sched_process(struct pcpu_info *p) r->runtime / 1000, r->runtime % 1000); } break; + case TRC_SCHED_CLASS_EVT(CSCHED2, 23): /* RUNQ_CAND_CHECK */ + if(opt.dump_all) { + struct { + unsigned int vcpuid:16, domid:16; + } *r = (typeof(r))ri->d; + + printf(" %s csched2:runq_cand_check d%uv%u\n", + ri->dump_header, r->domid, r->vcpuid); + } + break; /* RTDS (TRC_RTDS_xxx) */ case TRC_SCHED_CLASS_EVT(RTDS, 1): /* TICKLE */ if(opt.dump_all) { diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 8057abf..35d6988 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -57,6 +57,7 @@ #define TRC_CSCHED2_RUNQ_CANDIDATE TRC_SCHED_CLASS_EVT(CSCHED2, 20) #define TRC_CSCHED2_SCHEDULE TRC_SCHED_CLASS_EVT(CSCHED2, 21) #define TRC_CSCHED2_RATELIMIT TRC_SCHED_CLASS_EVT(CSCHED2, 22) +#define TRC_CSCHED2_RUNQ_CAND_CHECK TRC_SCHED_CLASS_EVT(CSCHED2, 23) /* * WARNING: This is still in an experimental phase. Status and work can be found at the @@ -2498,6 +2499,18 @@ runq_candidate(struct csched2_runqueue_data *rqd, { struct csched2_vcpu * svc = list_entry(iter, struct csched2_vcpu, runq_elem); + if ( unlikely(tb_init_done) ) + { + struct { + unsigned vcpu:16, dom:16; + } d; + d.dom = svc->vcpu->domain->domain_id; + d.vcpu = svc->vcpu->vcpu_id; + __trace_var(TRC_CSCHED2_RUNQ_CAND_CHECK, 1, + sizeof(d), + (unsigned char *)&d); + } + /* Only consider vcpus that are allowed to run on this processor. */ if ( !cpumask_test_cpu(cpu, svc->vcpu->cpu_hard_affinity) ) { @@ -2546,9 +2559,11 @@ runq_candidate(struct csched2_runqueue_data *rqd, struct { unsigned vcpu:16, dom:16; unsigned tickled_cpu, skipped; + int credit; } d; d.dom = snext->vcpu->domain->domain_id; d.vcpu = snext->vcpu->vcpu_id; + d.credit = snext->credit; d.tickled_cpu = snext->tickled_cpu; d.skipped = *skipped; __trace_var(TRC_CSCHED2_RUNQ_CANDIDATE, 1,