Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1786003ybj; Sun, 22 Sep 2019 11:54:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9awWDVNG3Kl5n8FELdCB95qyWn8rhRCx1RxDF0RRNbsGo/34QQh3/4DBrDGrUXDxuTqTI X-Received: by 2002:a50:a41c:: with SMTP id u28mr33091993edb.185.1569178460555; Sun, 22 Sep 2019 11:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569178460; cv=none; d=google.com; s=arc-20160816; b=FQo8+/r6CGlO9DXpBB508YKWZSQaCUFdShTp76IB9LaposESaY84WPXch6gpl+3r3F gnXrVQhkB64qrLxPddfjXWbnkjI7XOIb5QrkuH1L/OhgwNB0tUi3qMF0vs9ZoZcf1LyF 9+gV+j6TV9+8L4UWMH7jSXj4z+BLjx0ZGBaUWWX5fk4Hj6MWgpiAqZIQ513DU5QSgzz+ zByp5rXABuq7Vmey0QzuIRUBdt/GIdJTf02i11jYGAkes2Eh4M3SY4F+8MT5ohSPi9wr WqStWfPGFr9KBvsqx2h3QfLw4MG5XJOlXGhoGf06sDdFHK90xNxdmk6GlAeSbk+aC7al 2Bhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=FqeA4t7YZOxkwTQM3wuj1vP8J4gTRNn55hsrDfs1LBk=; b=oJQyBZ/l00Css34p6phk176iUHLsgaT5xKSkRNKV+RP40C1ckL7+7SRTOUxuJzEjER 3YMW/QtnF+yQbfBJGb7wzRXtVUpUBPoy+HnlOaOv4PYqlyvhuuexG5kftTzqt6Z4lY/N zBKjf9ABA7Bsk++l9g1m+JeJ4dyuIlJa98LHjPgDtKg78lfcshskVRQJ498yLQ2U2I5W /h3A4Zbzg7rfS0IkLTAOW1mC17j3qElAnJGoxTuX0lz2SEDGcRrWf3NJJ8oDb2WaOYw8 AOoc3YBZ+iO3rs9HBhuBOX3jo+KjdljHSkaWRS/z7JcookGuuGeepvcyqQncFwccwy/y 5s5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x15si5360938eda.53.2019.09.22.11.53.57; Sun, 22 Sep 2019 11:54:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405261AbfITQVb (ORCPT + 99 others); Fri, 20 Sep 2019 12:21:31 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:52878 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404984AbfITQVU (ORCPT ); Fri, 20 Sep 2019 12:21:20 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iBLeT-00040d-PU; Fri, 20 Sep 2019 18:20:57 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id BFAD71C0DAE; Fri, 20 Sep 2019 18:20:56 +0200 (CEST) Date: Fri, 20 Sep 2019 16:20:56 -0000 From: "tip-bot2 for Anju T Sudhakar" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf kvm stat: Set 'trace_cycles' as default event for 'perf kvm record' in powerpc Cc: Anju T Sudhakar , Ravi Bangoria , Alexander Shishkin , Jiri Olsa , Madhavan Srinivasan , Michael Ellerman , Namhyung Kim , Peter Zijlstra , linuxppc-dev@lists.ozlabs.org, Arnaldo Carvalho de Melo , Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: <20190718181749.30612-3-anju@linux.vnet.ibm.com> References: <20190718181749.30612-3-anju@linux.vnet.ibm.com> MIME-Version: 1.0 Message-ID: <156899645662.24167.1538786694550700474.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 2bff2b828502b5e5d5ea5a52643d3542053df03f Gitweb: https://git.kernel.org/tip/2bff2b828502b5e5d5ea5a52643d3542053df03f Author: Anju T Sudhakar AuthorDate: Thu, 18 Jul 2019 23:47:49 +05:30 Committer: Arnaldo Carvalho de Melo CommitterDate: Fri, 20 Sep 2019 10:28:26 -03:00 perf kvm stat: Set 'trace_cycles' as default event for 'perf kvm record' in powerpc Use 'trace_imc/trace_cycles' as the default event for 'perf kvm record' in powerpc. Signed-off-by: Anju T Sudhakar Reviewed-by: Ravi Bangoria Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Namhyung Kim Cc: Peter Zijlstra Cc: linuxppc-dev@lists.ozlabs.org Link: http://lore.kernel.org/lkml/20190718181749.30612-3-anju@linux.vnet.ibm.com [ Add missing pmu.h header, needed because this patch uses pmu_have_event() ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/arch/powerpc/util/kvm-stat.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/perf/arch/powerpc/util/kvm-stat.c b/tools/perf/arch/powerpc/util/kvm-stat.c index ec5b771..9cc1c4a 100644 --- a/tools/perf/arch/powerpc/util/kvm-stat.c +++ b/tools/perf/arch/powerpc/util/kvm-stat.c @@ -5,6 +5,7 @@ #include "util/debug.h" #include "util/evsel.h" #include "util/evlist.h" +#include "util/pmu.h" #include "book3s_hv_exits.h" #include "book3s_hcalls.h" @@ -177,8 +178,9 @@ int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid __maybe_unused) /* * Incase of powerpc architecture, pmu registers are programmable * by guest kernel. So monitoring guest via host may not provide - * valid samples. It is better to fail the "perf kvm record" - * with default "cycles" event to monitor guest in powerpc. + * valid samples with default 'cycles' event. It is better to use + * 'trace_imc/trace_cycles' event for guest profiling, since it + * can track the guest instruction pointer in the trace-record. * * Function to parse the arguments and return appropriate values. */ @@ -202,8 +204,14 @@ int kvm_add_default_arch_event(int *argc, const char **argv) parse_options(j, tmp, event_options, NULL, PARSE_OPT_KEEP_UNKNOWN); if (!event) { - free(tmp); - return -EINVAL; + if (pmu_have_event("trace_imc", "trace_cycles")) { + argv[j++] = strdup("-e"); + argv[j++] = strdup("trace_imc/trace_cycles/"); + *argc += 2; + } else { + free(tmp); + return -EINVAL; + } } free(tmp);