All of lore.kernel.org
 help / color / mirror / Atom feed
From: mathieu.poirier@linaro.org (Mathieu Poirier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/13] coresight: etb10: Handle errors enabling the device
Date: Tue, 14 Aug 2018 11:40:36 -0600	[thread overview]
Message-ID: <20180814174035.GA13135@xps15> (raw)
In-Reply-To: <1533562915-21558-7-git-send-email-suzuki.poulose@arm.com>

Hi Suzuki,

On Mon, Aug 06, 2018 at 02:41:48PM +0100, Suzuki K Poulose wrote:
> Prepare the etb10 driver to return errors in enabling
> the device.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-etb10.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
> index 9fd77fd..37d2c88 100644
> --- a/drivers/hwtracing/coresight/coresight-etb10.c
> +++ b/drivers/hwtracing/coresight/coresight-etb10.c
> @@ -107,7 +107,7 @@ static unsigned int etb_get_buffer_depth(struct etb_drvdata *drvdata)
>  	return depth;
>  }
>  
> -static void etb_enable_hw(struct etb_drvdata *drvdata)
> +static void __etb_enable_hw(struct etb_drvdata *drvdata)
>  {
>  	int i;
>  	u32 depth;
> @@ -135,6 +135,12 @@ static void etb_enable_hw(struct etb_drvdata *drvdata)
>  	CS_LOCK(drvdata->base);
>  }
>  
> +static int etb_enable_hw(struct etb_drvdata *drvdata)
> +{
> +	__etb_enable_hw(drvdata);
> +	return 0;
> +}
> +
>  static int etb_enable(struct coresight_device *csdev, u32 mode, void *data)
>  {
>  	int ret = 0;
> @@ -150,7 +156,7 @@ static int etb_enable(struct coresight_device *csdev, u32 mode, void *data)
>  	if (mode == CS_MODE_PERF) {
>  		ret = etb_set_buffer(csdev, (struct perf_output_handle *)data);
>  		if (ret)
> -			goto out;
> +			return ret;
>  	}
>  
>  	val = local_cmpxchg(&drvdata->mode,
> @@ -172,12 +178,14 @@ static int etb_enable(struct coresight_device *csdev, u32 mode, void *data)
>  		goto out;
>  
>  	spin_lock_irqsave(&drvdata->spinlock, flags);
> -	etb_enable_hw(drvdata);
> +	ret = etb_enable_hw(drvdata);
>  	spin_unlock_irqrestore(&drvdata->spinlock, flags);
>  
> -out:
> -	if (!ret)
> +	if (ret)
> +		local_cmpxchg(&drvdata->mode, mode, CS_MODE_DISABLED);
> +	else

I also have to do hackish things with my work on
CPU-wide trace scenarios because drvdata->mode is of type local_t.  Instead of
living with it I'll send out a patch later today that moves it to a u32 like ETF
and ETR.

Please look at it and if you're happy, add it to this patchset and do your 
modifications on top of it.

Thanks,
Mathieu

>  		dev_dbg(drvdata->dev, "ETB enabled\n");
> +
>  	return ret;
>  }
>  
> -- 
> 2.7.4
> 

WARNING: multiple messages have this Message-ID (diff)
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, robert.walker@arm.com,
	mike.leach@arm.com
Subject: Re: [PATCH 06/13] coresight: etb10: Handle errors enabling the device
Date: Tue, 14 Aug 2018 11:40:36 -0600	[thread overview]
Message-ID: <20180814174035.GA13135@xps15> (raw)
In-Reply-To: <1533562915-21558-7-git-send-email-suzuki.poulose@arm.com>

Hi Suzuki,

On Mon, Aug 06, 2018 at 02:41:48PM +0100, Suzuki K Poulose wrote:
> Prepare the etb10 driver to return errors in enabling
> the device.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-etb10.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
> index 9fd77fd..37d2c88 100644
> --- a/drivers/hwtracing/coresight/coresight-etb10.c
> +++ b/drivers/hwtracing/coresight/coresight-etb10.c
> @@ -107,7 +107,7 @@ static unsigned int etb_get_buffer_depth(struct etb_drvdata *drvdata)
>  	return depth;
>  }
>  
> -static void etb_enable_hw(struct etb_drvdata *drvdata)
> +static void __etb_enable_hw(struct etb_drvdata *drvdata)
>  {
>  	int i;
>  	u32 depth;
> @@ -135,6 +135,12 @@ static void etb_enable_hw(struct etb_drvdata *drvdata)
>  	CS_LOCK(drvdata->base);
>  }
>  
> +static int etb_enable_hw(struct etb_drvdata *drvdata)
> +{
> +	__etb_enable_hw(drvdata);
> +	return 0;
> +}
> +
>  static int etb_enable(struct coresight_device *csdev, u32 mode, void *data)
>  {
>  	int ret = 0;
> @@ -150,7 +156,7 @@ static int etb_enable(struct coresight_device *csdev, u32 mode, void *data)
>  	if (mode == CS_MODE_PERF) {
>  		ret = etb_set_buffer(csdev, (struct perf_output_handle *)data);
>  		if (ret)
> -			goto out;
> +			return ret;
>  	}
>  
>  	val = local_cmpxchg(&drvdata->mode,
> @@ -172,12 +178,14 @@ static int etb_enable(struct coresight_device *csdev, u32 mode, void *data)
>  		goto out;
>  
>  	spin_lock_irqsave(&drvdata->spinlock, flags);
> -	etb_enable_hw(drvdata);
> +	ret = etb_enable_hw(drvdata);
>  	spin_unlock_irqrestore(&drvdata->spinlock, flags);
>  
> -out:
> -	if (!ret)
> +	if (ret)
> +		local_cmpxchg(&drvdata->mode, mode, CS_MODE_DISABLED);
> +	else

I also have to do hackish things with my work on
CPU-wide trace scenarios because drvdata->mode is of type local_t.  Instead of
living with it I'll send out a patch later today that moves it to a u32 like ETF
and ETR.

Please look at it and if you're happy, add it to this patchset and do your 
modifications on top of it.

Thanks,
Mathieu

>  		dev_dbg(drvdata->dev, "ETB enabled\n");
> +
>  	return ret;
>  }
>  
> -- 
> 2.7.4
> 

  reply	other threads:[~2018-08-14 17:40 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 13:41 [PATCH 00/13] coresight: Implement device claim protocol Suzuki K Poulose
2018-08-06 13:41 ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 01/13] coresight: tmc-etr: Refactor for handling errors Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 02/13] coresight: tmc-etr: Handle errors enabling CATU Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 03/13] coresight: tmc-etb/etf: Prepare to handle errors enabling Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-15 19:22   ` Mathieu Poirier
2018-08-15 19:22     ` Mathieu Poirier
2018-08-16 14:47     ` Suzuki K Poulose
2018-08-16 14:47       ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 04/13] coresight: etm4x: Add support for handling errors Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 05/13] coresight: etm3: " Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-15 19:34   ` Mathieu Poirier
2018-08-15 19:34     ` Mathieu Poirier
2018-08-16 15:45     ` Suzuki K Poulose
2018-08-16 15:45       ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 06/13] coresight: etb10: Handle errors enabling the device Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-14 17:40   ` Mathieu Poirier [this message]
2018-08-14 17:40     ` Mathieu Poirier
2018-08-15 19:38   ` Mathieu Poirier
2018-08-15 19:38     ` Mathieu Poirier
2018-08-16 15:46     ` Suzuki K Poulose
2018-08-16 15:46       ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 07/13] coresight: dynamic-replicator: Handle multiple connections Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 08/13] coresight: Add support for CLAIM tag protocol Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-14 23:20   ` Mathieu Poirier
2018-08-14 23:20     ` Mathieu Poirier
2018-08-16 15:47     ` Suzuki K Poulose
2018-08-16 15:47       ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 09/13] coresight: etmx: Claim devices before use Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-14 23:43   ` Mathieu Poirier
2018-08-14 23:43     ` Mathieu Poirier
2018-08-06 13:41 ` [PATCH 10/13] coresight: funnel: " Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 11/13] coresight: catu: Claim device " Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 12/13] coresight: dynamic-replicator: Claim device for use Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 13/13] coreisght: tmc: Claim device before use Suzuki K Poulose
2018-08-06 13:41   ` Suzuki K Poulose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180814174035.GA13135@xps15 \
    --to=mathieu.poirier@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.