summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-10-23 09:44:53 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2026-10-23 09:44:53 -1000
commit5b212610d0b8f474f1eef70b9a5aa4b2ecfff788 (patch)
tree66d53c4ebc7b8367be22030425ec398736935b91 /lib
parent845f394e462fb1bd67b9779c467be478631a4daf (diff)
parent111153e8280b4fa8b5537c941264ee6dc71d71d8 (diff)
Merge tag 'printk-for-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek: - John Ogness became PRINTK co-maintainer - Unregister boot consoles when any proper console is registered at the end of the boot phase. Before they were removed only when the so-called preferred console, usually set via the last 'console=' parameter, got registered - Fix computation for increasing the printk ringbuffer on systems with many CPUs and possibly long backtraces from all CPUs - Cleaned up irq_works handling for deferred printk operations - Use acquire/release semantic for filled_random_ptr_key - Allow to use ':' in console options - More code clean up * tag 'printk-for-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: MAINTAINERS: Make John PRINTK co-maintainer lib/vsprintf: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols printk: Remove console options before decoding the name printk: increase the ring buffer for more than 16 CPUs by default printk_ringbuffer: Avoid needless read of prb_desc printk: Use two irq_works instead per-CPU lib/vsprintf: Use acquire/release for ptr_key publication printk: Remove remaining boot consoles when a real console exists
Diffstat (limited to 'lib')
-rw-r--r--lib/tests/printf_kunit.c1
-rw-r--r--lib/vsprintf.c19
2 files changed, 10 insertions, 10 deletions
diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c
index eccf041ebd56..290d59b22c29 100644
--- a/lib/tests/printf_kunit.c
+++ b/lib/tests/printf_kunit.c
@@ -876,3 +876,4 @@ kunit_test_suite(printf_test_suite);
MODULE_AUTHOR("Rasmus Villemoes <linux@rasmusvillemoes.dk>");
MODULE_DESCRIPTION("Test cases for printf facility");
MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 1d95ab9314bf..f44c4eeb6629 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -25,6 +25,7 @@
#include <linux/module.h> /* for KSYM_SYMBOL_LEN */
#include <linux/types.h>
#include <linux/string.h>
+#include <linux/string_helpers.h>
#include <linux/ctype.h>
#include <linux/hex.h>
#include <linux/kernel.h>
@@ -54,12 +55,13 @@
#include <asm/byteorder.h> /* cpu_to_le16 */
#include <linux/unaligned.h>
-#include <linux/string_helpers.h>
+#include <kunit/visibility.h>
+
#include "kstrtox.h"
/* Disable pointer hashing if requested */
bool no_hash_pointers __ro_after_init;
-EXPORT_SYMBOL_FOR_MODULES(no_hash_pointers, "printf_kunit");
+EXPORT_SYMBOL_IF_KUNIT(no_hash_pointers);
/*
* Hashed pointers policy selected by "hash_pointers=..." boot param
@@ -762,9 +764,8 @@ static int fill_ptr_key(struct notifier_block *nb, unsigned long action, void *d
{
get_random_bytes(&ptr_key, sizeof(ptr_key));
- /* Pairs with smp_rmb() before reading ptr_key. */
- smp_wmb();
- WRITE_ONCE(filled_random_ptr_key, true);
+ /* Pairs with smp_load_acquire() before reading ptr_key. */
+ smp_store_release(&filled_random_ptr_key, true);
return NOTIFY_DONE;
}
@@ -781,12 +782,10 @@ static inline int __ptr_to_hashval(const void *ptr, unsigned long *hashval_out)
{
unsigned long hashval;
- if (!READ_ONCE(filled_random_ptr_key))
+ /* Pairs with smp_store_release() after writing ptr_key. */
+ if (!smp_load_acquire(&filled_random_ptr_key))
return -EBUSY;
- /* Pairs with smp_wmb() after writing ptr_key. */
- smp_rmb();
-
#ifdef CONFIG_64BIT
hashval = (unsigned long)siphash_1u64((u64)ptr, &ptr_key);
/*
@@ -850,7 +849,7 @@ static char *default_pointer(char *buf, char *end, const void *ptr,
}
int kptr_restrict __read_mostly;
-EXPORT_SYMBOL_FOR_MODULES(kptr_restrict, "printf_kunit");
+EXPORT_SYMBOL_IF_KUNIT(kptr_restrict);
static noinline_for_stack
char *restricted_pointer(char *buf, char *end, const void *ptr,