From patchwork Fri Apr 7 16:56:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9669947 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 7E494602A0 for ; Fri, 7 Apr 2017 16:58:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F037285C5 for ; Fri, 7 Apr 2017 16:58:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63EE728617; Fri, 7 Apr 2017 16:58: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=-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 B6B30285C5 for ; Fri, 7 Apr 2017 16:58: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 1cwXBy-0001dY-1W; Fri, 07 Apr 2017 16:56:58 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwXBw-0001d7-Su for xen-devel@lists.xenproject.org; Fri, 07 Apr 2017 16:56:56 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id A8/96-01710-8D4C7E85; Fri, 07 Apr 2017 16:56:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnleJIrShJLcpLzFFi42K5GNpwRPf6kec RBu8fCFl83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBkvv5xiKpinVPFo9WXmBsYPkl2MXBxCAjMZ JbZu/8EE4rAIrGGVOLH3BVsXIyeHhMAlVonuHnsIO0biwKE+oCIOILtK4vTuEpCwkICKxM3tq 5gg7J+MEpvnx4PYwgJ6EkeO/mCHsMMkVn+4xQJiswkYSLzZsZcVxBYRUJK4t2oy2EhmgVKJx5 sYQcIsAqoSK7Y1g5XwCnhLdM3eAnYNp4CPxLNTs6BWeUusOz8HbLyogJzEysstUPWCEidnPmG BGKkpsX6XPkiYWUBeYvvbOcwTGEVmIamahVA1C0nVAkbmVYwaxalFZalFuoYWeklFmekZJbmJ mTm6hgamermpxcWJ6ak5iUnFesn5uZsYgYHPAAQ7GJu2ex5ilORgUhLlVfB5EiHEl5SfUpmRW JwRX1Sak1p8iFGDg0Ngwtm505mkWPLy81KVJHhnHH4eISRYlJqeWpGWmQOMTZhSCQ4eJRHemy Bp3uKCxNzizHSI1ClGS44Xl9+/Z+J4t/QDkHyy8sd7JiGweVLivNwgDQIgDRmleXDjYOnjEqO slDAvI9CxQjwFqUW5mSWo8q8YxTkYlYR5F4FM4cnMK4Hb+groICagg3xuPQU5qCQRISXVwFhu s+EDV3x86nsLH89uC0UvHb/A04VzV/e++3WQ+zHfzM6j/47ImjXYSWZlh8wU8daJ5/n9+pqla V9Z0i2ZNbXT5kpK+qnZV01+ezGOzZktm3PBOY19MSyVqRai0aWxfsdqDp28LrpuxXkvW4Z4ll UxmqLuRRsN57CWnFx9N/FO90H3r1LZSizFGYmGWsxFxYkAWnc0ohoDAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1491584215!92267379!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.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13179 invoked from network); 7 Apr 2017 16:56:55 -0000 Received: from mail-wr0-f196.google.com (HELO mail-wr0-f196.google.com) (209.85.128.196) by server-6.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 7 Apr 2017 16:56:55 -0000 Received: by mail-wr0-f196.google.com with SMTP id u18so13063129wrc.1 for ; Fri, 07 Apr 2017 09:56:55 -0700 (PDT) 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=okBWqu2wD27OQYkd+Hu8CY92bkFVqDYBPc8RDEMMWUg=; b=Y4uIZDtcEcMcgNJo91FYjPcOj0Kc2dUY4T5ww3m3yGXIE1tySGQ//nHjvqKlQLOA24 uOK9PqewfvGna3ZTAplL7StqgMG43cn9OfNJWag/03w7ayzjpMMntk0wyUvDvHIXhSTk u0cBC+qn5ey/lEvYi+h/lTPhKCRCxfw+UegSqxK7WNbIGRudwGRm5r9L+1EnXir/Ra6F RINFDB8L5sg6KCnjQFa93tNS2h80/LQ5t8tNAWIFyEQJsR9RtHiRwFYvb6s+Y5lzRE1y ykjA22QxFji0GH1OZ5eKPo0SgePuyV1tCSS1ZNWw4oXeElJPWDyI6fAyXRa4yduRK+FF YfSg== 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=okBWqu2wD27OQYkd+Hu8CY92bkFVqDYBPc8RDEMMWUg=; b=dpRTjWddfHKIPKj1vKLmfUfI3w6LiMfftnUf9Tln0t0bWlRAowz97QLqnD/q1wEmSo wtToJMXIHGfKZ7wfidxg0TAWcWV+IPQh9wH/B81IU2b/sSEO5VxN84ru2r5Snu/PbmUi kHQkXC57XtdbiU80QH9FBbBAy/YHUrHbUyEECpw+dNHbvCyzNfOidUkNblww4bFeYRTd ez0DnvRp0eiMWJe+lk01RpL1qWWR1V4BaNTilYOsd1P1lX9mBudHPk2itEQiYzQcckUV CLwApY8GfIr+HAkCNXb+LXSqO9cjcZMSpIW/Hv634t6g82H2GT6Q0Z53ogdKAaI4s3M7 rccA== X-Gm-Message-State: AFeK/H2SAXgszios7llrxA/GMARsNBiCXLV+dW8JTpwM9YI/bPVqPrZ0vb1JzxHmALeEvw== X-Received: by 10.223.134.152 with SMTP id 24mr28163217wrx.30.1491584214884; Fri, 07 Apr 2017 09:56:54 -0700 (PDT) Received: from Solace.fritz.box ([80.66.223.217]) by smtp.gmail.com with ESMTPSA id 51sm6656299wrx.38.2017.04.07.09.56.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Apr 2017 09:56:54 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 07 Apr 2017 18:56:52 +0200 Message-ID: <149158421286.32558.5445421597112250684.stgit@Solace.fritz.box> In-Reply-To: <149158365254.32558.7658440932477066488.stgit@Solace.fritz.box> References: <149158365254.32558.7658440932477066488.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Wei Liu , Ian Jackson , George Dunlap Subject: [Xen-devel] [PATCH v3 4/7] xen/tools: tracing: add record for credit1 runqueue stealing. 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 Including whether we actually tried stealing a vCPU from a given pCPU, or we skipped that one, because of lock contention. Signed-off-by: Dario Faggioli Acked-by: George Dunlap --- Cc: Ian Jackson Cc: Wei Liu --- Changes from v2: * make the code less cool! :-( (i.e., change "skipp'n" to just "skip" in a comment.) --- tools/xentrace/formats | 1 + tools/xentrace/xenalyze.c | 11 +++++++++++ xen/common/sched_credit.c | 6 +++++- xen/include/xen/perfc_defn.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/xentrace/formats b/tools/xentrace/formats index a055231..8b31780 100644 --- a/tools/xentrace/formats +++ b/tools/xentrace/formats @@ -47,6 +47,7 @@ 0x00022008 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched:unboost [ dom:vcpu = 0x%(1)04x%(2)04x ] 0x00022009 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched:schedule [ cpu[16]:tasklet[8]:idle[8] = %(1)08x ] 0x0002200A CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched:ratelimit [ dom:vcpu = 0x%(1)08x, runtime = %(2)d ] +0x0002200B CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched:steal_check [ peer_cpu = %(1)d, checked = %(2)d ] 0x00022201 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched2:tick 0x00022202 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) csched2:runq_pos [ dom:vcpu = 0x%(1)08x, pos = %(2)d] diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c index 029c89d..fa608ad 100644 --- a/tools/xentrace/xenalyze.c +++ b/tools/xentrace/xenalyze.c @@ -7651,6 +7651,17 @@ void sched_process(struct pcpu_info *p) r->runtime / 1000, r->runtime % 1000); } break; + case TRC_SCHED_CLASS_EVT(CSCHED, 11): /* STEAL_CHECK */ + if(opt.dump_all) { + struct { + unsigned int peer_cpu, check; + } *r = (typeof(r))ri->d; + + printf(" %s csched:load_balance %s %u\n", + ri->dump_header, r->check ? "checking" : "skipping", + r->peer_cpu); + } + break; /* CREDIT 2 (TRC_CSCHED2_xxx) */ case TRC_SCHED_CLASS_EVT(CSCHED2, 1): /* TICK */ case TRC_SCHED_CLASS_EVT(CSCHED2, 4): /* CREDIT_ADD */ diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 7b4ea02..59b87f7 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -134,6 +134,7 @@ #define TRC_CSCHED_BOOST_END TRC_SCHED_CLASS_EVT(CSCHED, 8) #define TRC_CSCHED_SCHEDULE TRC_SCHED_CLASS_EVT(CSCHED, 9) #define TRC_CSCHED_RATELIMIT TRC_SCHED_CLASS_EVT(CSCHED, 10) +#define TRC_CSCHED_STEAL_CHECK TRC_SCHED_CLASS_EVT(CSCHED, 11) /* @@ -1753,14 +1754,17 @@ csched_load_balance(struct csched_private *prv, int cpu, * balancing and trying to lock this CPU. */ spinlock_t *lock = pcpu_schedule_trylock(peer_cpu); - + SCHED_STAT_CRANK(steal_trylock); if ( !lock ) { SCHED_STAT_CRANK(steal_trylock_failed); + TRACE_2D(TRC_CSCHED_STEAL_CHECK, peer_cpu, /* skip */ 0); peer_cpu = cpumask_cycle(peer_cpu, &workers); continue; } + TRACE_2D(TRC_CSCHED_STEAL_CHECK, peer_cpu, /* checked */ 1); + /* Any work over there to steal? */ speer = cpumask_test_cpu(peer_cpu, online) ? csched_runq_steal(peer_cpu, cpu, snext->pri, bstep) : NULL; diff --git a/xen/include/xen/perfc_defn.h b/xen/include/xen/perfc_defn.h index 0d702f0..53849af 100644 --- a/xen/include/xen/perfc_defn.h +++ b/xen/include/xen/perfc_defn.h @@ -48,6 +48,7 @@ PERFCOUNTER(vcpu_unpark, "csched: vcpu_unpark") PERFCOUNTER(load_balance_idle, "csched: load_balance_idle") PERFCOUNTER(load_balance_over, "csched: load_balance_over") PERFCOUNTER(load_balance_other, "csched: load_balance_other") +PERFCOUNTER(steal_trylock, "csched: steal_trylock") PERFCOUNTER(steal_trylock_failed, "csched: steal_trylock_failed") PERFCOUNTER(steal_peer_idle, "csched: steal_peer_idle") PERFCOUNTER(migrate_queued, "csched: migrate_queued")