Merge branch 'add-an-assert-in-napi_consume_skb'
Yunsheng Lin says: ==================== Add an assert in napi_consume_skb() This patch introduces a lockdep_assert_in_softirq() interface and uses it to assert the case when napi_consume_skb() is not called in the softirq context. ==================== Link: https://lore.kernel.org/r/1606214969-97849-1-git-send-email-linyunsheng@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
0e1f1cc89a
@ -594,6 +594,16 @@ do { \
|
||||
this_cpu_read(hardirqs_enabled))); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Acceptable for protecting per-CPU resources accessed from BH.
|
||||
* Much like in_softirq() - semantics are ambiguous, use carefully.
|
||||
*/
|
||||
#define lockdep_assert_in_softirq() \
|
||||
do { \
|
||||
WARN_ON_ONCE(__lockdep_enabled && \
|
||||
(!in_softirq() || in_irq() || in_nmi())); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
# define might_lock(lock) do { } while (0)
|
||||
# define might_lock_read(lock) do { } while (0)
|
||||
@ -605,6 +615,7 @@ do { \
|
||||
|
||||
# define lockdep_assert_preemption_enabled() do { } while (0)
|
||||
# define lockdep_assert_preemption_disabled() do { } while (0)
|
||||
# define lockdep_assert_in_softirq() do { } while (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PROVE_RAW_LOCK_NESTING
|
||||
|
@ -902,6 +902,8 @@ void napi_consume_skb(struct sk_buff *skb, int budget)
|
||||
return;
|
||||
}
|
||||
|
||||
lockdep_assert_in_softirq();
|
||||
|
||||
if (!skb_unref(skb))
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user