* [PATCH net-next] rtnetlink: Replace implementation of ASSERT_RTNL() macro with WARN_ONCE()
@ 2017-12-21 9:40 Leon Romanovsky
2017-12-26 17:30 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2017-12-21 9:40 UTC (permalink / raw)
To: David S. Miller; +Cc: Leon Romanovsky, Mark Bloch, netdev
From: Leon Romanovsky <leonro@mellanox.com>
ASSERT_RTNL() macro is actual open-coded variant of WARN_ONCE() with
two exceptions. First, it prints stack for multiple hits and not only
once as WARN_ONCE() does. Second, the user can disable prints of
WARN_ONCE by setting CONFIG_BUG to N.
The multiple prints of dump stack are actually not needed, because calls
without rtnl lock are programming errors and user can't do anything
about them except to complain to the mailing list after first occurrence
of such failure.
The user who disabled BUG/WARN prints did it explicitly because by default
in upstream kernel and distributions this option is enabled. It means
that user doesn't want to see prints about missing locks too.
This patch replaces open-coded variant in favor of already existing
macro and change error prints to be once only.
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
include/linux/rtnetlink.h | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 2032ce2eb20b..62d508b31f56 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -97,13 +97,9 @@ void rtnetlink_init(void);
void __rtnl_unlock(void);
void rtnl_kfree_skbs(struct sk_buff *head, struct sk_buff *tail);
-#define ASSERT_RTNL() do { \
- if (unlikely(!rtnl_is_locked())) { \
- printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \
- __FILE__, __LINE__); \
- dump_stack(); \
- } \
-} while(0)
+#define ASSERT_RTNL() \
+ WARN_ONCE(!rtnl_is_locked(), \
+ "RTNL: assertion failed at %s (%d)\n", __FILE__, __LINE__)
extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
struct netlink_callback *cb,
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net-next] rtnetlink: Replace implementation of ASSERT_RTNL() macro with WARN_ONCE()
2017-12-21 9:40 [PATCH net-next] rtnetlink: Replace implementation of ASSERT_RTNL() macro with WARN_ONCE() Leon Romanovsky
@ 2017-12-26 17:30 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-12-26 17:30 UTC (permalink / raw)
To: leon; +Cc: leonro, markb, netdev
From: Leon Romanovsky <leon@kernel.org>
Date: Thu, 21 Dec 2017 11:40:04 +0200
> From: Leon Romanovsky <leonro@mellanox.com>
>
> ASSERT_RTNL() macro is actual open-coded variant of WARN_ONCE() with
> two exceptions. First, it prints stack for multiple hits and not only
> once as WARN_ONCE() does. Second, the user can disable prints of
> WARN_ONCE by setting CONFIG_BUG to N.
>
> The multiple prints of dump stack are actually not needed, because calls
> without rtnl lock are programming errors and user can't do anything
> about them except to complain to the mailing list after first occurrence
> of such failure.
>
> The user who disabled BUG/WARN prints did it explicitly because by default
> in upstream kernel and distributions this option is enabled. It means
> that user doesn't want to see prints about missing locks too.
>
> This patch replaces open-coded variant in favor of already existing
> macro and change error prints to be once only.
>
> Reviewed-by: Mark Bloch <markb@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-26 17:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-21 9:40 [PATCH net-next] rtnetlink: Replace implementation of ASSERT_RTNL() macro with WARN_ONCE() Leon Romanovsky
2017-12-26 17:30 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).