Files
Paolo Bonzini 5335e318ad tracing: Make undefsyms_base.c a first-class citizen
Linus points out that dumping undefsyms_base.c form the Makefile
is rather ugly, and that a much better course of action would be
to have this file as a first-class citizen in the git tree.

This allows some extra cleanup in the Makefile, and the removal of
the .gitignore file in kernel/trace.

Cc: Marc Zyngier <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Link: https://lore.kernel.org/r/CAHk-=wieqGd_XKpu8UxDoyADZx8TDe8CF3RmkUXt5N_9t5Pf_w@mail.gmail.com
Link: https://lore.kernel.org/all/[email protected]/
Link: https://patch.msgid.link/[email protected]
Reported-by: Linus Torvalds <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
Tested-by: Nathan Chancellor <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
2026-04-22 11:24:41 -04:00

29 lines
757 B
C

// SPDX-License-Identifier: GPL-2.0
/*
* simple_ring_buffer is used by the pKVM hypervisor which does not have access
* to all kernel symbols. Whatever is undefined when compiling this file is
* compiler and tooling-generated symbols that can safely be ignored for
* simple_ring_buffer.
*/
#include <linux/atomic.h>
#include <linux/string.h>
#include <asm/page.h>
void undefsyms_base(void *p, int n);
static char page[PAGE_SIZE] __aligned(PAGE_SIZE);
void undefsyms_base(void *p, int n)
{
char buffer[256] = { 0 };
u32 u = 0;
memset((char * volatile)page, 8, PAGE_SIZE);
memset((char * volatile)buffer, 8, sizeof(buffer));
memcpy((void * volatile)p, buffer, sizeof(buffer));
cmpxchg((u32 * volatile)&u, 0, 8);
WARN_ON(n == 0xdeadbeef);
}