From patchwork Tue Feb 28 11:52:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9595307 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 56BFB601D7 for ; Tue, 28 Feb 2017 11:54:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 448DC27816 for ; Tue, 28 Feb 2017 11:54:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3974027F07; Tue, 28 Feb 2017 11:54:51 +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 CBB4727816 for ; Tue, 28 Feb 2017 11:54:50 +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 1cigKs-0001Ik-9z; Tue, 28 Feb 2017 11:52:54 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cigKq-0001Hh-LN for xen-devel@lists.xenproject.org; Tue, 28 Feb 2017 11:52:52 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 6D/2C-14551-39465B85; Tue, 28 Feb 2017 11:52:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJIsWRWlGSWpSXmKPExsVyMbThiO7klK0 RBtdvclt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBkdR/vZCxaoVGyc1sTcwPhDuouRi0NIYAaj xN0Lh5lBHBaBNawSTS/WMnYxcnJICFxilZjR4wJhx0ic2A1SBGJXSUz69psdxBYSUJG4uX0VE 8SkH4wSh19PYwVJCAvoSRw5+oMdws6Q2DJpCVicTcBA4s2OvWC2iICSxL1Vk4GaOTiYBfQlVn /lATFZBFQljkxwBDF5BbwldvyQAjE5BXwklt+wADGFgKLbHseCjBAVkJNYebkFbByvgKDEyZl PWCDGaUqs36UPEmYWkJfY/nYO8wRGkVlIqmYhVM1CUrWAkXkVo0ZxalFZapGukZFeUlFmekZJ bmJmjq6hgbFebmpxcWJ6ak5iUrFecn7uJkZg0NczMDDuYJx6wu8QoyQHk5Iob1by1gghvqT8l MqMxOKM+KLSnNTiQ4wyHBxKErw8wCgSEixKTU+tSMvMAcYfTFqCg0dJhPcFSCtvcUFibnFmOk TqFKMlx4NTu94wccyZvRtIfuo//IZJiCUvPy9VSpz3OkiDAEhDRmke3DhYirjEKCslzMvIwMA gxFOQWpSbWYIq/4pRnINRSZj3JMgUnsy8Eritr4AOYgI5SAXsoJJEhJRUA2O7rprD25B249dy uts3Tqj1q/kSrFZ/RKnbXSPV4tFB5jBuSe2YDYWKNWZ3LNTPFTy2yczp3fDAquHxRduJPY5pG imXTCUv/V/xirv3Zoe4I0e3+5JVZ+77ndpXHTvpYYfbXTNG5iBLgbh3toyRhQ4m8WlbIhZEJx y5Z3SMbQ3fuUDvSX6HlFiKMxINtZiLihMBADhRBQwDAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1488282770!29721629!1 X-Originating-IP: [209.85.128.196] 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 59622 invoked from network); 28 Feb 2017 11:52:51 -0000 Received: from mail-wr0-f196.google.com (HELO mail-wr0-f196.google.com) (209.85.128.196) by server-4.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Feb 2017 11:52:51 -0000 Received: by mail-wr0-f196.google.com with SMTP id u48so1324071wrc.1 for ; Tue, 28 Feb 2017 03:52:51 -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=IS/JYo6fMGORf9+vpYK+mGQPxqa2iqeUHBno+HcrscDnx4u2uavkfL2dHcnyr6r294 6RYVLogrzGjUucf8IrC6+Zq3woLzinyXxaM33K4kJB/dfdT4ciiHXEUOLwCdzYrRLMbs tc51rPwrZdZ8obQxgLd5l9J7NbOUuk5uuz6dTSs6fieuTdNwTjgCCwZOUj9h3HkTuuEF MSiSISLT+mUlWRckjbDoflOO7kbuSi7f0/OLYAWYx1SVXXhnjo1FJhTnVbQZTUL3FIRb uFYgxtlG7LS4emyCFUO/FjwlHeoKQj2ZOs/puO8cwPybucB0ag3quQw986fnOWKtjLNo yadw== 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=RG2/F6lqMlN0ci0gRm4K6SMZpqadXUW6rKFhGrwrVPDSydij8qp+EUtgRRPUQXusSn XrrlgCVd0A3KdbWvW016wMfJ7D1uWCZtI1RFdeJPUPBCEyfsnIPn83BCG0Vewow3ZoA+ 3PPy/XKdnDOjAcmp8iiBj1cISV1J+oaZlEnrAl8qSX0UzlQ4O3i6vG8QHCbT64eQ7bGx p1W4fgGqyATzYS/dqH3f8BUhH8eTHrTuktVPVQeaHH4WqnRfcRTfNJ2kA5R8reTG0eMC Ibz96sZIlhqRI/MwTjV93yUKKeKCkt2yzPhzagOs/siLNLnSJZZhr8KMCw0buSs/UssO P2Og== X-Gm-Message-State: AMke39n6EKLHdTHYZK5vxoIYr8Vac+mBOthlMPSfyISpZ7Jiw37xRmmmjGuCZBzOpS3T3Q== X-Received: by 10.223.139.154 with SMTP id o26mr1886670wra.56.1488282770703; Tue, 28 Feb 2017 03:52:50 -0800 (PST) Received: from Solace.fritz.box ([80.66.223.93]) by smtp.gmail.com with ESMTPSA id y1sm2343730wme.15.2017.02.28.03.52.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Feb 2017 03:52:50 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Tue, 28 Feb 2017 12:52:49 +0100 Message-ID: <148828276839.26730.5823952761975657384.stgit@Solace.fritz.box> In-Reply-To: <148828109243.26730.2771577013485070217.stgit@Solace.fritz.box> References: <148828109243.26730.2771577013485070217.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap Subject: [Xen-devel] [PATCH v3 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 --- 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)