linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Wei Li" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Wei Li <liwei391@huawei.com>, Jiri Olsa <jolsa@redhat.com>,
	Tan Xiaojun <tanxiaojun@huawei.com>,
	stable@vger.kernel.org, #@tip-bot2.tec.linutronix.de,
	5.4+@tip-bot2.tec.linutronix.de,
	Adrian Hunter <adrian.hunter@intel.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>, x86 <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [tip: perf/urgent] perf intel-bts: Fix endless record after being terminated
Date: Wed, 26 Feb 2020 14:20:38 -0000	[thread overview]
Message-ID: <158272683867.28353.17520525770121147020.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20200214132654.20395-3-adrian.hunter@intel.com>

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     783fed2f35e2a6771c8dc6ee29b8c4b9930783ce
Gitweb:        https://git.kernel.org/tip/783fed2f35e2a6771c8dc6ee29b8c4b9930783ce
Author:        Wei Li <liwei391@huawei.com>
AuthorDate:    Fri, 14 Feb 2020 15:26:51 +02:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Tue, 18 Feb 2020 10:13:29 -03:00

perf intel-bts: Fix endless record after being terminated

In __cmd_record(), when receiving SIGINT(ctrl + c), a 'done' flag will
be set and the event list will be disabled by evlist__disable() once.

While in auxtrace_record.read_finish(), the related events will be
enabled again, if they are continuous, the recording seems to be
endless.

If the intel_bts event is disabled, we don't enable it again here.

Note: This patch is NOT tested since i don't have such a machine with
intel_bts feature, but the code seems buggy same as arm-spe and
intel-pt.

Signed-off-by: Wei Li <liwei391@huawei.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Tan Xiaojun <tanxiaojun@huawei.com>
Cc: stable@vger.kernel.org # 5.4+
Link: http://lore.kernel.org/lkml/20200214132654.20395-3-adrian.hunter@intel.com
[ahunter: removed redundant 'else' after 'return']
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/arch/x86/util/intel-bts.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
index 27d9e21..39e3631 100644
--- a/tools/perf/arch/x86/util/intel-bts.c
+++ b/tools/perf/arch/x86/util/intel-bts.c
@@ -420,9 +420,12 @@ static int intel_bts_read_finish(struct auxtrace_record *itr, int idx)
 	struct evsel *evsel;
 
 	evlist__for_each_entry(btsr->evlist, evsel) {
-		if (evsel->core.attr.type == btsr->intel_bts_pmu->type)
+		if (evsel->core.attr.type == btsr->intel_bts_pmu->type) {
+			if (evsel->disabled)
+				return 0;
 			return perf_evlist__enable_event_idx(btsr->evlist,
 							     evsel, idx);
+		}
 	}
 	return -EINVAL;
 }

  reply	other threads:[~2020-02-26 14:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 13:26 [PATCH 0/5] perf tools: fix endless record after being terminated Adrian Hunter
2020-02-14 13:26 ` [PATCH V2 1/5] perf tools: intel-pt: " Adrian Hunter
2020-02-26 14:20   ` [tip: perf/urgent] perf intel-pt: Fix " tip-bot2 for Wei Li
2020-02-14 13:26 ` [PATCH V2 2/5] perf tools: intel-bts: fix " Adrian Hunter
2020-02-26 14:20   ` tip-bot2 for Wei Li [this message]
2020-02-14 13:26 ` [PATCH V2 3/5] perf tools: cs-etm: " Adrian Hunter
2020-02-14 14:07   ` Adrian Hunter
2020-02-14 14:43   ` Leo Yan
2020-02-14 18:24   ` Mathieu Poirier
2020-02-26 14:20   ` [tip: perf/urgent] perf cs-etm: Fix " tip-bot2 for Wei Li
2020-02-14 13:26 ` [PATCH 4/5] perf tools: arm-spe: fix " Adrian Hunter
2020-02-26 14:20   ` [tip: perf/urgent] perf arm-spe: Fix " tip-bot2 for Adrian Hunter
2020-02-14 13:26 ` [PATCH 5/5] perf auxtrace: Add auxtrace_record__read_finish() Adrian Hunter
2020-02-14 14:08   ` Adrian Hunter
2020-02-14 14:48   ` Leo Yan
2020-02-17  8:23     ` [PATCH V2 " Adrian Hunter
2020-02-17 14:42       ` Arnaldo Carvalho de Melo
2020-02-26 14:20       ` [tip: perf/urgent] " tip-bot2 for Adrian Hunter
2020-02-14 18:27   ` [PATCH 5/5] " Mathieu Poirier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=158272683867.28353.17520525770121147020.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=#@tip-bot2.tec.linutronix.de \
    --cc=5.4+@tip-bot2.tec.linutronix.de \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=stable@vger.kernel.org \
    --cc=tanxiaojun@huawei.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).