All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays()
@ 2016-03-02 11:24 ` Sergey Senozhatsky
  0 siblings, 0 replies; 6+ messages in thread
From: Sergey Senozhatsky @ 2016-03-02 11:24 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, Grant Likely, Petr Mladek, Andrew Morton,
	devicetree, linux-kernel, Sergey Senozhatsky, Sergey Senozhatsky

of_overlay_destroy() can return `-ENODEV' error code once it
failed to find the requested overlay in `ov_idr'. However,
of_unittest_destroy_tracked_overlays() does not handle this
error code correctly and continues to call of_overlay_destroy()
on the 'missing' overlay over and over again. This results in
a printk flood

[..]
[   33.497583] of_overlay_destroy: Could not find overlay #6
[   33.497583] of_overlay_destroy: Could not find overlay #6
[   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[   33.497586] of_overlay_destroy: Could not find overlay #6
[   33.497586] of_overlay_destroy: Could not find overlay #6
[   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[..]

which is not really good due to printk design, and can lead to soft
lockups, hard lockups, etc. (depending on the context console_unlock()
is being called from). The problem has bee observed in real life
and reported by Ying Huang.

This patch does not address the root cause of missing overlay in
`ov_idr', it fixes the endless loop only.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reported-by: kernel test robot <ying.huang@linux.intel.com>
Link: lkml.kernel.org/r/87fuwk1c0o.fsf@yhuang-dev.intel.com
---
 drivers/of/unittest.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 979b6e4..e986e6e 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1165,6 +1165,11 @@ static void of_unittest_destroy_tracked_overlays(void)
 				continue;
 
 			ret = of_overlay_destroy(id + overlay_first_id);
+			if (ret == -ENODEV) {
+				pr_warn("%s: no overlay to destroy for #%d\n",
+					__func__, id + overlay_first_id);
+				continue;
+			}
 			if (ret != 0) {
 				defers++;
 				pr_warn("%s: overlay destroy failed for #%d\n",
-- 
2.8.0.rc0

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

* [PATCH] of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays()
@ 2016-03-02 11:24 ` Sergey Senozhatsky
  0 siblings, 0 replies; 6+ messages in thread
From: Sergey Senozhatsky @ 2016-03-02 11:24 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, Grant Likely, Petr Mladek, Andrew Morton,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Sergey Senozhatsky,
	Sergey Senozhatsky

of_overlay_destroy() can return `-ENODEV' error code once it
failed to find the requested overlay in `ov_idr'. However,
of_unittest_destroy_tracked_overlays() does not handle this
error code correctly and continues to call of_overlay_destroy()
on the 'missing' overlay over and over again. This results in
a printk flood

[..]
[   33.497583] of_overlay_destroy: Could not find overlay #6
[   33.497583] of_overlay_destroy: Could not find overlay #6
[   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[   33.497586] of_overlay_destroy: Could not find overlay #6
[   33.497586] of_overlay_destroy: Could not find overlay #6
[   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[..]

which is not really good due to printk design, and can lead to soft
lockups, hard lockups, etc. (depending on the context console_unlock()
is being called from). The problem has bee observed in real life
and reported by Ying Huang.

This patch does not address the root cause of missing overlay in
`ov_idr', it fixes the endless loop only.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Reported-by: kernel test robot <ying.huang-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Link: lkml.kernel.org/r/87fuwk1c0o.fsf-5/hDr2MS57EDqwDYnZuMFFaTQe2KTcn/@public.gmane.org
---
 drivers/of/unittest.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 979b6e4..e986e6e 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1165,6 +1165,11 @@ static void of_unittest_destroy_tracked_overlays(void)
 				continue;
 
 			ret = of_overlay_destroy(id + overlay_first_id);
+			if (ret == -ENODEV) {
+				pr_warn("%s: no overlay to destroy for #%d\n",
+					__func__, id + overlay_first_id);
+				continue;
+			}
 			if (ret != 0) {
 				defers++;
 				pr_warn("%s: overlay destroy failed for #%d\n",
-- 
2.8.0.rc0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays()
@ 2016-03-02 14:44   ` Petr Mladek
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Mladek @ 2016-03-02 14:44 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Rob Herring, Frank Rowand, Grant Likely, Andrew Morton,
	devicetree, linux-kernel, Sergey Senozhatsky

On Wed 2016-03-02 20:24:49, Sergey Senozhatsky wrote:
> of_overlay_destroy() can return `-ENODEV' error code once it
> failed to find the requested overlay in `ov_idr'. However,
> of_unittest_destroy_tracked_overlays() does not handle this
> error code correctly and continues to call of_overlay_destroy()
> on the 'missing' overlay over and over again. This results in
> a printk flood
> 
> [..]
> [   33.497583] of_overlay_destroy: Could not find overlay #6
> [   33.497583] of_overlay_destroy: Could not find overlay #6
> [   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497586] of_overlay_destroy: Could not find overlay #6
> [   33.497586] of_overlay_destroy: Could not find overlay #6
> [   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [..]
> 
> which is not really good due to printk design, and can lead to soft
> lockups, hard lockups, etc. (depending on the context console_unlock()
> is being called from). The problem has bee observed in real life
> and reported by Ying Huang.
> 
> This patch does not address the root cause of missing overlay in
> `ov_idr', it fixes the endless loop only.
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Reported-by: kernel test robot <ying.huang@linux.intel.com>
> Link: lkml.kernel.org/r/87fuwk1c0o.fsf@yhuang-dev.intel.com

I am not sure why the overlay did not exist but this patch avoids
a possible infinite loop and makes sense on its own.

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

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

* Re: [PATCH] of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays()
@ 2016-03-02 14:44   ` Petr Mladek
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Mladek @ 2016-03-02 14:44 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Rob Herring, Frank Rowand, Grant Likely, Andrew Morton,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Sergey Senozhatsky

On Wed 2016-03-02 20:24:49, Sergey Senozhatsky wrote:
> of_overlay_destroy() can return `-ENODEV' error code once it
> failed to find the requested overlay in `ov_idr'. However,
> of_unittest_destroy_tracked_overlays() does not handle this
> error code correctly and continues to call of_overlay_destroy()
> on the 'missing' overlay over and over again. This results in
> a printk flood
> 
> [..]
> [   33.497583] of_overlay_destroy: Could not find overlay #6
> [   33.497583] of_overlay_destroy: Could not find overlay #6
> [   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497586] of_overlay_destroy: Could not find overlay #6
> [   33.497586] of_overlay_destroy: Could not find overlay #6
> [   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [..]
> 
> which is not really good due to printk design, and can lead to soft
> lockups, hard lockups, etc. (depending on the context console_unlock()
> is being called from). The problem has bee observed in real life
> and reported by Ying Huang.
> 
> This patch does not address the root cause of missing overlay in
> `ov_idr', it fixes the endless loop only.
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Reported-by: kernel test robot <ying.huang-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Link: lkml.kernel.org/r/87fuwk1c0o.fsf-5/hDr2MS57EDqwDYnZuMFFaTQe2KTcn/@public.gmane.org

I am not sure why the overlay did not exist but this patch avoids
a possible infinite loop and makes sense on its own.

Reviewed-by: Petr Mladek <pmladek-IBi9RG/b67k@public.gmane.org>

Best Regards,
Petr
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays()
@ 2016-03-03 22:53   ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2016-03-03 22:53 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Frank Rowand, Grant Likely, Petr Mladek, Andrew Morton,
	devicetree, linux-kernel, Sergey Senozhatsky

On Wed, Mar 02, 2016 at 08:24:49PM +0900, Sergey Senozhatsky wrote:
> of_overlay_destroy() can return `-ENODEV' error code once it
> failed to find the requested overlay in `ov_idr'. However,
> of_unittest_destroy_tracked_overlays() does not handle this
> error code correctly and continues to call of_overlay_destroy()
> on the 'missing' overlay over and over again. This results in
> a printk flood
> 
> [..]
> [   33.497583] of_overlay_destroy: Could not find overlay #6
> [   33.497583] of_overlay_destroy: Could not find overlay #6
> [   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497586] of_overlay_destroy: Could not find overlay #6
> [   33.497586] of_overlay_destroy: Could not find overlay #6
> [   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [..]
> 
> which is not really good due to printk design, and can lead to soft
> lockups, hard lockups, etc. (depending on the context console_unlock()
> is being called from). The problem has bee observed in real life
> and reported by Ying Huang.
> 
> This patch does not address the root cause of missing overlay in
> `ov_idr', it fixes the endless loop only.
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Reported-by: kernel test robot <ying.huang@linux.intel.com>
> Link: lkml.kernel.org/r/87fuwk1c0o.fsf@yhuang-dev.intel.com
> ---
>  drivers/of/unittest.c | 5 +++++
>  1 file changed, 5 insertions(+)

Applied, thanks.

Rob

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

* Re: [PATCH] of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays()
@ 2016-03-03 22:53   ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2016-03-03 22:53 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Frank Rowand, Grant Likely, Petr Mladek, Andrew Morton,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Sergey Senozhatsky

On Wed, Mar 02, 2016 at 08:24:49PM +0900, Sergey Senozhatsky wrote:
> of_overlay_destroy() can return `-ENODEV' error code once it
> failed to find the requested overlay in `ov_idr'. However,
> of_unittest_destroy_tracked_overlays() does not handle this
> error code correctly and continues to call of_overlay_destroy()
> on the 'missing' overlay over and over again. This results in
> a printk flood
> 
> [..]
> [   33.497583] of_overlay_destroy: Could not find overlay #6
> [   33.497583] of_overlay_destroy: Could not find overlay #6
> [   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497586] of_overlay_destroy: Could not find overlay #6
> [   33.497586] of_overlay_destroy: Could not find overlay #6
> [   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
> [..]
> 
> which is not really good due to printk design, and can lead to soft
> lockups, hard lockups, etc. (depending on the context console_unlock()
> is being called from). The problem has bee observed in real life
> and reported by Ying Huang.
> 
> This patch does not address the root cause of missing overlay in
> `ov_idr', it fixes the endless loop only.
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Reported-by: kernel test robot <ying.huang-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Link: lkml.kernel.org/r/87fuwk1c0o.fsf-5/hDr2MS57EDqwDYnZuMFFaTQe2KTcn/@public.gmane.org
> ---
>  drivers/of/unittest.c | 5 +++++
>  1 file changed, 5 insertions(+)

Applied, thanks.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-03-03 22:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-02 11:24 [PATCH] of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays() Sergey Senozhatsky
2016-03-02 11:24 ` Sergey Senozhatsky
2016-03-02 14:44 ` Petr Mladek
2016-03-02 14:44   ` Petr Mladek
2016-03-03 22:53 ` Rob Herring
2016-03-03 22:53   ` Rob Herring

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.