From patchwork Tue Feb 16 18:12:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 8330581 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AE4AE9F399 for ; Tue, 16 Feb 2016 18:15:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD735202A1 for ; Tue, 16 Feb 2016 18:15:14 +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 8D7E520268 for ; Tue, 16 Feb 2016 18:15:12 +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 1aVk7K-00040d-JX; Tue, 16 Feb 2016 18:12:54 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aVk7J-000406-LN for xen-devel@lists.xenproject.org; Tue, 16 Feb 2016 18:12:53 +0000 Received: from [193.109.254.147] by server-5.bemta-14.messagelabs.com id D6/14-23366-4A663C65; Tue, 16 Feb 2016 18:12:52 +0000 X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1455646371!23387259!1 X-Originating-IP: [74.125.82.68] 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 51450 invoked from network); 16 Feb 2016 18:12:52 -0000 Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by server-4.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 16 Feb 2016 18:12:52 -0000 Received: by mail-wm0-f68.google.com with SMTP id c200so21907016wme.0 for ; Tue, 16 Feb 2016 10:12:52 -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=B9toEMI3sb3+z2nNjJvgJoTxRdKxvFmYd5ByoE5MrYI=; b=PDWXoT7tERqKEyrR7vsPWKZPmGd6dr6Tz7d6Y4gyI27q92zM0ThIIi4J4TpsFH4i3G W14wGzMS8AWkQnM/iIJDb26skyuc8fvf72RMRO7PPKrt6s/rLuH/04xhiSdGFnl9A+wV 1bhlSxJOWsKMV4A1DRY8iGf1se/8IBSm8XnkBw5W25ux9f3fnuQs2V2uu0GY6Xu0ME3n 0UQ1fV1BZ2mJyHRsVvYrYwzxNLO2CQ/cXIzFRt3CWumZjZrN/qoQRKq0hajE6Q1wUtNA Vt+Jzu7dV0Ka0VJV2NpbvT7dKqUKUB36TGhMaV3Y+vD/8u8WHUCLoIrI59Z+gecL89Rp w4+w== 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=B9toEMI3sb3+z2nNjJvgJoTxRdKxvFmYd5ByoE5MrYI=; b=UlGW92kpogBU6Gvle/JsfTn2pFCIpvEgiYDN7t917jB1aURGMDkvFgM0ajmDd2nvtG 7RyjVEe0x1ffyXr/Np5nClCZk/4w8Qu3r+3d7R6vYOCtalTx8ZmSLQQmeFEk+bPJY6+B uPLhQ+AUnZ61UQhzWEAfzngxoCRtTNtCNHlIwCc+m4eAqn6tnNlwXLMbG61/63uYfT8Q Wn0kMQntYFkmqewjIZMG7Cyp+1xyIBQFWi43ZA6TDgqekxyTC/FiA9i15JVzRDbdhIc3 8o+3tz8WG1Uon2hdeoJD37sLp3p/ab2I+kCnkbMK4n6xI1NX0CoZf/QfUNrnOcVrH+L3 uvaA== X-Gm-Message-State: AG10YOTTYc5rTdQ2ffhcSdc2Gr3j2D59Udy6vmAHTaJIv34sgcbdhb12GFAtkmV+ZyHZ1A== X-Received: by 10.194.23.37 with SMTP id j5mr10135570wjf.171.1455646371785; Tue, 16 Feb 2016 10:12:51 -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 ka4sm31357117wjc.47.2016.02.16.10.12.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Feb 2016 10:12:50 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Tue, 16 Feb 2016 19:12:46 +0100 Message-ID: <20160216181246.27876.12592.stgit@Solace.station> In-Reply-To: <20160216180550.27876.22680.stgit@Solace.station> References: <20160216180550.27876.22680.stgit@Solace.station> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Olaf Hering , Wei Liu , Ian Campbell , George Dunlap , Ian Jackson Subject: [Xen-devel] [PATCH v2 12/16] 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 Acked-by: George Dunlap --- Cc: George Dunlap Cc: Ian Jackson Cc: Ian Campbell Cc: Wei Liu Cc: Olaf Hering --- Changes from v1: * SCHED_DOM_{ADD,REM} handling slightly changed, to avoid confusion with DOM0_DOM_{ADD,REM} (introduced later in the series); * '} * r =' turned into '} *r =', as requested during review. --- 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..17021f1 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 sched_init_domain 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 sched_destroy_domain 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); } }