From patchwork Fri Feb 5 18:35:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 8238231 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4E7F0BEEE5 for ; Fri, 5 Feb 2016 18:37:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A37320392 for ; Fri, 5 Feb 2016 18:37:25 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 238A72034A for ; Fri, 5 Feb 2016 18:37:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aRlEB-0004X0-N9; Fri, 05 Feb 2016 18:35:31 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aRlE9-0004W5-VL for xen-devel@lists.xenproject.org; Fri, 05 Feb 2016 18:35:30 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 79/34-23747-17BE4B65; Fri, 05 Feb 2016 18:35:29 +0000 X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1454697328!13160543!1 X-Originating-IP: [74.125.82.67] X-SpamReason: No, hits=0.2 required=7.0 tests=RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57129 invoked from network); 5 Feb 2016 18:35:28 -0000 Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by server-16.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 5 Feb 2016 18:35:28 -0000 Received: by mail-wm0-f67.google.com with SMTP id 128so4181187wmz.3 for ; Fri, 05 Feb 2016 10:35:28 -0800 (PST) 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-type:content-transfer-encoding; bh=Nb6mwNR+zD/snJ/Uwy9WhyQrHFEllBrJtfu7S9JOnIo=; b=TfZf93tz9Tl1pvIDeHNm8yg2/RL8+sLdhGASgSpK2tpE1npL07yn3caJaCnzKoP4Mm RtxrbHkYjllR5E/ID32miZj60BcXOkYqvpZ+WKliWI8rK5ejDfL9nmHMOSyfZdqOKaEG x5XFV8+EDsLcIt7wDXXAVFDfUlF158YT4rZUoBkGCzRvDCZjXgnDBva2ma7p3/9crBdk CklRHLyRigZHO2aQacVfW1+inW1Cli0PQNCHuszCtc98S0uKHWr48AinTzwRZUgMyerS Zi0tDEDXHjbfdOyICwr/HZWf0w/Qj1tKVe1lUpwwIuPMT+KlU1el6OOhjOBqIRtgxCI9 RwRQ== 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-type :content-transfer-encoding; bh=Nb6mwNR+zD/snJ/Uwy9WhyQrHFEllBrJtfu7S9JOnIo=; b=eOOFou6yxX8lsx9Zvl2VKnEWR+2fHtpVb0cpAqiBQUpU/ujauTk8h0te+tL1+AKoE9 gYQXCRDnMm8nsQEjSGmXzCVwFxJq+mSmDXozFsi6c7jY4BGnbQMRq9mxan7AN/JMm5VA KW7BFHcGPAO/zm8fo21gGeujN17lfy03+nRd5ag0dLa6kSHPA6ljODf9/9hiGKDagNne 1ux+N21N7bVHqDVQBEvvKlQKkMbIVOuQGr5VDE0EW55e+qfLU9Hi9csYLJ8V/lhYTqzP QKbeAfLUGWj+02rVbqkm8262A/2VoU1JJ9wUfbNUY0L5krNTCMQhvHzPKNSoFiv7+tBW SyKg== X-Gm-Message-State: AG10YOSjWZosSos8av8oMhkxOB+0zFBB1zcgV0iAWjrLCgBKxiAEK9165UTNLDNoHFPhrw== X-Received: by 10.28.125.77 with SMTP id y74mr36642310wmc.21.1454697328393; Fri, 05 Feb 2016 10:35:28 -0800 (PST) Received: from Solace.station (net-2-35-170-8.cust.vodafonedsl.it. [2.35.170.8]) by smtp.gmail.com with ESMTPSA id l2sm17033656wjf.15.2016.02.05.10.35.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Feb 2016 10:35:27 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 05 Feb 2016 19:35:22 +0100 Message-ID: <20160205183522.4543.48578.stgit@Solace.station> In-Reply-To: <20160205183137.4543.56523.stgit@Solace.station> References: <20160205183137.4543.56523.stgit@Solace.station> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap , Wei Liu , Olaf Hering , Ian Jackson , Ian Campbell Subject: [Xen-devel] [PATCH 11/14] xenalyze: handle scheduling events X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP so the trace will show properly decoded info, rather than just a bunch of hex codes. Signed-off-by: Dario Faggioli Reviewed-by: Konrad Rzeszutek Wilk --- Cc: George Dunlap Cc: Ian Jackson Cc: Ian Campbell Cc: Wei Liu Cc: Olaf Hering --- tools/xentrace/xenalyze.c | 156 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 126 insertions(+), 30 deletions(-) diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c index 6520790..be698aa 100644 --- a/tools/xentrace/xenalyze.c +++ b/tools/xentrace/xenalyze.c @@ -1519,27 +1519,6 @@ struct pv_data { }; /* Sched data */ - -enum { - SCHED_DOM_ADD=1, - SCHED_DOM_REM, - SCHED_SLEEP, - SCHED_WAKE, - SCHED_YIELD, - SCHED_BLOCK, - SCHED_SHUTDOWN, - SCHED_CTL, - SCHED_ADJDOM, - SCHED_SWITCH, - SCHED_S_TIMER_FN, - SCHED_T_TIMER_FN, - SCHED_DOM_TIMER_FN, - SCHED_SWITCH_INFPREV, - SCHED_SWITCH_INFNEXT, - SCHED_SHUTDOWN_CODE, - SCHED_MAX -}; - enum { RUNSTATE_RUNNING=0, RUNSTATE_RUNNABLE, @@ -7431,6 +7410,17 @@ no_update: return; } +void dump_sched_switch(struct record_info *ri) +{ + struct { + unsigned int prev_dom, prev_vcpu, next_dom, next_vcpu; + } * r = (typeof(r))ri->d; + + printf(" %s sched_switch prev d%uv%u next d%uv%u\n", + ri->dump_header, r->prev_dom, r->prev_vcpu, + r->next_dom, r->next_vcpu); +} + void sched_switch_process(struct pcpu_info *p) { struct vcpu_data *prev, *next; @@ -7440,10 +7430,7 @@ void sched_switch_process(struct pcpu_info *p) } * r = (typeof(r))ri->d; if(opt.dump_all) - printf("%s sched_switch prev d%uv%u next d%uv%u\n", - ri->dump_header, - r->prev_dom, r->prev_vcpu, - r->next_dom, r->next_vcpu); + dump_sched_switch(ri); if(r->prev_vcpu > MAX_CPUS) { @@ -7559,6 +7546,14 @@ void sched_summary_domain(struct domain_data *d) } } +void dump_sched_vcpu_action(struct record_info *ri, const char *action) +{ + struct { + unsigned int domid, vcpuid; + } * r = (typeof(r))ri->d; + + printf(" %s %s d%uv%u\n", ri->dump_header, action, r->domid, r->vcpuid); +} void sched_process(struct pcpu_info *p) { @@ -7573,13 +7568,114 @@ void sched_process(struct pcpu_info *p) default: process_generic(&p->ri); } - } else { - if(ri->evt.sub == 1) - sched_runstate_process(p); - else { - UPDATE_VOLUME(p, sched_verbose, ri->size); + return; + } + + if(ri->evt.sub == 1) { + /* TRC_SCHED_MIN */ + sched_runstate_process(p); + } else if (ri->evt.sub == 8) { + /* TRC_SCHED_VERBOSE */ + switch(ri->event) + { + case TRC_SCHED_DOM_ADD: + if(opt.dump_all) { + struct { + unsigned int domid; + } * r = (typeof(r))ri->d; + + printf(" %s domain create d%u\n", ri->dump_header, r->domid); + } + break; + case TRC_SCHED_DOM_REM: + if(opt.dump_all) { + struct { + unsigned int domid, vcpuid; + } * r = (typeof(r))ri->d; + + printf(" %s domain destroy d%u\n", ri->dump_header, r->domid); + } + break; + case TRC_SCHED_SLEEP: + if(opt.dump_all) + dump_sched_vcpu_action(ri, "vcpu_sleep"); + break; + case TRC_SCHED_WAKE: + if(opt.dump_all) + dump_sched_vcpu_action(ri, "vcpu_wake"); + break; + case TRC_SCHED_YIELD: + if(opt.dump_all) + dump_sched_vcpu_action(ri, "vcpu_yield"); + break; + case TRC_SCHED_BLOCK: + if(opt.dump_all) + dump_sched_vcpu_action(ri, "vcpu_block"); + break; + case TRC_SCHED_SHUTDOWN: + case TRC_SCHED_SHUTDOWN_CODE: + if(opt.dump_all) { + struct { + unsigned int domid, vcpuid, reason; + } * r = (typeof(r))ri->d; + + printf(" %s %s d%uv%u, reason = %u\n", ri->dump_header, + ri->event == TRC_SCHED_SHUTDOWN ? "sched_shutdown" : + "sched_shutdown_code", r->domid, r->vcpuid, r->reason); + } + break; + case TRC_SCHED_ADJDOM: + if(opt.dump_all) { + struct { + unsigned int domid; + } * r = (typeof(r))ri->d; + + printf(" %s sched_adjust d%u\n", ri->dump_header, r->domid); + } + break; + case TRC_SCHED_SWITCH: + dump_sched_switch(ri); + break; + case TRC_SCHED_SWITCH_INFPREV: + if(opt.dump_all) { + struct { + unsigned int domid, runtime; + } * r = (typeof(r))ri->d; + + printf(" %s sched_switch prev d%u, run for %u.%uus\n", + ri->dump_header, r->domid, r->runtime / 1000, + r->runtime % 1000); + } + break; + case TRC_SCHED_SWITCH_INFNEXT: + if(opt.dump_all) + { + struct { + unsigned int domid, rsince; + int slice; + } * r = (typeof(r))ri->d; + + printf(" %s sched_switch next d%u", ri->dump_header, r->domid); + if ( r->rsince != 0 ) + printf(", was runnable for %u.%uus, ", r->rsince / 1000, + r->rsince % 1000); + if ( r->slice > 0 ) + printf("next slice %u.%uus\n", 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: + case TRC_SCHED_DOM_TIMER_FN: + break; + default: process_generic(&p->ri); } + } else { + UPDATE_VOLUME(p, sched_verbose, ri->size); + process_generic(&p->ri); } }