Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5329155rdb; Wed, 13 Dec 2023 05:57:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0Ki9EEkDFn2UOjxOcvicgwiJrBJkcGEhKgM2o2PSLSvARAwE5IoGnkmevj36F1qcuKqmu X-Received: by 2002:a17:90a:7e84:b0:286:6cc0:886b with SMTP id j4-20020a17090a7e8400b002866cc0886bmr3532425pjl.88.1702475838732; Wed, 13 Dec 2023 05:57:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702475838; cv=none; d=google.com; s=arc-20160816; b=TCnA7xk4mmKkiqtNluHu/11FNjZJSyYKGNOsjRIBIJdPojF9ynfHhYuI0l6tTg8HqD v62AavIs8XKYDZ6NvHlibynExDOLimkCiAcIT5/y4BWddG+DSL1B5r2N1n47CQPOIs56 Q6S5ClpdpcFGYV+JZh0FffZp5osD047Go0GLmkKDgDq6iMsG9n3mVTbOXeRZOi7fYeUR oaLCtaO8xxumgy/H5zpONl1je/nzR/E5IqD3V8oCz/nmYlzLztFpmG6bQe7+tNJA0sZY dG3Dk0JOWrOI6amH37ebgeUkIsoHjIF3O1PYpXbY4arnRDE9JMO6K0SGWg28MuBmn1Ru nbOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=OUwBBTeuzbHrcr6eWTGF2Pnv6kEmfdchDx0/QsMQ30I=; fh=Ta6s8fnpyEYRYHUSZY73Y8u8Y61SN8ZtFCHovVzIbMQ=; b=Q9CNY4W0FCgMF/hFuYCZBXAls9Fy6qAnBwxR/QtFx7XJuHtkvI4h/gnJiLPfG3i1At qyx7dWekPBNkouUy2k00G8aBHdN9xi8Ky9kGRpnGeU5fgduh7jlaqiTd2Jgqmf0W/sGw ltOilqvIRPzjvAaw4YR+BbiiQ3+kJSUFmL7qZyNPmyCaSr6ugOq4bsOQMkrncrfAN4eo 7wBA3kXQ8+DYX7+pbop3DvU800MW7ZhBmUj2pkhl4dCVMkFgOv0POFBdgT2/VIln3r8V JJ1nAUSeWQ0Agg7tvnY6Nahk6IXp3Bthuq1xup6Rl0pWJJdzKt5QuRSWKwDfojSb0Xn1 nbAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id y17-20020a17090aa41100b0028875adc38asi9624455pjp.171.2023.12.13.05.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 05:57:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id E763E8041391; Wed, 13 Dec 2023 05:57:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235525AbjLMN5B (ORCPT + 99 others); Wed, 13 Dec 2023 08:57:01 -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 X-Spam-Status: No, score=-1.5 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 13 Dec 2023 05:57:15 -0800 (PST) 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.