From patchwork Tue Feb 28 11:52:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9595305 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 58937601D7 for ; Tue, 28 Feb 2017 11:54:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4648327816 for ; Tue, 28 Feb 2017 11:54:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3ACEC27F07; Tue, 28 Feb 2017 11:54:49 +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 9D34A27816 for ; Tue, 28 Feb 2017 11:54:48 +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 1cigKl-0001FH-1m; Tue, 28 Feb 2017 11:52:47 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cigKj-0001EQ-4L for xen-devel@lists.xenproject.org; Tue, 28 Feb 2017 11:52:45 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 8B/71-20656-C8465B85; Tue, 28 Feb 2017 11:52:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNIsWRWlGSWpSXmKPExsVyMbThoG53ytY Ig+Pf9S2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oz1Z5+yFbTrVCyZtJG9gfGiQhcjF4eQwAxG ibn3ZrKCOCwCa1glWt9/ZANxJAQusUrMO9bL3MXICeTESDzespa9i5EDyK6SWN4XBBIWElCRu Ll9FRPEpB+MEt1Tt7CBJIQF9CSOHP3BDmF7S5z4dAvMZhMwkHizYy8riC0ioCRxb9VkJhCbWU BHonXVGrAaFgFVie29r8F28QL1Tm+TADE5BXwklt+wADGFgKLbHseCFIsKyEmsvNwCNpBXQFD i5MwnLCAlzAKaEut36UPMlpfY/nYO8wRGkVlIqmYhVM1CUrWAkXkVo0ZxalFZapGukbFeUlFm ekZJbmJmjq6hgalebmpxcWJ6ak5iUrFecn7uJkZg4NczMDDuYNzR7neIUZKDSUmUNyt5a4QQX 1J+SmVGYnFGfFFpTmrxIUYZDg4lCd7JIDnBotT01Iq0zBxgDMKkJTh4lER4fyQBpXmLCxJziz PTIVKnGC05Hpza9YaJY87s3UDyU//hN0xCLHn5ealS4rzXQeYJgDRklObBjYOliUuMslLCvIw MDAxCPAWpRbmZJajyrxjFORiVhHl7QabwZOaVwG19BXQQE9BBL1TADipJREhJNTD2HNROuWWk fll1daLcdwWGmyrP9eI3L65tZZc0f/z9v96ZxxziZlxX1lu43HmlcdPp8txwre+HIthKi2UE6 rkzDupcZr6UfFXJ+mLdpB9v+5KrOh+rXrS9vqXT5MlPVy69+4rpCi5vpaPtfGedFXIvSlb+y5 wt5BTqvt18YdBmxsb6mbZvvyuxFGckGmoxFxUnAgA9uL3pDgMAAA== X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1488282763!85458502!1 X-Originating-IP: [209.85.128.193] 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 39357 invoked from network); 28 Feb 2017 11:52:43 -0000 Received: from mail-wr0-f193.google.com (HELO mail-wr0-f193.google.com) (209.85.128.193) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Feb 2017 11:52:43 -0000 Received: by mail-wr0-f193.google.com with SMTP id l37so1313163wrc.3 for ; Tue, 28 Feb 2017 03:52:43 -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=ZpbgYOVOmFzXwQV7GDD59+5SstgatFcG1q9F/CpsfJs=; b=lsVfczZ53Oe+o0lfBxDdD4Szr1vCenw2URiOcy3bWiM/a4oudkPfCEb0KuzvA36rT7 oqDPn/2eJe2EihZ6+HrDNNNG1dhJisBbLukIISm482kqsaIsVZhNjKDTl3s4PykMmamC G65/0a1irtLlQ0Wu8AmBJwiDAK0hElg0KKW+OkmOSNWQLKVHRPlskS92OnEg3yuVBcmq HH0hazjKreZh7jk/pI3ruB9SL+3Y4q+RgCiCjSZHpt4CgrJYVQ8yTaKJTqexOIAviegp Cbh/DAPrrxJ1Ov2NorEdWschuE6n/57XPFdYBtDtW4pxLX8E133rgoZBepuljHEWICmB 24GA== 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=ZpbgYOVOmFzXwQV7GDD59+5SstgatFcG1q9F/CpsfJs=; b=OctyL2+f+WftdQo7HOyYhqknjjMZ5UlSGQyLXF8zrN5Cr8yQSyYetvHzqCGRcXpaKm IY/CkWCWVilKKY92jYyXEl4tv3AKFhc/4UOw3vukGZ6E3/EZuEk7n053URhpyxre2/Gb 3KynvFByNCmW+wR41JRyAXxB3Xlih7RWRsBnqjNPA1eufM0mcmt+4x6K/qZ4ZlpAqg0y cxrzFCxMDy6FaN5ZrDz6VerGNneg0PwLAxw3dRBRH0vbfYEyYkAB42BGox0ADYVgM7em 3QLbvpwCheL/fnpPJaF7Nx6qyueGKSU404UMLjxUW+gB0Bg+MlKceUHShICoZzIK7L/m 3IUw== X-Gm-Message-State: AMke39m0wcs5TX5oEagXSbsRjbgakIEPweEB0hvb3eQQIq5/ao4GUJNy8LonitcUQsAUYg== X-Received: by 10.223.171.76 with SMTP id r12mr2194707wrc.164.1488282763277; Tue, 28 Feb 2017 03:52:43 -0800 (PST) Received: from Solace.fritz.box ([80.66.223.93]) by smtp.gmail.com with ESMTPSA id 99sm2002495wrm.18.2017.02.28.03.52.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Feb 2017 03:52:42 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Tue, 28 Feb 2017 12:52:41 +0100 Message-ID: <148828275937.26730.2306730618283132140.stgit@Solace.fritz.box> In-Reply-To: <148828109243.26730.2771577013485070217.stgit@Solace.fritz.box> References: <148828109243.26730.2771577013485070217.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap Subject: [Xen-devel] [PATCH v3 6/7] 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 --- 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 66b7f96..af457c1 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -56,6 +56,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 @@ -2494,6 +2495,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) ) { @@ -2542,9 +2555,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,