Re: [PATCH printk v8 31/35] printk: nbcon: Implement emergency sections
From: John Ogness
Date: Tue Aug 27 2024 - 10:19:43 EST
Hi Petr,
On 2024-08-20, John Ogness <john.ogness@xxxxxxxxxxxxx> wrote:
> +static __ref unsigned int *nbcon_get_cpu_emergency_nesting(void)
> +{
> + /*
> + * The value of __printk_percpu_data_ready gets set in normal
> + * context and before SMP initialization. As a result it could
> + * never change while inside an nbcon emergency section.
> + */
> + if (!printk_percpu_data_ready())
> + return &early_nbcon_pcpu_emergency_nesting;
> +
> + /* Open code this_cpu_ptr() without checking migration. */
> + return per_cpu_ptr(&nbcon_pcpu_emergency_nesting, raw_smp_processor_id());
> +}
It was pointed out to me that raw_cpu_ptr() exists exactly for this
purpose. There is no need to open code it. Perhaps you can fold the
following patch into this one for linux-next?
John
------------8<--------------