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=ham 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 D46E5C18E5B for ; Tue, 10 Mar 2020 12:52:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB5222469D for ; Tue, 10 Mar 2020 12:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583844722; bh=EHNki9bHxweFzOgJkJJEZ+SL42Ct+SmSQmOaBVzZRsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lnX5c0+LP7e/AXHh27GoE96RYM0cY6mf21ScFsm66kfLrh5ZLl4+96DYpUttFzRkr w7ItMDLZCvjP8Zm3BzWZ7CdVbJ9O9oozrWd0CaSmOgT1iL61w9VfC4KbiuPLVcobnD D21y5fOZr2bSgZmxeJsyu1yivhNfpGrZwrhBClms= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727692AbgCJMwB (ORCPT ); Tue, 10 Mar 2020 08:52:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:57418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728997AbgCJMwA (ORCPT ); Tue, 10 Mar 2020 08:52:00 -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 BD3D82253D; Tue, 10 Mar 2020 12:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583844720; bh=EHNki9bHxweFzOgJkJJEZ+SL42Ct+SmSQmOaBVzZRsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K15GwxkAFwJzHdSPEeMuhE8kiZ45IUHw/Tou3WLHMVTKkmiPSgKGyVu27a0ts4plJ yAJQb7Sy4ftbY6T6PAWT4N9zpAEykpie595k6dpatXdFiYRXltOquIQ8fTJbVUAxIK 8DqdG1By4UzSyT3gM4pnjkQfbp0G4j8ptcq46pgs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Li , Leo Yan , Mathieu Poirier , Jiri Olsa , Tan Xiaojun , Adrian Hunter , Arnaldo Carvalho de Melo Subject: [PATCH 5.4 094/168] perf cs-etm: Fix endless record after being terminated Date: Tue, 10 Mar 2020 13:39:00 +0100 Message-Id: <20200310123644.831751726@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200310123635.322799692@linuxfoundation.org> References: <20200310123635.322799692@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 c9f2833cb472cf9e0a49b7bcdc210a96017a7bfd 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 cs_etm 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 coresight feature, but the code seems buggy same as arm-spe and intel-pt. Tester notes: Thanks for looping, Adrian. Applied this patch and tested with CoreSight on juno board, it works well. Signed-off-by: Wei Li Reviewed-by: Leo Yan Reviewed-by: Mathieu Poirier Tested-by: Leo Yan Cc: Jiri Olsa Cc: Tan Xiaojun Cc: stable@vger.kernel.org # 5.4+ Link: http://lore.kernel.org/lkml/20200214132654.20395-4-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/arm/util/cs-etm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -865,9 +865,12 @@ static int cs_etm_read_finish(struct aux struct evsel *evsel; evlist__for_each_entry(ptr->evlist, evsel) { - if (evsel->core.attr.type == ptr->cs_etm_pmu->type) + if (evsel->core.attr.type == ptr->cs_etm_pmu->type) { + if (evsel->disabled) + return 0; return perf_evlist__enable_event_idx(ptr->evlist, evsel, idx); + } } return -EINVAL;