[PATCH 1/2] powerpc: Use seq_buf to avoid pr_cont() in __die()

Michael Ellerman mpe at ellerman.id.au
Thu Jan 10 21:54:28 AEDT 2019


Christophe Leroy <christophe.leroy at c-s.fr> writes:
> Le 08/01/2019 à 13:04, Michael Ellerman a écrit :
>> Using pr_cont() risks having our output interleaved with other output
>> from other CPUs. Instead use a seq_buf to construct the line and then
>> print it as a whole.
>
> Why not simply doing a single printk() or similar on the same model as 
> X86 for instance ? 
> (https://elixir.bootlin.com/linux/v5.0-rc1/source/arch/x86/kernel/dumpstack.c#L368)

Yeah we could do it that way, though it can become a bit of a mess.

In this case I guess it's not *too* bad:

	printk("%s PAGE_SIZE=%luK%s%s%s%s%s %s\n",
	       IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN) ? "LE" : "BE",
	       PAGE_SIZE / 1024,
	       IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "",
	       IS_ENABLED(CONFIG_SMP) ? " SMP" : "",
	       IS_ENABLED(CONFIG_SMP) ? (" NR_CPUS=" __stringify(NR_CPUS)) : "",
	       debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "",
	       IS_ENABLED(CONFIG_NUMA) ? " NUMA" : "",
	       ppc_md.name ? ppc_md.name : "");

And the generated code is obviously a lot smaller.

So yeah I'll go with that. Thanks for the review.

cheers


More information about the Linuxppc-dev mailing list