From patchwork Wed Mar 1 14:53:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9598535 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 91B4B604DC for ; Wed, 1 Mar 2017 14:55:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88A4D223A6 for ; Wed, 1 Mar 2017 14:55:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D96528565; Wed, 1 Mar 2017 14:55:34 +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 DAD6E223A6 for ; Wed, 1 Mar 2017 14:55:33 +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 1cj5dI-0006IO-Ob; Wed, 01 Mar 2017 14:53:36 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cj5dH-0006Gz-C5 for xen-devel@lists.xenproject.org; Wed, 01 Mar 2017 14:53:35 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 35/16-14551-E60E6B85; Wed, 01 Mar 2017 14:53:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOIsWRWlGSWpSXmKPExsXiVRvkopv7YFu EwY3juhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa0bH0X72ggUqFRunNTE3MP6Q7mLk4hASmMEo 0fH5LQuIwyKwhlVi18nVrCCOhMAlVon7K7cAOZxAToxE/8O5UHa1xLfXH5lBbCEBFYmb21cxQ Yz6zSjx6lMLE0hCWEBP4sjRH+wQdobEo7WbGEFsNgEDiTc79oINEhFQkri3ajJQPQcHs4C+xO qvPCBhFgFVicUXH4ON4RXwlrgwfzWYzSngI3F65WI2kHIhoPifda4gYVEBOYmVl1tYIcoFJU7 OfMICMVFTYv0ufZAws4C8xPa3c5gnMIrMQlI1C6FqFpKqBYzMqxg1ilOLylKLdI3M9ZKKMtMz SnITM3N0DQ2M9XJTi4sT01NzEpOK9ZLzczcxAoO/noGBcQdjy16/Q4ySHExKory7V22LEOJLy k+pzEgszogvKs1JLT7EKMPBoSTBG30fKCdYlJqeWpGWmQOMQ5i0BAePkgjvepA0b3FBYm5xZj pE6hSjMcec2bvfMHF86D/8hkmIJS8/L1VKnDcUpFQApDSjNA9uECw9XGKUlRLmZWRgYBDiKUg tys0sQZV/xSjOwagkzMsJMoUnM68Ebt8roFOYgE55obIV5JSSRISUVAMjb5R/3Aab/lgFvzkC uzetnP34qgJPhIZSxMfV6Qa32y14up2XZ+1YEqN1Znbmp+JMq2fpOVFTjj7Idtk+xzn+3F93/ 1VWU6KnPbMs4ZJ0XMz9ImbPjemLRTvZ3Fl2Zr4Wzy/ueH/mJM8dtbqfd9xWMqWvvh7wa8fnxZ ySsVJXnP8v2/7hwBRhJZbijERDLeai4kQA+ytHqgoDAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1488380013!76370633!1 X-Originating-IP: [74.125.82.68] 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 64621 invoked from network); 1 Mar 2017 14:53:33 -0000 Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by server-2.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 1 Mar 2017 14:53:33 -0000 Received: by mail-wm0-f68.google.com with SMTP id v190so1758361wme.3 for ; Wed, 01 Mar 2017 06:53:33 -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=Ebs6ZREiBMTwK22SUHur2nlL9Fh0J1KiJrzHodJDgjw=; b=QFYeRdzZmEROFJ9ANMgZMxcJbI6AbLSeT7m+AM0zGBMsz3BdR+g299dDMox7yfPkOg A/CntzSiAiOFGIvQeg/bxdh1PyHZkUlkM025DG9a13VenRR/UmC4zsUD3pcQkpz07UjS RJbYmtwvUgstwtMzZfSAHWqUHwqvLhbZNepIGSUJb9kL1373dNxNfX0W/GXmjl3k8ijt JUCOBsw9cpgD3SlYtr1AYbHqKMHiLak47IeXGw4rOvoSrzlr5Ki5SEm1eIBGanfffcng 4viVdkauScvoIHK63BxhbXgwYGgCngHgs72x/zXk+0lUJbmONxcBavf6m+h346PmkDW6 aF0A== 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=Ebs6ZREiBMTwK22SUHur2nlL9Fh0J1KiJrzHodJDgjw=; b=k5OLOUR/VxcK6oSJAm8r8vnPN9TIccqpzrDhQrcTZPkua1FJQz67Q4EkUBT3f/6eRU nyDTxgIsLJcCmJMD6GSRcx90yjh9ww/ZprJ1Cn4nXwzhr026fYcnwXTIgEgMXuzz9C0B pIg8ERlwXuhJdOqd8jsqk62OtoM57O7oPUHwLCGNWDtSPY7mKaz3UK3TEyMTcyLuRzMm Ug+1UHlFY1s6Qc7SaCP3B5DyE1nlyVQn/HLpg2b5XVdK1vYPOu8dWBj54tkhTDmLbtXq 23BgKbUXDyop/PZARo5sz9HOhdunu9HfU1QXSrYYSh34DSAm5cP25UJMAk2/Z3BcFIJA jKgA== X-Gm-Message-State: AMke39lqCVzvXtHXsrpLoToOsafrpxCODOqslkRF5XwbI3TpSt9/O3GbdwLqhBH5Pq0NPg== X-Received: by 10.28.150.202 with SMTP id y193mr3902926wmd.106.1488380013213; Wed, 01 Mar 2017 06:53:33 -0800 (PST) Received: from Solace.fritz.box ([80.66.223.93]) by smtp.gmail.com with ESMTPSA id r195sm23262733wme.25.2017.03.01.06.53.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Mar 2017 06:53:32 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Wed, 01 Mar 2017 15:53:31 +0100 Message-ID: <148838001098.11900.3627376252047944752.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 7/7] xen/tools: tracing: Report next slice time when continuing as well as switching 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 We record trace information about the next timeslice when switching to a different vcpu, but not when continuing to run the same cpu: csched2:schedule cpu 9, rq# 1, idle, SMT idle, tickled csched2:runq_candidate d0v3, 0 vcpus skipped, cpu 9 was tickled sched_switch prev d32767v9, run for 991.186us sched_switch next d0v3, was runnable for 2.515us, next slice 10000.0us sched_switch prev d32767v9 next d0v3 ^^^^^^^^^^^^^^^^^^^^ runstate_change d32767v9 running->runnable ... csched2:schedule cpu 2, rq# 0, busy, not tickled csched2:burn_credits d1v5, credit = 9996950, delta = 502913 csched2:runq_candidate d1v5, 0 vcpus skipped, no cpu was tickled runstate_continue d1v5 running->running ????????????? This information is quite useful; so add a trace including that information on the 'continue_running' path as well, like this: csched2:schedule cpu 1, rq# 0, busy, not tickled csched2:burn_credits d0v8, credit = 9998645, delta = 12104 csched2:runq_candidate d0v8, credit = 9998645, 0 vcpus skipped, no cpu was tickled sched_switch continue d0v8, run for 1125.820us, next slice 9998.645us runstate_continue d0v8 running->running ^^^^^^^^^^^^^^^^^^^^^ Signed-off-by: Dario Faggioli Acked-by: George Dunlap --- Cc: George Dunlap --- Changes from v2: * reworded the changelog, as suggested during review. --- tools/xentrace/formats | 1 + tools/xentrace/xenalyze.c | 17 +++++++++++++++++ xen/common/schedule.c | 4 ++++ xen/include/public/trace.h | 1 + 4 files changed, 23 insertions(+) diff --git a/tools/xentrace/formats b/tools/xentrace/formats index 72c0b24..a055231 100644 --- a/tools/xentrace/formats +++ b/tools/xentrace/formats @@ -35,6 +35,7 @@ 0x0002800e CPU%(cpu)d %(tsc)d (+%(reltsc)8d) switch_infprev [ dom:vcpu = 0x%(1)04x%(2)04x, runtime = %(3)d ] 0x0002800f CPU%(cpu)d %(tsc)d (+%(reltsc)8d) switch_infnext [ new_dom:vcpu = 0x%(1)04x%(2)04x, time = %(3)d, r_time = %(4)d ] 0x00028010 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) domain_shutdown_code [ dom:vcpu = 0x%(1)04x%(2)04x, reason = 0x%(3)08x ] +0x00028011 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) switch_infcont [ dom:vcpu = 0x%(1)04x%(2)04x, runtime = %(3)d, r_time = %(4)d ] 0x00022001 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched:sched_tasklet 0x00022002 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched:account_start [ dom:vcpu = 0x%(1)04x%(2)04x, active = %(3)d ] diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c index 2678e2a..68ffcc2 100644 --- a/tools/xentrace/xenalyze.c +++ b/tools/xentrace/xenalyze.c @@ -7528,6 +7528,23 @@ void sched_process(struct pcpu_info *p) printf("\n"); } break; + case TRC_SCHED_SWITCH_INFCONT: + if(opt.dump_all) + { + struct { + unsigned int domid, vcpuid, rsince; + int slice; + } *r = (typeof(r))ri->d; + + printf(" %s sched_switch continue d%uv%u, run for %u.%uus", + ri->dump_header, r->domid, r->vcpuid, + r->rsince / 1000, r->rsince % 1000); + if ( r->slice > 0 ) + printf(", next slice %u.%uus", r->slice / 1000, + r->slice % 1000); + printf("\n"); + } + break; case TRC_SCHED_CTL: case TRC_SCHED_S_TIMER_FN: case TRC_SCHED_T_TIMER_FN: diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 36bbd94..223a120 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1397,6 +1397,10 @@ static void schedule(void) if ( unlikely(prev == next) ) { pcpu_schedule_unlock_irq(lock, cpu); + TRACE_4D(TRC_SCHED_SWITCH_INFCONT, + next->domain->domain_id, next->vcpu_id, + now - prev->runstate.state_entry_time, + next_slice.time); trace_continue_running(next); return continue_running(prev); } diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h index 5ef9c37..7f2e891 100644 --- a/xen/include/public/trace.h +++ b/xen/include/public/trace.h @@ -115,6 +115,7 @@ #define TRC_SCHED_SWITCH_INFPREV (TRC_SCHED_VERBOSE + 14) #define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED_VERBOSE + 15) #define TRC_SCHED_SHUTDOWN_CODE (TRC_SCHED_VERBOSE + 16) +#define TRC_SCHED_SWITCH_INFCONT (TRC_SCHED_VERBOSE + 17) #define TRC_DOM0_DOM_ADD (TRC_DOM0_DOMOPS + 1) #define TRC_DOM0_DOM_REM (TRC_DOM0_DOMOPS + 2)