Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3962906pxb; Tue, 10 Nov 2020 04:50:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFsaH89bDBPB+ygAUhgWgNaGhBFPYAbZZ3YANbaUoYzQDOLn2BSh2fMAyjWKngIvqLxhuy X-Received: by 2002:a17:906:50f:: with SMTP id j15mr19117286eja.198.1605012640841; Tue, 10 Nov 2020 04:50:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605012640; cv=none; d=google.com; s=arc-20160816; b=V05hPxYQAa01StzptWYBdNnJ4nLDY7bcp1OHsPmtsbYK43jdbJOsRWowd+dRy7l7Ac t5Ly+lIZmUidwfbWyFcheQ9jkrC4IalKGbpOQgFTUZFAB06Mvb4yVgV2eBO6d5syLfdW QRMhbwpdoL0XL3RAOCESB58lT3t/C86i68+a3IVokgtOYU2QOnI6Vr/bGZ9c/6vMn3q7 nMnI48PkMpRonCGPMFcd+5UdWroHzXKjmuG2ID7Ggslme9m2QGSIrFix4+egjf5wBqbr MBS1mULpGWwd/njFHKPImZIYK1S8xoMKyL5PXWceYrJqQcE/WgPyz28vom2ACzNTq2KI Y3Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=xEZMnYlRpJd2ClIGwH+I0fcrdMyPE24N7qbxfnzmamE=; b=Dby9OyLeXDd3kF7XC74udkQ5fG0uSsmuHTgUJjxE/bkZVBX/ondb3eASGIpVQXCUYi 21AOI9EB27YK/Bdm5khDpdJRonHfiSrIQRjFJboxnGL7DBoZcFVudB4tV00vj2PTQAQb mpJUX1IWcf7U8fGxoS1Od2NBXVaVIovtXUArbroncCOA3jGpSWWP9Yb9pnLMnyzZWI82 uuCXNPoO+SjyLbLLxmwXjjBqxsOuwiFLqvOWzT0d4U2lptCdjTV+Vrn9KKeGU7f4Tu8w qhw2V/ShqGLUsW4pw5rYRYxSuT5BRrHTicjcNT7nug63JMtceylNXSBYYcCVa10zwAwo BouA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si9376526ede.131.2020.11.10.04.50.17; Tue, 10 Nov 2020 04:50:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730375AbgKJMqX (ORCPT + 99 others); Tue, 10 Nov 2020 07:46:23 -0500 Received: from foss.arm.com ([217.140.110.172]:55172 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732388AbgKJMqS (ORCPT ); Tue, 10 Nov 2020 07:46:18 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 34A58139F; Tue, 10 Nov 2020 04:46:18 -0800 (PST) Received: from p8cg001049571a15.blr.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E09DC3F6CF; Tue, 10 Nov 2020 04:46:15 -0800 (PST) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org Cc: linux-kernel@vger.kernel.org, suzuki.poulose@arm.com, mathieu.poirier@linaro.org, mike.leach@linaro.org, Anshuman Khandual Subject: [RFC 09/11] coresight: etm-perf: Disable the path before capturing the trace data Date: Tue, 10 Nov 2020 18:15:07 +0530 Message-Id: <1605012309-24812-10-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1605012309-24812-1-git-send-email-anshuman.khandual@arm.com> References: <1605012309-24812-1-git-send-email-anshuman.khandual@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org perf handle structure needs to be shared with the TRBE IRQ handler for capturing trace data and restarting the handle. There is a probability of an undefined reference based crash when etm event is being stopped while a TRBE IRQ also getting processed. This happens due the release of perf handle via perf_aux_output_end(). This stops the sinks via the link before releasing the handle, which will ensure that a simultaneous TRBE IRQ could not happen. Signed-off-by: Anshuman Khandual --- This might cause problem with traditional sink devices which can be operated in both sysfs and perf mode. This needs to be addressed correctly. One option would be to move the update_buffer callback into the respective sink devices. e.g, disable(). drivers/hwtracing/coresight/coresight-etm-perf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 534e205..1a37991 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -429,7 +429,9 @@ static void etm_event_stop(struct perf_event *event, int mode) size = sink_ops(sink)->update_buffer(sink, handle, event_data->snk_config); + coresight_disable_path(path); perf_aux_output_end(handle, size); + return; } /* Disabling the path make its elements available to other sessions */ -- 2.7.4