[PATCH] powerpc/pseries: avoid harmless preempt warning

Christophe Leroy christophe.leroy at c-s.fr
Sat Mar 21 02:33:00 AEDT 2020



Le 20/03/2020 à 16:24, Nicholas Piggin a écrit :
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
>   arch/powerpc/platforms/pseries/lpar.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
> index 3c3da25b445c..e4ed5317f117 100644
> --- a/arch/powerpc/platforms/pseries/lpar.c
> +++ b/arch/powerpc/platforms/pseries/lpar.c
> @@ -636,8 +636,16 @@ static const struct proc_ops vcpudispatch_stats_freq_proc_ops = {
>   
>   static int __init vcpudispatch_stats_procfs_init(void)
>   {
> -	if (!lppaca_shared_proc(get_lppaca()))
> +	/*
> +	 * Avoid smp_processor_id while preemptible. All CPUs should have
> +	 * the same value for lppaca_shared_proc.
> +	 */
> +	preempt_disable();
> +	if (!lppaca_shared_proc(get_lppaca())) {
> +		preempt_enable();
>   		return 0;
> +	}
> +	preempt_enable();

Can we avoid the double preempt_enable() with something like:

	preempt_disable();
	is_shared = lppaca_shared_proc(get_lppaca());
	preempt_enable();
	if (!is_shared)
		return 0;


>   
>   	if (!proc_create("powerpc/vcpudispatch_stats", 0600, NULL,
>   					&vcpudispatch_stats_proc_ops))
> 

Christophe


More information about the Linuxppc-dev mailing list