[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<LV8PR18MB591464D32C0E48F42071EBEBCEF92@LV8PR18MB5914.namprd18.prod.outlook.com>
Date: Wed, 5 Jun 2024 04:46:05 +0000
From: Linu Cherian <lcherian@...vell.com>
To: James Clark <james.clark@....com>
CC: "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"coresight@...ts.linaro.org"
<coresight@...ts.linaro.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"krzysztof.kozlowski+dt@...aro.org" <krzysztof.kozlowski+dt@...aro.org>,
"conor+dt@...nel.org" <conor+dt@...nel.org>,
"devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>,
Sunil Kovvuri Goutham <sgoutham@...vell.com>,
George Cherian <gcherian@...vell.com>,
Anil Kumar Reddy H
<areddy3@...vell.com>,
Tanmay Jagdale <tanmay@...vell.com>,
"suzuki.poulose@....com" <suzuki.poulose@....com>,
"mike.leach@...aro.org"
<mike.leach@...aro.org>
Subject: RE: [EXTERNAL] Re: [PATCH v8 5/7] coresight: tmc: Add support for
reading crash data
Hi James,
> -----Original Message-----
> From: James Clark <james.clark@....com>
> Sent: Friday, May 31, 2024 3:33 PM
> To: Linu Cherian <lcherian@...vell.com>
> Cc: linux-arm-kernel@...ts.infradead.org; coresight@...ts.linaro.org; linux-
> kernel@...r.kernel.org; robh+dt@...nel.org;
> krzysztof.kozlowski+dt@...aro.org; conor+dt@...nel.org;
> devicetree@...r.kernel.org; Sunil Kovvuri Goutham
> <sgoutham@...vell.com>; George Cherian <gcherian@...vell.com>; Anil
> Kumar Reddy H <areddy3@...vell.com>; Tanmay Jagdale
> <tanmay@...vell.com>; suzuki.poulose@....com; mike.leach@...aro.org
> Subject: [EXTERNAL] Re: [PATCH v8 5/7] coresight: tmc: Add support for
> reading crash data
>
> Prioritize security for external emails: Confirm sender and content safety
> before clicking links or opening attachments
>
> ----------------------------------------------------------------------
>
>
> On 31/05/2024 05:27, Linu Cherian wrote:
> > * Introduce a new mode CS_MODE_READ_CRASHDATA for reading trace
> > captured in previous crash/watchdog reset.
> >
> > * Add special device files for reading ETR/ETF crash data.
> >
> > * User can read the crash data as below
> >
> > For example, for reading crash data from tmc_etf sink
> >
> > #dd if=/dev/crash_tmc_etfXX of=~/cstrace.bin
> >
> > Signed-off-by: Anil Kumar Reddy <areddy3@...vell.com>
> > Signed-off-by: Tanmay Jagdale <tanmay@...vell.com>
> > Signed-off-by: Linu Cherian <lcherian@...vell.com>
> > ---
> > Changelog from v7:
> > * Moved crash dev registration into new function,
> > register_crash_dev_interface
> > * Removed redundant variable trace_addr in
> > tmc_etr_setup_crashdata_buf
> >
> > .../coresight/coresight-etm4x-core.c | 1 +
> > .../hwtracing/coresight/coresight-tmc-core.c | 148 ++++++++++++++++-
> > .../hwtracing/coresight/coresight-tmc-etf.c | 73 +++++++++
> > .../hwtracing/coresight/coresight-tmc-etr.c | 152 +++++++++++++++++-
> > drivers/hwtracing/coresight/coresight-tmc.h | 11 +-
> > include/linux/coresight.h | 13 ++
> > 6 files changed, 391 insertions(+), 7 deletions(-)
> >
>
> [...]
>
> > +static void register_crash_dev_interface(struct tmc_drvdata * drvdata,
> > + const char *name)
> > +{
> > + drvdata->crashdev.name =
> > + devm_kasprintf(&drvdata->csdev->dev, GFP_KERNEL,
> "%s_%s", "crash", name);
> > + drvdata->crashdev.minor = MISC_DYNAMIC_MINOR;
> > + drvdata->crashdev.fops = &tmc_crashdata_fops;
> > + if (misc_register(&drvdata->crashdev))
> > + dev_dbg(&drvdata->csdev->dev,
> > + "Failed to setup user interface for crashdata\n"); }
> > +
> > static int tmc_probe(struct amba_device *adev, const struct amba_id
> > *id) {
> > int ret = 0;
> > @@ -619,6 +752,10 @@ static int tmc_probe(struct amba_device *adev,
> const struct amba_id *id)
> > coresight_unregister(drvdata->csdev);
> > else
> > pm_runtime_put(&adev->dev);
> > +
> > + if (is_tmc_reserved_region_valid(dev))
> > + register_crash_dev_interface(drvdata, desc.name);
> > +
>
> Now that you've added an extra step to the probe you need to add a "goto
> out" when the previous step fails:
>
> if (ret) {
> coresight_unregister(drvdata->csdev);
> + goto out;
> }
>
> That seems to be the pattern in the rest of the function. Otherwise you
> might register the interface on no device.
>
> There's also a conflict here and in some other places. Since this has to go
> through the coresight branch you should base it off of coresight-next.
>
Ack.
> > out:
> > return ret;
> > }
> > @@ -630,7 +767,8 @@ static void tmc_shutdown(struct amba_device
> *adev)
> >
> > spin_lock_irqsave(&drvdata->spinlock, flags);
> >
> > - if (coresight_get_mode(drvdata->csdev) == CS_MODE_DISABLED)
> > + if ((coresight_get_mode(drvdata->csdev) == CS_MODE_DISABLED)
> ||
> > + (coresight_get_mode(drvdata->csdev) ==
> CS_MODE_READ_CRASHDATA))
> > goto out;
> >
> > if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) diff --git
> > a/drivers/hwtracing/coresight/coresight-tmc-etf.c
> > b/drivers/hwtracing/coresight/coresight-tmc-etf.c
> > index f9569585e9f8..655c0c0ba54b 100644
> > --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
> > +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
> > @@ -657,6 +657,56 @@ static int tmc_panic_sync_etf(struct
> coresight_device *csdev)
> > return 0;
> > }
> >
>
> [...]
>
> > @@ -725,6 +789,7 @@ int tmc_read_prepare_etb(struct tmc_drvdata
> *drvdata)
> > __tmc_etb_disable_hw(drvdata);
> > }
> >
> > +mode_valid:
> > drvdata->reading = true;
> > out:
> > spin_unlock_irqrestore(&drvdata->spinlock, flags); @@ -744,8
> +809,16
> > @@ int tmc_read_unprepare_etb(struct tmc_drvdata *drvdata)
> > drvdata->config_type != TMC_CONFIG_TYPE_ETF))
> > return -EINVAL;
> >
> > +
>
> Whitespace change. There are a couple of other minor checkpatch style
> warnings.
Ack.
>
> The rest looks good to me. All the tests are passing. I still think we should all
> the kself test for this mode, but that can be done later.
Sure. Will add kself tests for sysfs mode and send it as separate patches.
Powered by blists - more mailing lists