All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: Properly initialize reference count
@ 2013-10-31 12:02 Thierry Reding
  2013-10-31 19:09   ` Stephen Warren
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Thierry Reding @ 2013-10-31 12:02 UTC (permalink / raw)
  To: linux-arm-kernel

Commit a336ed7 (clk: Implement clk_unregister()) initializes the kref in
clk_set_parent(), which is obviously the wrong place. Further research
shows that the original patches initialized it correctly, so it probably
ended up in clk_set_parent() by mistake during manual application of the
patch.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/clk/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 6e3f485..b68a999 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1750,7 +1750,6 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
 	else
 		__clk_recalc_rates(clk, POST_RATE_CHANGE);
 
-	kref_init(&clk->ref);
 out:
 	clk_prepare_unlock();
 
@@ -1906,6 +1905,7 @@ int __clk_init(struct device *dev, struct clk *clk)
 	if (clk->ops->init)
 		clk->ops->init(clk->hw);
 
+	kref_init(&clk->ref);
 out:
 	clk_prepare_unlock();
 
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: Properly initialize reference count
  2013-10-31 12:02 [PATCH] clk: Properly initialize reference count Thierry Reding
@ 2013-10-31 19:09   ` Stephen Warren
  2013-10-31 20:03 ` Fabio Estevam
  2013-11-04  8:47 ` Jonas Jensen
  2 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2013-10-31 19:09 UTC (permalink / raw)
  To: Thierry Reding, Mike Turquette
  Cc: linux-arm-kernel, Sylwester Nawrocki, linux-next

On 10/31/2013 06:02 AM, Thierry Reding wrote:
> Commit a336ed7 (clk: Implement clk_unregister()) initializes the kref in
> clk_set_parent(), which is obviously the wrong place. Further research
> shows that the original patches initialized it correctly, so it probably
> ended up in clk_set_parent() by mistake during manual application of the
> patch.

Tested-by: Stephen Warren <swarren@nvidia.com>

BTW, it'd be nice to Cc fixes like this to linux-next@vger.kernel.org; I
/might/ have avoided doing a bisect if I'd seen this patch first!

I see the benefit of that "linux-next plus today's accumulated
bug-fixes" tree that I think you proposed:-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] clk: Properly initialize reference count
@ 2013-10-31 19:09   ` Stephen Warren
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2013-10-31 19:09 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/31/2013 06:02 AM, Thierry Reding wrote:
> Commit a336ed7 (clk: Implement clk_unregister()) initializes the kref in
> clk_set_parent(), which is obviously the wrong place. Further research
> shows that the original patches initialized it correctly, so it probably
> ended up in clk_set_parent() by mistake during manual application of the
> patch.

Tested-by: Stephen Warren <swarren@nvidia.com>

BTW, it'd be nice to Cc fixes like this to linux-next at vger.kernel.org; I
/might/ have avoided doing a bisect if I'd seen this patch first!

I see the benefit of that "linux-next plus today's accumulated
bug-fixes" tree that I think you proposed:-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] clk: Properly initialize reference count
  2013-10-31 12:02 [PATCH] clk: Properly initialize reference count Thierry Reding
  2013-10-31 19:09   ` Stephen Warren
@ 2013-10-31 20:03 ` Fabio Estevam
  2013-11-04  8:47 ` Jonas Jensen
  2 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2013-10-31 20:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 31, 2013 at 10:02 AM, Thierry Reding
<thierry.reding@gmail.com> wrote:
> Commit a336ed7 (clk: Implement clk_unregister()) initializes the kref in
> clk_set_parent(), which is obviously the wrong place. Further research
> shows that the original patches initialized it correctly, so it probably
> ended up in clk_set_parent() by mistake during manual application of the
> patch.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Tested-by: Fabio Estevam <fabio.estevam@freescale.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: Properly initialize reference count
  2013-10-31 19:09   ` Stephen Warren
@ 2013-11-01  9:23     ` Thierry Reding
  -1 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2013-11-01  9:23 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Mike Turquette, linux-arm-kernel, Sylwester Nawrocki, linux-next

[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]

On Thu, Oct 31, 2013 at 01:09:11PM -0600, Stephen Warren wrote:
> On 10/31/2013 06:02 AM, Thierry Reding wrote:
> > Commit a336ed7 (clk: Implement clk_unregister()) initializes the kref in
> > clk_set_parent(), which is obviously the wrong place. Further research
> > shows that the original patches initialized it correctly, so it probably
> > ended up in clk_set_parent() by mistake during manual application of the
> > patch.
> 
> Tested-by: Stephen Warren <swarren@nvidia.com>
> 
> BTW, it'd be nice to Cc fixes like this to linux-next@vger.kernel.org;

Yes, perhaps that would've been a good idea.

> I /might/ have avoided doing a bisect if I'd seen this patch first!

I get that bisect is a really nice tool. But I don't understand why
people seem to rely on it to track down *everything* nowadays. In this
particular case there was a fairly obvious warning that pretty clearly
pointed at something wrong with the reference counting and some simple
code inspection revealed the issue at hand. No need to rebuild and boot
the kernel dozens of times to find this out.

But perhaps other people have much faster machines and bisection is
actually faster...

> I see the benefit of that "linux-next plus today's accumulated
> bug-fixes" tree that I think you proposed:-)

Yeah, this is precisely the situation where this would be good to have.
Both of these issues together took about 45-60 minutes to track down and
fix. I suppose it took Olof and you a similar amount of time. Yet if the
fixes were already collected in some standard location it would free you
up to do something more productive instead of wasting your time on
duplicate work.

I'll ask Stephen (Rothwell) if he'd be willing to set up shared access
to linux-next so that I can push collected fixes. Alternatively I could
do that in a separate repository.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] clk: Properly initialize reference count
@ 2013-11-01  9:23     ` Thierry Reding
  0 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2013-11-01  9:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 31, 2013 at 01:09:11PM -0600, Stephen Warren wrote:
> On 10/31/2013 06:02 AM, Thierry Reding wrote:
> > Commit a336ed7 (clk: Implement clk_unregister()) initializes the kref in
> > clk_set_parent(), which is obviously the wrong place. Further research
> > shows that the original patches initialized it correctly, so it probably
> > ended up in clk_set_parent() by mistake during manual application of the
> > patch.
> 
> Tested-by: Stephen Warren <swarren@nvidia.com>
> 
> BTW, it'd be nice to Cc fixes like this to linux-next at vger.kernel.org;

Yes, perhaps that would've been a good idea.

> I /might/ have avoided doing a bisect if I'd seen this patch first!

I get that bisect is a really nice tool. But I don't understand why
people seem to rely on it to track down *everything* nowadays. In this
particular case there was a fairly obvious warning that pretty clearly
pointed at something wrong with the reference counting and some simple
code inspection revealed the issue at hand. No need to rebuild and boot
the kernel dozens of times to find this out.

But perhaps other people have much faster machines and bisection is
actually faster...

> I see the benefit of that "linux-next plus today's accumulated
> bug-fixes" tree that I think you proposed:-)

Yeah, this is precisely the situation where this would be good to have.
Both of these issues together took about 45-60 minutes to track down and
fix. I suppose it took Olof and you a similar amount of time. Yet if the
fixes were already collected in some standard location it would free you
up to do something more productive instead of wasting your time on
duplicate work.

I'll ask Stephen (Rothwell) if he'd be willing to set up shared access
to linux-next so that I can push collected fixes. Alternatively I could
do that in a separate repository.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131101/97b366d5/attachment.sig>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] clk: Properly initialize reference count
  2013-10-31 12:02 [PATCH] clk: Properly initialize reference count Thierry Reding
  2013-10-31 19:09   ` Stephen Warren
  2013-10-31 20:03 ` Fabio Estevam
@ 2013-11-04  8:47 ` Jonas Jensen
  2 siblings, 0 replies; 7+ messages in thread
From: Jonas Jensen @ 2013-11-04  8:47 UTC (permalink / raw)
  To: linux-arm-kernel

On 31 October 2013 13:02, Thierry Reding <thierry.reding@gmail.com> wrote:
> Commit a336ed7 (clk: Implement clk_unregister()) initializes the kref in
> clk_set_parent(), which is obviously the wrong place. Further research
> shows that the original patches initialized it correctly, so it probably
> ended up in clk_set_parent() by mistake during manual application of the
> patch.

Tested-by: Jonas Jensen <jonas.jensen@gmail.com>

Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-04  8:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-31 12:02 [PATCH] clk: Properly initialize reference count Thierry Reding
2013-10-31 19:09 ` Stephen Warren
2013-10-31 19:09   ` Stephen Warren
2013-11-01  9:23   ` Thierry Reding
2013-11-01  9:23     ` Thierry Reding
2013-10-31 20:03 ` Fabio Estevam
2013-11-04  8:47 ` Jonas Jensen

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.