All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Roger Quadros <rogerq@ti.com>,
	khilman@deeprootsystems.com, linux-omap@vger.kernel.org,
	jean.pihet@newoldbits.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] perf: Use raw_smp_processor_id insted of smp_processor_id
Date: Wed, 12 Sep 2012 11:44:29 -0700	[thread overview]
Message-ID: <5050D80D.90002@codeaurora.org> (raw)
In-Reply-To: <20120912120511.GD28448@n2100.arm.linux.org.uk>

On 09/12/12 05:05, Russell King - ARM Linux wrote:
> NAK.  Using a different function which doesn't have the warning isn't a
> subsitute for fixing the problem properly.  What you're doing is papering
> over the bug, making the warning go away without properly understanding
> the problem.
>
> The warning is there because something is being done wrong.  What that is
> is exactly what is being said in the warning message.  You're getting a
> CPU number in a context where preemptions can occur - and therefore the
> CPU that you're running on can change.
>
> Think about this sequence:
>
> 	- cpu = smp_processor_id(); /* returns 0 */
> 	- you are preempted
> 	- you resume on CPU 1
> 	- trace_clock_disable(clk->name, 0, 0);
>
> If trace_clock_disable() uses the CPU number to access per-CPU data
> without locking, that's going to cause corruption.
>
> Please, if you're going to fix a warning, analyse it properly first and
> don't just search for a function which appears to give you the same
> functionality but without the warning message.

Is anyone actually using the CPU field in this tracepoint? I don't see
any usecase for it except for the case where you have a percpu clock,
but even then I imagine the name of the clock would be different
depending on which CPU it corresponds to. So why can't we just remove
the CPU field from the tracepoint?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] perf: Use raw_smp_processor_id insted of smp_processor_id
Date: Wed, 12 Sep 2012 11:44:29 -0700	[thread overview]
Message-ID: <5050D80D.90002@codeaurora.org> (raw)
In-Reply-To: <20120912120511.GD28448@n2100.arm.linux.org.uk>

On 09/12/12 05:05, Russell King - ARM Linux wrote:
> NAK.  Using a different function which doesn't have the warning isn't a
> subsitute for fixing the problem properly.  What you're doing is papering
> over the bug, making the warning go away without properly understanding
> the problem.
>
> The warning is there because something is being done wrong.  What that is
> is exactly what is being said in the warning message.  You're getting a
> CPU number in a context where preemptions can occur - and therefore the
> CPU that you're running on can change.
>
> Think about this sequence:
>
> 	- cpu = smp_processor_id(); /* returns 0 */
> 	- you are preempted
> 	- you resume on CPU 1
> 	- trace_clock_disable(clk->name, 0, 0);
>
> If trace_clock_disable() uses the CPU number to access per-CPU data
> without locking, that's going to cause corruption.
>
> Please, if you're going to fix a warning, analyse it properly first and
> don't just search for a function which appears to give you the same
> functionality but without the warning message.

Is anyone actually using the CPU field in this tracepoint? I don't see
any usecase for it except for the case where you have a percpu clock,
but even then I imagine the name of the clock would be different
depending on which CPU it corresponds to. So why can't we just remove
the CPU field from the tracepoint?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2012-09-12 18:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 11:50 [PATCH] perf: Use raw_smp_processor_id insted of smp_processor_id Roger Quadros
2012-09-12 11:50 ` Roger Quadros
2012-09-12 12:05 ` Russell King - ARM Linux
2012-09-12 12:05   ` Russell King - ARM Linux
2012-09-12 18:44   ` Stephen Boyd [this message]
2012-09-12 18:44     ` Stephen Boyd
2012-09-12 20:52     ` Russell King - ARM Linux
2012-09-12 20:52       ` Russell King - ARM Linux

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=5050D80D.90002@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=jean.pihet@newoldbits.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rogerq@ti.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.