From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77E99C11D00 for ; Fri, 21 Feb 2020 01:53:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FD9124672 for ; Fri, 21 Feb 2020 01:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582250017; bh=fo0THK1z/yjiZXHFrqk6tMtI3Yzb0ph+fdkBDFOfWyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UqmEcvWTHyhRl71vBjTLx0eDF/uAe/+7RmHsytNZ2MSV62zMHAH35JWuGIdN8n4Og gbU5+afyroguOoaEH5WcqUrOYOv6sHsaybqf/jlYDwC16ozzfv+8kU07AwjUNXGpiM HcfUDvoHwTbZJT7fzjqTLrBKD8NWz/0d5QIAHTMo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729618AbgBUBxa (ORCPT ); Thu, 20 Feb 2020 20:53:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:57138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729615AbgBUBxa (ORCPT ); Thu, 20 Feb 2020 20:53:30 -0500 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B3A032465D; Fri, 21 Feb 2020 01:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582250009; bh=fo0THK1z/yjiZXHFrqk6tMtI3Yzb0ph+fdkBDFOfWyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gl/b/nAhEqvFosnh445GA2DJanuwBPZcRXwS81NRCdKByEr2P+OV8FosxXSElGd8y q5ZpiPKLfUJRF3+A/1hPOhVKSOcYYX4Qc4f/A4PcuT48lz+ApD5EVBOEpxNGGIkXrC EPh5qJ2L+yEGxjvG0D1RQEzeoU3Ryd5vr7e0AMMs= From: Arnaldo Carvalho de Melo To: Ingo Molnar , Thomas Gleixner Cc: Jiri Olsa , Namhyung Kim , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Wei Li , Jiri Olsa , Tan Xiaojun , stable@vger.kernel.org, Adrian Hunter , Arnaldo Carvalho de Melo Subject: [PATCH 3/8] perf intel-pt: Fix endless record after being terminated Date: Thu, 20 Feb 2020 22:53:05 -0300 Message-Id: <20200221015310.16914-4-acme@kernel.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200221015310.16914-1-acme@kernel.org> References: <20200221015310.16914-1-acme@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wei Li 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_pt event is disabled, we don't enable it again here. Before the patch: huawei@huawei-2288H-V5:~/linux-5.5-rc4/tools/perf$ ./perf record -e \ intel_pt//u -p 46803 ^C^C^C^C^C^C After the patch: huawei@huawei-2288H-V5:~/linux-5.5-rc4/tools/perf$ ./perf record -e \ intel_pt//u -p 48591 ^C[ perf record: Woken up 0 times to write data ] Warning: AUX data lost 504 times out of 4816! [ perf record: Captured and wrote 2024.405 MB perf.data ] Signed-off-by: Wei Li Cc: Jiri Olsa Cc: Tan Xiaojun Cc: stable@vger.kernel.org # 5.4+ Link: http://lore.kernel.org/lkml/20200214132654.20395-2-adrian.hunter@intel.com [ ahunter: removed redundant 'else' after 'return' ] Signed-off-by: Adrian Hunter Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/arch/x86/util/intel-pt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c index 20df442fdf36..be07d6886256 100644 --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c @@ -1173,9 +1173,12 @@ static int intel_pt_read_finish(struct auxtrace_record *itr, int idx) struct evsel *evsel; evlist__for_each_entry(ptr->evlist, evsel) { - if (evsel->core.attr.type == ptr->intel_pt_pmu->type) + if (evsel->core.attr.type == ptr->intel_pt_pmu->type) { + if (evsel->disabled) + return 0; return perf_evlist__enable_event_idx(ptr->evlist, evsel, idx); + } } return -EINVAL; } -- 2.21.1