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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42F2FC4332F for ; Wed, 13 Dec 2023 13:57:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379496AbjLMN5C (ORCPT ); Wed, 13 Dec 2023 08:57:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235517AbjLMN4n (ORCPT ); Wed, 13 Dec 2023 08:56:43 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CC1D73AB5 for ; Wed, 13 Dec 2023 05:55:24 -0800 (PST) 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 D486BC15; Wed, 13 Dec 2023 05:55:17 -0800 (PST) Received: from [192.168.1.3] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A66F73F738; Wed, 13 Dec 2023 05:54:30 -0800 (PST) Message-ID: <3c7665ff-b2e2-f10d-a78a-4ddc1791926f@arm.com> Date: Wed, 13 Dec 2023 13:54:26 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH 1/8] coresight: Fix issue where a source device's helpers aren't disabled Content-Language: en-US To: Suzuki K Poulose , coresight@lists.linaro.org Cc: Mike Leach , Alexander Shishkin , Maxime Coquelin , Alexandre Torgue , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com References: <20231212155407.1429121-1-james.clark@arm.com> <20231212155407.1429121-2-james.clark@arm.com> From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/12/2023 17:44, Suzuki K Poulose wrote: > Hi James > > On 12/12/2023 15:53, James Clark wrote: >> The linked commit reverts the change that accidentally used some sysfs >> enable/disable functions from Perf which broke the refcounting, but it >> also removes the fact that the sysfs disable function disabled the >> helpers. > > >> >> Add a new wrapper function that does both which is used by both Perf and >> sysfs, and label the sysfs disable function appropriately. The naming of >> all of the functions will be tidied up later to avoid this happening >> again. >> >> Fixes: 287e82cf69aa ("coresight: Fix crash when Perf and sysfs modes >> are used concurrently") > > But we still don't "enable" the helpers from perf mode with this patch. > i.e., we use source_ops()->enable directly. So, I guess this patch > doesn't fix a bug as such. But that said, it would be good to > enable/disable helpers for sources, in perf mode. > > Suzuki We do, it happens in coresight_enable_path() which Perf uses. I added the comment below about that. [...] >>   +/* >> + * Helper function to call source_ops(csdev)->disable and also >> disable the >> + * helpers. >> + * >> + * There is an imbalance between coresight_enable_path() and >> + * coresight_disable_path(). Enabling also enables the source's >> helpers as part >> + * of the path, but disabling always skips the first item in the path >> (which is >> + * the source), so sources and their helpers don't get disabled as >> part of that >> + * function and we need the extra step here. >> + */ The reason coresight_disable_path() skips the first item is because it's used after errors where a path is only partially enabled and it unwinds, skipping the last item, because the last item didn't enable. It seemed a bit more intrusive to change that, and it's already working.