On 11/19/21 21:27, John David Anglin wrote: > On 2021-11-19 10:56 a.m., Helge Deller wrote: >> * John David Anglin<dave.anglin@xxxxxxxx>: >>> The extru instruction leaves the most significant 32 bits of the target register in an undefined >>> state on PA 2.0 systems. If any of these bits are nonzero, this will break the calculation of the >>> lock pointer. >>> >>> Fix by using extrd,u instruction on 64-bit kernels. >> I wonder if we shouldn't introduce an extru_safe() macro. >> The name doesn't matter, but that way we can get rid of the ifdefs and >> use it in other places as well, e.g. as seen below. >> Thoughs? > Seems like a good idea. > > Only question is this hunk > > @@ -366,17 +366,9 @@ > */ > .macro L2_ptep pmd,pte,index,va,fault > #if CONFIG_PGTABLE_LEVELS == 3 > - extru \va,31-ASM_PMD_SHIFT,ASM_BITS_PER_PMD,\index > + extru_safe \va,31-ASM_PMD_SHIFT,ASM_BITS_PER_PMD,\index > #else > -# if defined(CONFIG_64BIT) > - extrd,u \va,63-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index > - #else > - # if PAGE_SIZE > 4096 > - extru \va,31-ASM_PGDIR_SHIFT,32-ASM_PGDIR_SHIFT,\index > - # else > - extru \va,31-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index > - # endif > -# endif > + extru_safe \va,31-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index > #endif > dep %r0,31,PAGE_SHIFT,\pmd /* clear offset */ > #if CONFIG_PGTABLE_LEVELS < 3 > > where we lose the PAGE_SIZE > 4096 shift. That's a left-over. PAGE_SIZE>4096 can only be enabled on PA20 and is currently marked broken anyway. The if was there to theoretically be able to use it with 32bit kernels where the extru length extended left to the upper 32bits... Helge