public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net, lib/once: Remove {net_}get_random_once_wait macro
@ 2022-06-19  7:46 wuchi
  2022-06-19 22:42 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: wuchi @ 2022-06-19  7:46 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni; +Cc: akpm, linux-kernel

DO_ONCE(func, ...) will call func with spinlock which acquired by
spin_lock_irqsave in __do_once_start. But the get_random_once_wait
will sleep in get_random_bytes_wait -> wait_for_random_bytes.

Fortunately, there is no place to use {net_}get_random_once_wait,
so we could remove them simply.

Signed-off-by: wuchi <wuchi.zero@gmail.com>
---
 include/linux/net.h  | 2 --
 include/linux/once.h | 2 --
 2 files changed, 4 deletions(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index 12093f4db50c..8613772a1f58 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -303,8 +303,6 @@ do {									\
 
 #define net_get_random_once(buf, nbytes)			\
 	get_random_once((buf), (nbytes))
-#define net_get_random_once_wait(buf, nbytes)			\
-	get_random_once_wait((buf), (nbytes))
 
 /*
  * E.g. XFS meta- & log-data is in slab pages, or bcache meta
diff --git a/include/linux/once.h b/include/linux/once.h
index f54523052bbc..b14d8b309d52 100644
--- a/include/linux/once.h
+++ b/include/linux/once.h
@@ -54,7 +54,5 @@ void __do_once_done(bool *done, struct static_key_true *once_key,
 
 #define get_random_once(buf, nbytes)					     \
 	DO_ONCE(get_random_bytes, (buf), (nbytes))
-#define get_random_once_wait(buf, nbytes)                                    \
-	DO_ONCE(get_random_bytes_wait, (buf), (nbytes))                      \
 
 #endif /* _LINUX_ONCE_H */
-- 
2.20.1


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

* Re: [PATCH] net, lib/once: Remove {net_}get_random_once_wait macro
  2022-06-19  7:46 [PATCH] net, lib/once: Remove {net_}get_random_once_wait macro wuchi
@ 2022-06-19 22:42 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2022-06-19 22:42 UTC (permalink / raw)
  To: wuchi; +Cc: davem, edumazet, pabeni, akpm, linux-kernel

On Sun, 19 Jun 2022 15:46:41 +0800 wuchi wrote:
> DO_ONCE(func, ...) will call func with spinlock which acquired by
> spin_lock_irqsave in __do_once_start. But the get_random_once_wait
> will sleep in get_random_bytes_wait -> wait_for_random_bytes.
> 
> Fortunately, there is no place to use {net_}get_random_once_wait,
> so we could remove them simply.
> 
> Signed-off-by: wuchi <wuchi.zero@gmail.com>

Yeah, sure, if it builds:

Acked-by: Jakub Kicinski <kuba@kernel.org>

If Andrew doesn't pick it you please repost CCing netdev.

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

end of thread, other threads:[~2022-06-19 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-19  7:46 [PATCH] net, lib/once: Remove {net_}get_random_once_wait macro wuchi
2022-06-19 22:42 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox