From patchwork Wed Mar 1 14:53:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9598533 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 BE335604DC for ; Wed, 1 Mar 2017 14:55:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4A1D223A6 for ; Wed, 1 Mar 2017 14:55:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A987F28564; Wed, 1 Mar 2017 14:55:32 +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 8071628405 for ; Wed, 1 Mar 2017 14:55:31 +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 1cj5dB-0006Dj-GO; Wed, 01 Mar 2017 14:53:29 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cj5d9-0006Cf-QY for xen-devel@lists.xenproject.org; Wed, 01 Mar 2017 14:53:27 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 8E/06-13192-760E6B85; Wed, 01 Mar 2017 14:53:27 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBIsWRWlGSWpSXmKPExsXiVRvkpJv2YFu EweXdShbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8b6s0/ZCtp1KpZM2sjewHhRoYuRi0NIYDqj xKJ3s1hAHBaBNawSy9Z+YQdxJAQuATmv1zN1MXICOTES8w+/ZYGwyyWOXNoJZgsJqEjc3L6KC WLUD0aJbTsWgjUIC+hJHDn6gx3C9paY+n8HG4jNJmAg8WbHXlYQW0RASeLeqslg9cwCOhKtq9 aA1bMIqEocfb4QrIZXwEfi65ZJYHFOIPv0ysVAcziAlnlL/FnnChIWFZCTWHm5BapcUOLkzCc sICXMApoS63fpQ0yXl9j+dg7zBEaRWUiqZiFUzUJStYCReRWjRnFqUVlqka6hhV5SUWZ6Rklu YmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRmD4MwDBDsabGwMOMUpyMCmJ8u5etS1CiC8pP6UyI 7E4I76oNCe1+BCjDAeHkgTvvXtAOcGi1PTUirTMHGAkwqQlOHiURHjbQNK8xQWJucWZ6RCpU4 zGHHNm737DxPGh//AbJiGWvPy8VClx3lsgpQIgpRmleXCDYAniEqOslDAvI9BpQjwFqUW5mSW o8q8YxTkYlYR5He8DTeHJzCuB2/cK6BQmoFNeqGwFOaUkESEl1cAoHfKlv9ZzV7a66uQLgoWt nPvTy2VFJjw50xQrzrJT8PB2X3mRdl57vjWfFFnmPvU/Fnj+3ZqEudObfdxeHtp8KrNaecvOx VXHxKy6PDdwvjb7IcDZ2S3jYikossjTLdBLprzR3iBix+3ni1fNLlvl/lTdWvpwlAVjrsyxXY t/rt93ut9v2gklluKMREMt5qLiRADTOECWCwMAAA== X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1488380006!60164359!1 X-Originating-IP: [74.125.82.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32329 invoked from network); 1 Mar 2017 14:53:26 -0000 Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by server-7.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 1 Mar 2017 14:53:26 -0000 Received: by mail-wm0-f66.google.com with SMTP id m70so7781682wma.1 for ; Wed, 01 Mar 2017 06:53:26 -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=VsrdDVIIBN4TprgqHDK4HVwNnALc0GfjIWGZEVXNELgg/kL27q5x8RaOh922hExoqp 1PYxyYHjkSBS88oZjmHpVY19vHLfgSfyjhk6MKcmR7rBG+DclT+MqR5fRhKF6RrTJkXv UTcrYKM/bsruJXy8gh+O0FiWjmxpXGMFDa8P05ZOZj+q+d69WVrH/D/A/PGxXnry/H+k ELjSe7OmbQhOHY6G0/2B0tzMfYS3vNYF8K4izLivPaPQ0UsE32M3lp1q+QAlvrtvunAs aW/0hFITCUfA1xzm4Faqbyrg5pEE+WTWKdZt8zF+HmupZOxff1GMAE+45D5RNlWRq/qq W8Cw== 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=hcEyabJEBh3lUV8xpE43jj/gS5AwspoStDyl92zc4Fy9qNXFpqO76lMX9aGf1IKaB4 5hk6wbPfdVOQ5dGtKijpSbMa82ve4nsCuWp+bc2cKgKC7BTL0oj3VnjRvTlM8zV/QwGX LAiPSqCIsbQPhq0G2NfsQ7aurx+IVi4behGTnBJZ2Nyy2FctS70uylCJ6Yu8tEFOxwfX qiX9Be98t2GeOjlOPm95EdpwKE6RiXW68FvXftn+jBwyj6Iq3ZS+jKuo43OyTDqU/zRI mXQFORk8CwuLudVL3cmYul3nysY6WWpwNjZd9TvOLe6KN7AcD0feWk4vdYrkPXHS0Tya pwbA== X-Gm-Message-State: AMke39ne0x/vfmYjSigJj7ZwwYTg0XskKMjjQsZXL9KMopWY31XDBD/N4qM6MYDVTuVFZQ== X-Received: by 10.28.27.69 with SMTP id b66mr3688192wmb.50.1488380005877; Wed, 01 Mar 2017 06:53:25 -0800 (PST) Received: from Solace.fritz.box ([80.66.223.93]) by smtp.gmail.com with ESMTPSA id g5sm3188087wrb.48.2017.03.01.06.53.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Mar 2017 06:53:25 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Wed, 01 Mar 2017 15:53:24 +0100 Message-ID: <148838000360.11900.11206074144128270605.stgit@Solace.fritz.box> In-Reply-To: <148837861276.11900.8292677471375175885.stgit@Solace.fritz.box> References: <148837861276.11900.8292677471375175885.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap Subject: [Xen-devel] [PATCH v4 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,