From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761533AbcINM0M (ORCPT ); Wed, 14 Sep 2016 08:26:12 -0400 Received: from foss.arm.com ([217.140.101.70]:39606 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168AbcINM0K (ORCPT ); Wed, 14 Sep 2016 08:26:10 -0400 Subject: Re: [PATCH] coresight: tmc: fix for trace collection bug in sysFS mode To: Venkatesh Vivekanandan References: <1473769245-18159-1-git-send-email-venkatesh.vivekanandan@broadcom.com> Cc: Mathieu Poirier , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" From: Suzuki K Poulose Message-ID: Date: Wed, 14 Sep 2016 13:26:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/09/16 12:30, Venkatesh Vivekanandan wrote: > > > On Wed, Sep 14, 2016 at 3:26 PM, Suzuki K Poulose > wrote: > > On 13/09/16 16:41, Mathieu Poirier wrote: > > On 13 September 2016 at 06:20, Venkatesh Vivekanandan > > wrote: > > tmc_etb_dump_hw is never called in sysFS mode to collect trace from > hardware, because drvdata->mode is set to CS_MODE_DISABLED at > tmc_disable_etf/etr_sink > > static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata) > { > . > . > if (local_read(&drvdata->mode) == CS_MODE_SYSFS) > tmc_etb_dump_hw(drvdata); > . > . > } > > static void tmc_disable_etf_sink(struct coresight_device *csdev) > { > . > . > val = local_xchg(&drvdata->mode, CS_MODE_DISABLED); > /* Disable the TMC only if it needs to */ > if (val != CS_MODE_DISABLED) > tmc_etb_disable_hw(drvdata); > > > You are correct. > > . > . > } > > I think we should : > > 1) First switch the drvdata->mode to a normal type from local_t. Using an > atomic type for mode is completely unnecessary and comes with the overhead > of barriers/synchronisation instructions, while all accesses, including read/write > are performed under the drvdata->spinlock. I have a patch already for this, which > I plan to send it soon. > > and > > 2) Do something like : > > void tmc_disable_etX_sink() > { > if (drvdata->mode != CS_MODE_DISABLED) { > tmc_etX_disable_hw(drvdata); > drvdata->mode = CS_MODE_DISABLED; > } > } > > You will fix this along with above changes? Yes. nit: Please fix your mail client. Do not use HTML formatted emails on mailing list Cheers Suzuki From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suzuki.Poulose@arm.com (Suzuki K Poulose) Date: Wed, 14 Sep 2016 13:26:07 +0100 Subject: [PATCH] coresight: tmc: fix for trace collection bug in sysFS mode In-Reply-To: References: <1473769245-18159-1-git-send-email-venkatesh.vivekanandan@broadcom.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 14/09/16 12:30, Venkatesh Vivekanandan wrote: > > > On Wed, Sep 14, 2016 at 3:26 PM, Suzuki K Poulose > wrote: > > On 13/09/16 16:41, Mathieu Poirier wrote: > > On 13 September 2016 at 06:20, Venkatesh Vivekanandan > > wrote: > > tmc_etb_dump_hw is never called in sysFS mode to collect trace from > hardware, because drvdata->mode is set to CS_MODE_DISABLED at > tmc_disable_etf/etr_sink > > static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata) > { > . > . > if (local_read(&drvdata->mode) == CS_MODE_SYSFS) > tmc_etb_dump_hw(drvdata); > . > . > } > > static void tmc_disable_etf_sink(struct coresight_device *csdev) > { > . > . > val = local_xchg(&drvdata->mode, CS_MODE_DISABLED); > /* Disable the TMC only if it needs to */ > if (val != CS_MODE_DISABLED) > tmc_etb_disable_hw(drvdata); > > > You are correct. > > . > . > } > > I think we should : > > 1) First switch the drvdata->mode to a normal type from local_t. Using an > atomic type for mode is completely unnecessary and comes with the overhead > of barriers/synchronisation instructions, while all accesses, including read/write > are performed under the drvdata->spinlock. I have a patch already for this, which > I plan to send it soon. > > and > > 2) Do something like : > > void tmc_disable_etX_sink() > { > if (drvdata->mode != CS_MODE_DISABLED) { > tmc_etX_disable_hw(drvdata); > drvdata->mode = CS_MODE_DISABLED; > } > } > > You will fix this along with above changes? Yes. nit: Please fix your mail client. Do not use HTML formatted emails on mailing list Cheers Suzuki