Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ccdc519 authored by Petr Mladek's avatar Petr Mladek
Browse files

Merge branch 'for-4.16-deprecate-printk-pf' into for-4.16

parents 6fd78a1a 1df7338a
Loading
Loading
Loading
Loading
+12 −23
Original line number Diff line number Diff line
@@ -50,42 +50,31 @@ Symbols/Function Pointers

::

	%pS	versatile_init+0x0/0x110
	%ps	versatile_init
	%pF	versatile_init+0x0/0x110
	%pf	versatile_init
	%pS	versatile_init+0x0/0x110
	%pSR	versatile_init+0x9/0x110
		(with __builtin_extract_return_addr() translation)
	%ps	versatile_init
	%pB	prev_fn_of_versatile_init+0x88/0x88

The ``F`` and ``f`` specifiers are for printing function pointers,
for example, f->func, &gettimeofday. They have the same result as
``S`` and ``s`` specifiers. But they do an extra conversion on
ia64, ppc64 and parisc64 architectures where the function pointers
are actually function descriptors.
The ``S`` and ``s`` specifiers are used for printing a pointer in symbolic
format. They result in the symbol name with (``S``) or without (``s``)
offsets. If KALLSYMS are disabled then the symbol address is printed instead.

The ``S`` and ``s`` specifiers can be used for printing symbols
from direct addresses, for example, __builtin_return_address(0),
(void *)regs->ip. They result in the symbol name with (``S``) or
without (``s``) offsets. If KALLSYMS are disabled then the symbol
address is printed instead.
Note, that the ``F`` and ``f`` specifiers are identical to ``S`` (``s``)
and thus deprecated. We have ``F`` and ``f`` because on ia64, ppc64 and
parisc64 function pointers are indirect and, in fact, are function
descriptors, which require additional dereferencing before we can lookup
the symbol. As of now, ``S`` and ``s`` perform dereferencing on those
platforms (when needed), so ``F`` and ``f`` exist for compatibility
reasons only.

The ``B`` specifier results in the symbol name with offsets and should be
used when printing stack backtraces. The specifier takes into
consideration the effect of compiler optimisations which may occur
when tail-call``s are used and marked with the noreturn GCC attribute.

Examples::

	printk("Going to call: %pF\n", gettimeofday);
	printk("Going to call: %pF\n", p->func);
	printk("%s: called from %pS\n", __func__, (void *)_RET_IP_);
	printk("%s: called from %pS\n", __func__,
				(void *)__builtin_return_address(0));
	printk("Faulted at %pS\n", (void *)regs->ip);
	printk(" %s%pB\n", (reliable ? "" : "? "), (void *)*stack);


Kernel Pointers
===============

+9 −1
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ extern char __start_gate_brl_fsys_bubble_down_patchlist[], __end_gate_brl_fsys_b
extern char __start_unwind[], __end_unwind[];
extern char __start_ivt_text[], __end_ivt_text[];

#define HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR 1

#undef dereference_function_descriptor
static inline void *dereference_function_descriptor(void *ptr)
{
@@ -38,6 +40,12 @@ static inline void *dereference_function_descriptor(void *ptr)
	return ptr;
}

#undef dereference_kernel_function_descriptor
static inline void *dereference_kernel_function_descriptor(void *ptr)
{
	if (ptr < (void *)__start_opd || ptr >= (void *)__end_opd)
		return ptr;
	return dereference_function_descriptor(ptr);
}

#endif /* _ASM_IA64_SECTIONS_H */
+12 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@

#include <asm/patch.h>
#include <asm/unaligned.h>
#include <asm/sections.h>

#define ARCH_MODULE_DEBUG 0

@@ -918,3 +919,14 @@ module_arch_cleanup (struct module *mod)
	if (mod->arch.core_unw_table)
		unw_remove_unwind_table(mod->arch.core_unw_table);
}

void *dereference_module_function_descriptor(struct module *mod, void *ptr)
{
	Elf64_Shdr *opd = mod->arch.opd;

	if (ptr < (void *)opd->sh_addr ||
			ptr >= (void *)(opd->sh_addr + opd->sh_size))
		return ptr;

	return dereference_function_descriptor(ptr);
}
+2 −0
Original line number Diff line number Diff line
@@ -108,7 +108,9 @@ SECTIONS {
	RODATA

	.opd : AT(ADDR(.opd) - LOAD_OFFSET) {
		__start_opd = .;
		*(.opd)
		__end_opd = .;
	}

	/*
+1 −2
Original line number Diff line number Diff line
@@ -39,8 +39,7 @@
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/unwinder.h>

extern char _etext, _stext;
#include <asm/sections.h>

int kstack_depth_to_print = 0x180;
int lwa_flag;
Loading