[PATCH] powerpc: booke: fix boot crash due to null hugepd

Scott Wood oss at buserror.net
Fri Feb 17 21:08:24 AEDT 2017


On Thu, 2017-02-16 at 09:11 -0600, laurentiu.tudor at nxp.com wrote:
> From: Laurentiu Tudor <laurentiu.tudor at nxp.com>
> 
> On 32-bit book-e machines, hugepd_ok() does not take
> into account null hugepd values, causing this crash at boot:

Why only 32-bit?

> diff --git a/arch/powerpc/include/asm/nohash/pgtable.h
> b/arch/powerpc/include/asm/nohash/pgtable.h
> index 0cd8a38..e5805ad 100644
> --- a/arch/powerpc/include/asm/nohash/pgtable.h
> +++ b/arch/powerpc/include/asm/nohash/pgtable.h
> @@ -230,7 +230,7 @@ static inline int hugepd_ok(hugepd_t hpd)
>  	return ((hpd_val(hpd) & 0x4) != 0);
>  #else
>  	/* We clear the top bit to indicate hugepd */
> -	return ((hpd_val(hpd) & PD_HUGE) ==  0);
> +	return (hpd_val(hpd) && (hpd_val(hpd) & PD_HUGE) == 0);
>  #endif
>  }
>  

Any reason why this can't go back to being "hpd_val(hpd) > 0"?  Why was nohash
changed to begin with?  I don't expect nohash (or at least fsl-book3e) will
ever have a pagetable that is not native-endian, and "> 0" is consistent with
what the TLB miss code is doing.

Also, the patch that broke this was tagged for stable (which again raises the
question of why an extraneous change was made) so this patch needs to be as
well.

-Scott



More information about the Linuxppc-dev mailing list