Skip to contentSkip to conversation

parisc: Remove PTE load and fault check from L2_ptep macro

PATCH Guenter Roeck 2 participants 3 messages Sep 26, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

Quoted 6 lines · John David Anglin

This change removes the PTE load and present check from the L2_ptep macro. The load and check for kernel pages is now done in the tlb_lock macro. This avoids a double load and check for user pages. The load and check for user pages is now done inside the lock so the fault handler can't be called while the entry is being updated.

This patch causes my parisc qemu tests to fail. Unfortunately I don't have any useful log output; the failure is silent. Reverting the patch fixes the problem.

Guenter

Quoted 45 lines
---
 arch/parisc/kernel/entry.S | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/parisc/kernel/entry.S +5 -5
index eeee1d2c4b8e..3371472379a6 100644
@@ -431,8 +431,6 @@
 	extru		\va,31-PAGE_SHIFT,ASM_BITS_PER_PTE,\index
 	dep		%r0,31,PAGE_SHIFT,\pmd  /* clear offset */
 	shladd		\index,BITS_PER_PTE_ENTRY,\pmd,\pmd /* pmd is now pte */
-	LDREG		%r0(\pmd),\pte
-	bb,>=,n		\pte,_PAGE_PRESENT_BIT,\fault
 	.endm
 
 	/* Look up PTE in a 3-Level scheme.
@@ -463,7 +461,7 @@
 	L2_ptep		\pgd,\pte,\index,\va,\fault
 	.endm
 
-	/* Acquire pa_tlb_lock lock and recheck page is still present. */
+	/* Acquire pa_tlb_lock lock and check page is present. */
 	.macro		tlb_lock	spc,ptp,pte,tmp,tmp1,fault
 #ifdef CONFIG_SMP
 	cmpib,COND(=),n	0,\spc,2f
@@ -472,10 +470,12 @@
 	cmpib,COND(=)	0,\tmp1,1b
 	nop
 	LDREG		0(\ptp),\pte
-	bb,<,n		\pte,_PAGE_PRESENT_BIT,2f
+	bb,<,n		\pte,_PAGE_PRESENT_BIT,3f
 	b		\fault
 	stw		 \spc,0(\tmp)
-2:
+2:	LDREG		0(\ptp),\pte
+	bb,>=,n		\pte,_PAGE_PRESENT_BIT,\fault
+3:
 #endif
 	.endm
 
Signature · 1 line
2.7.4
#1 lore raw

Hi,

Quoted 3 lines · Guenter Roeck

This patch causes my parisc qemu tests to fail. Unfortunately I don't have any useful log output; the failure is silent. Reverting the patch fixes the problem.

Can you be more specific on how to run these tests?

Dave

Signature · 1 line
John David Anglin  [email protected]
#2 lore raw
Quoted 10 lines · John David Anglin

Hi,

Quoted 3 lines · Guenter Roeck

This patch causes my parisc qemu tests to fail. Unfortunately I don't have any useful log output; the failure is silent. Reverting the patch fixes the problem.

Can you be more specific on how to run these tests?

Dave

Sorry. Please see

https://github.com/groeck/linux-build-test/tree/master/rootfs/parisc

My tests enable a number of device and debug options on top of defconfig. Those are not necessary, though. The problem can be reproduced with defconfig.

With the initrd available from there, and with an image built using 'defconfig', run

qemu-system-hppa \
	-kernel vmlinux -no-reboot \
	-initrd rootfs.cpio.gz \
	-append 'rdinit=/sbin/init console=ttyS0,115200' \
	-nographic -monitor null

I tested with qemu 2.12 and 3.0. Using "arch/parisc/boot/bzImage" as kernel image does not make a difference.

Note: The initrd auto-reboots. To avoid that, add "noreboot" as additional command line option.

Hope this helps,

Guenter