All of lore.kernel.org
 help / color / mirror / Atom feed
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, mike.leach@linaro.org,
	robert.walker@arm.com, coresight@lists.linaro.org
Subject: Re: [PATCH v3 02/13] coresight: etb10: Fix handling of perf mode
Date: Tue, 31 Jul 2018 11:07:31 -0600	[thread overview]
Message-ID: <20180731170731.GA11692@xps15> (raw)
In-Reply-To: <1532609691-16863-3-git-send-email-suzuki.poulose@arm.com>

Hello,

On Thu, Jul 26, 2018 at 01:54:40PM +0100, Suzuki K Poulose wrote:
> If the ETB is already enabled in sysfs mode, the ETB reports
> success even if a perf mode is requested. Fix this by checking
> the requested mode.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-etb10.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
> index 306119e..e5808fd 100644
> --- a/drivers/hwtracing/coresight/coresight-etb10.c
> +++ b/drivers/hwtracing/coresight/coresight-etb10.c
> @@ -148,8 +148,12 @@ static int etb_enable(struct coresight_device *csdev, u32 mode)
>  		return -EBUSY;
>  
>  	/* Nothing to do, the tracer is already enabled. */
> -	if (val == CS_MODE_SYSFS)
> -		goto out;
> +	if (val == CS_MODE_SYSFS) {
> +		if (mode == CS_MODE_SYSFS)
> +			goto out;
> +		else
> +			return -EBUSY;
> +	}

How about:

        if (val == CS_MODE_PERF)
                return -EBUSY;
 
+       /* Don't let perf disturb sysFS sessions */
+       if (val == CS_MODE_SYSFS && mode = CS_MODE_PERF)
+               return -EBUSY;
+
        /* Nothing to do, the tracer is already enabled. */
        if (val == CS_MODE_SYSFS)
                goto out;


I just find it more readable that way.

Thanks,
Mathieu

>  
>  	spin_lock_irqsave(&drvdata->spinlock, flags);
>  	etb_enable_hw(drvdata);
> -- 
> 2.7.4
> 

WARNING: multiple messages have this Message-ID (diff)
From: mathieu.poirier@linaro.org (Mathieu Poirier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 02/13] coresight: etb10: Fix handling of perf mode
Date: Tue, 31 Jul 2018 11:07:31 -0600	[thread overview]
Message-ID: <20180731170731.GA11692@xps15> (raw)
In-Reply-To: <1532609691-16863-3-git-send-email-suzuki.poulose@arm.com>

Hello,

On Thu, Jul 26, 2018 at 01:54:40PM +0100, Suzuki K Poulose wrote:
> If the ETB is already enabled in sysfs mode, the ETB reports
> success even if a perf mode is requested. Fix this by checking
> the requested mode.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-etb10.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
> index 306119e..e5808fd 100644
> --- a/drivers/hwtracing/coresight/coresight-etb10.c
> +++ b/drivers/hwtracing/coresight/coresight-etb10.c
> @@ -148,8 +148,12 @@ static int etb_enable(struct coresight_device *csdev, u32 mode)
>  		return -EBUSY;
>  
>  	/* Nothing to do, the tracer is already enabled. */
> -	if (val == CS_MODE_SYSFS)
> -		goto out;
> +	if (val == CS_MODE_SYSFS) {
> +		if (mode == CS_MODE_SYSFS)
> +			goto out;
> +		else
> +			return -EBUSY;
> +	}

How about:

        if (val == CS_MODE_PERF)
                return -EBUSY;
 
+       /* Don't let perf disturb sysFS sessions */
+       if (val == CS_MODE_SYSFS && mode = CS_MODE_PERF)
+               return -EBUSY;
+
        /* Nothing to do, the tracer is already enabled. */
        if (val == CS_MODE_SYSFS)
                goto out;


I just find it more readable that way.

Thanks,
Mathieu

>  
>  	spin_lock_irqsave(&drvdata->spinlock, flags);
>  	etb_enable_hw(drvdata);
> -- 
> 2.7.4
> 

  reply	other threads:[~2018-07-31 17:07 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-26 12:54 [PATCH v3 00/13] coresight: perf: Support for TMC ETR backend Suzuki K Poulose
2018-07-26 12:54 ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 01/13] coresight: Fix handling of sinks Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 02/13] coresight: etb10: Fix handling of perf mode Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-31 17:07   ` Mathieu Poirier [this message]
2018-07-31 17:07     ` Mathieu Poirier
2018-07-31 21:32     ` Suzuki K Poulose
2018-07-31 21:32       ` Suzuki K Poulose
2018-08-01 19:23       ` Mathieu Poirier
2018-08-01 19:23         ` Mathieu Poirier
2018-07-26 12:54 ` [PATCH v3 03/13] coresight: perf: Fix per cpu path management Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 04/13] coresight: perf: Avoid unncessary CPU hotplug read lock Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 05/13] coresight: perf: Allow tracing on hotplugged CPUs Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-31 17:46   ` Mathieu Poirier
2018-07-31 17:46     ` Mathieu Poirier
2018-07-31 23:08     ` Suzuki K Poulose
2018-07-31 23:08       ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 06/13] coresight: perf: Disable trace path upon source error Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 07/13] coresight: tmc-etr: Handle driver mode specific ETR buffers Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 08/13] coresight: tmc-etr: Relax collection of trace from sysfs mode Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 09/13] coresight: Convert driver messages to dev_dbg Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 10/13] coresight: perf: Remove reset_buffer call back for sinks Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 11/13] coresight: perf: Add helper to retrieve sink configuration Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 12/13] coresight: perf: Remove set_buffer call back Suzuki K Poulose
2018-07-26 12:54   ` Suzuki K Poulose
2018-07-26 12:54 ` [PATCH v3 13/13] coresight: etm-perf: Add support for ETR backend Suzuki K Poulose
2018-07-26 12:54   ` 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=20180731170731.GA11692@xps15 \
    --to=mathieu.poirier@linaro.org \
    --cc=coresight@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@linaro.org \
    --cc=robert.walker@arm.com \
    --cc=suzuki.poulose@arm.com \
    /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.