Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17161132ybl; Wed, 1 Jan 2020 23:29:41 -0800 (PST) X-Google-Smtp-Source: APXvYqzEr11wRfwtQ8ApiUUKsqMA0y3hf38W0ThJc0l8zlG2ODmHo+ffQ3ygHZB9l33roSRUqBSa X-Received: by 2002:a05:6830:1755:: with SMTP id 21mr91509439otz.323.1577950181562; Wed, 01 Jan 2020 23:29:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577950181; cv=none; d=google.com; s=arc-20160816; b=nm6W2flCpRNoNb4Py5WYchz44xjuTp2Vmu+ALju3OPz/kCsly1MDxMP0WcY2oXg8Yo XKkzFsiKJ0jzWCDSVyb0oW+lMNYLsFpmegU5vSxuw3v0BOQFxBczGfYNWn+QJT/CzelZ P8uYLifBsMY+6iHV1StvoRuAZpyjcsU27jAuYc3QlWRwEaq9TR1b7+pTXQnCNBO6Hb6n f+epXmQIU5forEeHEf5verNFZ4+cmsPgNu4LktLYiakeBbXqZIa7irAsF03TB2XH66MI ozR4UkOwBlBhizqDOA/dgzb3JaE3yPKZ3b/X3HPEELzJdiwsRVuyPsfZ2x/Uh2CcHwB0 VJvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=Hm8jY/S92eelbdy4fOsuE7Lx/AKUWvlUAw9Ny36nFdA=; b=SzuxVsIz2tBuOpliSp35PnmfKlJfsmHCHNPtH2jrlmSs8s8n8zG/CrCwKzWTFy3whE PBs4r1WMpJkN+nFrhQZWWcb+2BNlRrGHCj9n0vkXSfsYS3I5CU9FbrNtQ0m/MesppvpO aDgcDxphVBpql+Mlr8azf66vdefJKc6m7k+nIXtxSa2H4CBNqBytr3N1J95iQev6CDAH 8mwSs4In8DSwg4NsTjMFhOKN56o1hnZpdWTMFwpj7uOg857agPHF3S0svA6vjZrNAKpa c3IDZqeAJUrDhXk7sYLeH4ZMuP2DQKMMA1aYFjZKnSLzYz+P9nbBykmblU5HUksvuB89 WmIw== 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 l2si23636269oti.303.2020.01.01.23.29.29; Wed, 01 Jan 2020 23:29:41 -0800 (PST) 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 S1727728AbgABH1m (ORCPT + 99 others); Thu, 2 Jan 2020 02:27:42 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:55046 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726078AbgABH1m (ORCPT ); Thu, 2 Jan 2020 02:27:42 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 19F7B8116B95471491C1; Thu, 2 Jan 2020 15:27:40 +0800 (CST) Received: from euler.huawei.com (10.175.104.193) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Thu, 2 Jan 2020 15:27:29 +0800 From: Wei Li To: , , , , , CC: , , , Subject: [RFC PATCH] perf tools: intel-bts: fix endless record after being terminated Date: Thu, 2 Jan 2020 15:42:24 +0800 Message-ID: <20200102074224.25189-1-liwei391@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.104.193] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- tools/perf/arch/x86/util/intel-bts.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c index 27d9e214d068..d524ba802a2e 100644 --- a/tools/perf/arch/x86/util/intel-bts.c +++ b/tools/perf/arch/x86/util/intel-bts.c @@ -420,9 +420,13 @@ 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) - return perf_evlist__enable_event_idx(btsr->evlist, - evsel, idx); + if (evsel->core.attr.type == btsr->intel_bts_pmu->type) { + if (evsel->disabled) + return 0; + else + return perf_evlist__enable_event_idx( + btsr->evlist, evsel, idx); + } } return -EINVAL; } -- 2.17.1