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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 4199CC10F27 for ; Tue, 10 Mar 2020 13:23:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B50D208E4 for ; Tue, 10 Mar 2020 13:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583846585; bh=wyGZuRpQThjIeC5dCFh5Qub6KWBqNbpp6Vkc1Mf7Y5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=P/rDEbxIW9WUAwn9ran5l4DRPxOjOHjQT8h/xqIhFtgN5Jvj6YC2qYMuLI9e7Ro2a krDmody5eo0WGVk7AiHazWFsP+hmIHbBFTFA/DwO2K0QVfFOiv2L3KO0Cp4BT6ant3 tXPpojEk3sraY93z7VEX7ZbR1WVSyQHirtlhMSUs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729758AbgCJNAF (ORCPT ); Tue, 10 Mar 2020 09:00:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:40732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728205AbgCJNAE (ORCPT ); Tue, 10 Mar 2020 09:00:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D40182468C; Tue, 10 Mar 2020 13:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583845204; bh=wyGZuRpQThjIeC5dCFh5Qub6KWBqNbpp6Vkc1Mf7Y5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IX51OGWDx+XJRBGYprr5ogAjcgSkQ7yyAXflzZFont5xkQR4bc2MiQy5mmuKq8fdi BMvRRcL0Hx4CsnQbnm5C/OGzP0azxMG3OUId4I2ml4KxFvEEujMbJNf7dMr8omHUjB ndchN+M17rueH7jNgFS+RfFGBSC9LZzxoeJuVUdQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Li , Jiri Olsa , Tan Xiaojun , Adrian Hunter , Arnaldo Carvalho de Melo Subject: [PATCH 5.5 099/189] perf intel-pt: Fix endless record after being terminated Date: Tue, 10 Mar 2020 13:38:56 +0100 Message-Id: <20200310123649.711667900@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200310123639.608886314@linuxfoundation.org> References: <20200310123639.608886314@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wei Li commit 2da4dd3d6973ffdfba4fa07f53240fda7ab22929 upstream. 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 Signed-off-by: Greg Kroah-Hartman --- tools/perf/arch/x86/util/intel-pt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- 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 a 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; }