From patchwork Wed Aug 17 17:18:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9286211 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 30B8D60839 for ; Wed, 17 Aug 2016 17:20:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21058294AC for ; Wed, 17 Aug 2016 17:20:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15DB7294C0; Wed, 17 Aug 2016 17:20:53 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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 84152294AC for ; Wed, 17 Aug 2016 17:20:52 +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 1ba4UD-000082-Lz; Wed, 17 Aug 2016 17:18:41 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba4UC-000071-9e for xen-devel@lists.xenproject.org; Wed, 17 Aug 2016 17:18:40 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 86/15-13744-F6C94B75; Wed, 17 Aug 2016 17:18:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIIsWRWlGSWpSXmKPExsXiVRvkqJs3Z0u 4wf37Bhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aB52eYC74qV3zt5G9g/CfZxcjFISQwnVFi x9uZTCAOi8AaVomzMycxgjgSApdYJd5f/c/cxcgJ5MRIPDx8kA3CLpOYOeUyI4gtJKAicXP7K iaIUXOZJF7v28cOkhAW0JM4cvQHlB0gMbl9MxOIzSZgIPFmx15WEFtEQEni3qrJYHFmgQqJFS 9vgNksAqoSFy+2A/VycPAK+Ei8+CULEuYEMm+t/s0Csddb4vDkHrB7RAXkJFZebgEbySsgKHF y5hMWkFZmAU2J9bv0IabLS2x/O4d5AqPILCRVsxCqZiGpWsDIvIpRozi1qCy1SNfQUi+pKDM9 oyQ3MTNH19DATC83tbg4MT01JzGpWC85P3cTIzD4GYBgB+OPZQGHGCU5mJREee9UbwkX4kvKT 6nMSCzOiC8qzUktPsQow8GhJMGrNhsoJ1iUmp5akZaZA4xDmLQEB4+SCG8tSJq3uCAxtzgzHS J1ilGXY8vUe2uZhFjy8vNSpcR5U0CKBECKMkrz4EbAUsIlRlkpYV5GoKOEeApSi3IzS1DlXzG KczAqCfPqg0zhycwrgdv0CugIJqAjePnBjihJREhJNTDKmx+daqMiFGIcxv5U+sdC61dzX+7k 2vhrp9RxZu6E+ovtncGvrN/dSq2reDjhz7Tmlfd5NIWapnuckwu94OrZzJgnpXiBoa/42Y3K5 427Vy2/3Sozm5nH6tfjzVMnLb7bEukafugkp1Pqy6q8uV8mblv8WuVWwqsNBvW1O9YL9jQzsO +s4f2gxFKckWioxVxUnAgAsJ/66gQDAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1471454318!29009699!1 X-Originating-IP: [74.125.82.65] X-SpamReason: No, hits=0.2 required=7.0 tests=RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42905 invoked from network); 17 Aug 2016 17:18:38 -0000 Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by server-7.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Aug 2016 17:18:38 -0000 Received: by mail-wm0-f65.google.com with SMTP id i5so26282068wmg.2 for ; Wed, 17 Aug 2016 10:18:38 -0700 (PDT) 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-transfer-encoding; bh=8jnrazOCcjmI5Ho3wzciqN/VqWuL6tU7jL+m4n6RpjU=; b=myJgDPnj2y0RruN9lVs83uQAVYxUpDZ3cr4GSJvw/t3JauSG2mUqmyVbdABhUGGbYj +xuTJgxDEkt8WA0dA8r8rl6oSNtlVvu3YY7e75BsWGhgrWZNRv6OXbFXEi/QAaO+mtET XGEQsE3hG9lW8SiIauREzmgoSw859E0DnUMzGYup0/K3tjQOJCX49eQ4xMnpWyEitqhh SrhhUjvo4lFWYhJ0wpPKIPKBDsZOLwBphD9c0qzxwGowfD2dnQxESgLQET28ycEyDshz IsgPOwuPTpyWVpmVZL++kOdbP0TzcYF8JFj4tdAgeJ2PKkZbhr4Qa49P/yBJRxhY/AGo gezw== 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-transfer-encoding; bh=8jnrazOCcjmI5Ho3wzciqN/VqWuL6tU7jL+m4n6RpjU=; b=OBaRb+puHhkrSCFTEcY6ne8JKjkuLt53ggTGGhDCYrs8eb9OT/brmONFajAAXyw8i7 4ARSyBs2BkB8yWRafBuf/EskkhFPXBwis53VOm+A26sU4HZa335Y42rQWHJgZL6Pxe8M zb9SMV4sxVNfJOTjXLrZtSbeVM+c+MF3rOG6FHPkOVQ3WV3UOydyimlrQMLMJ4/0Si0+ +AxrR3ljb1Qz5OsLB1PE6IkmZaIVwrqVRC+eJy83SiroH+zE3PV/Fq5TLMA+RV3mYdHR 4CcBSkZLwCdMEVJFLS+Iy6Su3/bTLF8j21sXzM7Lk5MU8qX+pAjgghupJ8lgspbI5xod BkEg== X-Gm-Message-State: AEkoouvvhuVveQlxBqixuh+yHuk9ekytDmSSJ+3eeHz3aEOO68yWOuH0NzeJ972M6PeD5w== X-Received: by 10.28.26.5 with SMTP id a5mr29273945wma.27.1471454318321; Wed, 17 Aug 2016 10:18:38 -0700 (PDT) Received: from Solace.fritz.box (net-2-32-14-104.cust.vodafonedsl.it. [2.32.14.104]) by smtp.gmail.com with ESMTPSA id m81sm27553865wmf.1.2016.08.17.10.18.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Aug 2016 10:18:37 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Wed, 17 Aug 2016 19:18:36 +0200 Message-ID: <147145431646.25877.11886226353917845092.stgit@Solace.fritz.box> In-Reply-To: <147145358844.25877.7490417583264534196.stgit@Solace.fritz.box> References: <147145358844.25877.7490417583264534196.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap , Wei Liu , Ian Jackson Subject: [Xen-devel] [PATCH 09/24] xen/tools: tracing: improve tracing of context switches. 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 Right now, two out of the three events related to context switch (that is TRC_SCHED_SWITCH_INFPREV and TRC_SCHED_SWITCH_INFNEXT) only report the domain id, and not the vcpu id. That's omitting a useful piece of information, and even if we be figured that out by looking at other records, that's unnecessarily complicated (especially if working on a trace from a sctipt). This changes both the tracing code in Xen and the parsing code in tools at once, to avoid introducing transitional regressions. Signed-off-by: Dario Faggioli Acked-by: George Dunlap --- Cc: George Dunlap Cc: Ian Jackson Cc: Wei Liu --- tools/xentrace/formats | 4 ++-- tools/xentrace/xenalyze.c | 17 +++++++++-------- xen/common/schedule.c | 8 ++++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tools/xentrace/formats b/tools/xentrace/formats index caafb5f..0de7990 100644 --- a/tools/xentrace/formats +++ b/tools/xentrace/formats @@ -32,8 +32,8 @@ 0x0002800b CPU%(cpu)d %(tsc)d (+%(reltsc)8d) s_timer_fn 0x0002800c CPU%(cpu)d %(tsc)d (+%(reltsc)8d) t_timer_fn 0x0002800d CPU%(cpu)d %(tsc)d (+%(reltsc)8d) dom_timer_fn -0x0002800e CPU%(cpu)d %(tsc)d (+%(reltsc)8d) switch_infprev [ old_domid = 0x%(1)08x, runtime = %(2)d ] -0x0002800f CPU%(cpu)d %(tsc)d (+%(reltsc)8d) switch_infnext [ new_domid = 0x%(1)08x, time = %(2)d, r_time = %(3)d ] +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 ] 0x00022001 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched:sched_tasklet diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c index 11763a8..0b697d0 100644 --- a/tools/xentrace/xenalyze.c +++ b/tools/xentrace/xenalyze.c @@ -7501,28 +7501,29 @@ void sched_process(struct pcpu_info *p) case TRC_SCHED_SWITCH_INFPREV: if(opt.dump_all) { struct { - unsigned int domid, runtime; + unsigned int domid, vcpuid, 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); + printf(" %s sched_switch prev d%uv%d, run for %u.%uus\n", + ri->dump_header, r->domid, r->vcpuid, + r->runtime / 1000, r->runtime % 1000); } break; case TRC_SCHED_SWITCH_INFNEXT: if(opt.dump_all) { struct { - unsigned int domid, rsince; + unsigned int domid, vcpuid, rsince; int slice; } *r = (typeof(r))ri->d; - printf(" %s sched_switch next d%u", ri->dump_header, r->domid); + printf(" %s sched_switch next d%uv%u", ri->dump_header, + r->domid, r->vcpuid); if ( r->rsince != 0 ) - printf(", was runnable for %u.%uus, ", r->rsince / 1000, + printf(", was runnable for %u.%uus", r->rsince / 1000, r->rsince % 1000); if ( r->slice > 0 ) - printf("next slice %u.%uus", r->slice / 1000, + printf(", next slice %u.%uus", r->slice / 1000, r->slice % 1000); printf("\n"); } diff --git a/xen/common/schedule.c b/xen/common/schedule.c index abe063d..5b444c4 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1390,11 +1390,11 @@ static void schedule(void) return continue_running(prev); } - TRACE_2D(TRC_SCHED_SWITCH_INFPREV, - prev->domain->domain_id, + TRACE_3D(TRC_SCHED_SWITCH_INFPREV, + prev->domain->domain_id, prev->vcpu_id, now - prev->runstate.state_entry_time); - TRACE_3D(TRC_SCHED_SWITCH_INFNEXT, - next->domain->domain_id, + TRACE_4D(TRC_SCHED_SWITCH_INFNEXT, + next->domain->domain_id, next->vcpu_id, (next->runstate.state == RUNSTATE_runnable) ? (now - next->runstate.state_entry_time) : 0, next_slice.time);