Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17159804ybl; Wed, 1 Jan 2020 23:27:39 -0800 (PST) X-Google-Smtp-Source: APXvYqzKAo5ubovMxL4SZtedY7HGwX+ZMJtYoW6o4E9UEwH54oN7RqSWFr8r4QY5QM9thn5hXNfw X-Received: by 2002:a9d:7851:: with SMTP id c17mr70135456otm.58.1577950059380; Wed, 01 Jan 2020 23:27:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577950059; cv=none; d=google.com; s=arc-20160816; b=xI1CDfIVcgwbW9c+eeHbXBPDIk7Jm16ss1ikFY88qySkBpsotJZ5Jem4B1vRNSOKYW 2N4ZowRhXUaa0ijaMnd+89GtVtwqiG3/APiyT+2SQ6AnyQfpTSiarIq9MJWooWE0yMyf R5Kh6nZg0qYGifgw//hCEGs+trCdczErvmPd5aivtuf8mrijHLI0ZdP4T+5/02XQmBLb 3tZncjQL1J9cpeB0PQu4/izUefn0XusL9wUv82eWKef9DKwbMzDz//cfUEc1uXVq0lgQ A14iwbdeI7D0SmbAdb0p5K4fHu2ZDK3dijzTZjsvh/Ybmg+oX4B1f452RUa+Qssny5LN bJXQ== 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=BJAlIiH/y12KFdsvq9EW6iXXyvvHu5+ahcIQENsEPmc=; b=dJFCcYIRhKQxK3/0T2LwkSP959c6Q7JKGi4Xm7IFytk8Q873iy/9RZ0ayO+LjAI9Xt EvSwUz49OotoItDhSJbICEL03k8aY53t3FVg30FOtJJ0Qsq5gZ1/QlrS56r2Udnc9jhH y/P9IMXI0MfCPgG2mj9yc9w8cWG83T01lnYn/gp1xTZZZ8nY35sM3mMJ10amtKuxi7lg eP8KX0uftX0AFlU1rLZnfo/fuM9IrzLFUYGMWeP6tk3JiiNc9Y7fYAgxwIXrpyVDywE1 j0IqOlR3XCS/VGlnu4s62Qc5nZTqTF1noXfDWGhXWZV+QsiqJ219tTyrwX7KA6ZNh11p vQnQ== 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 k7si27257376otp.22.2020.01.01.23.27.27; Wed, 01 Jan 2020 23:27:39 -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 S1726295AbgABH0r (ORCPT + 99 others); Thu, 2 Jan 2020 02:26:47 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:48658 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726078AbgABH0r (ORCPT ); Thu, 2 Jan 2020 02:26:47 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 5C13057D9FC402064E4E; Thu, 2 Jan 2020 15:26:44 +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:26:35 +0800 From: Wei Li To: , , , , , , , CC: , , , , Subject: [PATCH] perf tools: arm-spe: fix endless record after being terminated Date: Thu, 2 Jan 2020 15:40:34 +0800 Message-ID: <20200102074034.38650-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 arm_spe event is disabled, we don't enable it again here. Before the patch: [root@localhost ~]# ./perf record -e arm_spe_0/ts_enable=1,pct_enable=1,\ pa_enable=1,load_filter=1,jitter=1,store_filter=1,min_latency=0/ -p 5387 ^C^C^C^C^C^C After the patch: [root@localhost ~]# ./perf record -e arm_spe_0/ts_enable=1,pct_enable=1,\ pa_enable=1,load_filter=1,jitter=1,store_filter=1,min_latency=0/ -p 5387 ^C[ perf record: Woken up 0 times to write data ] Warning: AUX data lost 255 times out of 789! [ perf record: Captured and wrote 1020.719 MB perf.data ] Signed-off-by: Wei Li --- tools/perf/arch/arm64/util/arm-spe.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index eba6541ec0f1..d1ff278a8ab2 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -165,9 +165,13 @@ static int arm_spe_read_finish(struct auxtrace_record *itr, int idx) struct evsel *evsel; evlist__for_each_entry(sper->evlist, evsel) { - if (evsel->core.attr.type == sper->arm_spe_pmu->type) - return perf_evlist__enable_event_idx(sper->evlist, - evsel, idx); + if (evsel->core.attr.type == sper->arm_spe_pmu->type) { + if (evsel->disabled) + return 0; + else + return perf_evlist__enable_event_idx( + sper->evlist, evsel, idx); + } } return -EINVAL; } -- 2.17.1