parisc: Use local tlb purges only on PA2.0 machines
Helge Deller
maintainerRFC PATCH 1/1 parisc: Use local tlb purges only on PA2.0 machines
Allow usage of CPU-local tlb purges in pacache.S on PA2.0 machines only.
arch/parisc/kernel/pacache.S +13 -30
@@ -31,6 +31,12 @@ .section .text.hot .align 16 +#ifdef CONFIG_PA20 +#define ALT_COND_PACACHE ALT_COND_ALWAYS +#else +#define ALT_COND_PACACHE ALT_COND_NO_SMP +#endif + ENTRY_CFI(flush_tlb_all_local) /* * The pitlbe and pdtlbe instructions should only be used to
@@ -539,15 +545,10 @@ ENTRY_CFI(copy_user_page_asm) /* Purge any old translations */ -#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) - pdtlb,l %r0(%r29) -#else 0: pdtlb %r0(%r28) 1: pdtlb %r0(%r29) - ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) - ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB) -#endif + ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) + ALTERNATIVE(1b, 1b+4, ALT_COND_PACACHE, INSN_PxTLB) #ifdef CONFIG_64BIT /* PA8x00 CPUs can consume 2 loads or 1 store per cycle.
@@ -670,12 +671,8 @@ ENTRY_CFI(clear_user_page_asm) /* Purge any old translation */ -#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) -#else 0: pdtlb %r0(%r28) - ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) -#endif + ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) #ifdef CONFIG_64BIT ldi (PAGE_SIZE / 128), %r1
@@ -736,12 +733,8 @@ ENTRY_CFI(flush_dcache_page_asm) /* Purge any old translation */ -#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) -#else 0: pdtlb %r0(%r28) - ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) -#endif + ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) 88: ldil L%dcache_stride, %r1 ldw R%dcache_stride(%r1), r31
@@ -785,12 +778,8 @@ ENTRY_CFI(purge_dcache_page_asm) /* Purge any old translation */ -#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) -#else 0: pdtlb %r0(%r28) - ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) -#endif + ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) 88: ldil L%dcache_stride, %r1 ldw R%dcache_stride(%r1), r31
@@ -837,17 +826,11 @@ ENTRY_CFI(flush_icache_page_asm) * have a flat address space, it's not clear which TLB will be * used. So, we purge both entries. */ -#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) -1: pitlb,l %r0(%sr4,%r28) - ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SPLIT_TLB, INSN_NOP) -#else 0: pdtlb %r0(%r28) 1: pitlb %r0(%sr4,%r28) - ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) - ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB) + ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) + ALTERNATIVE(1b, 1b+4, ALT_COND_PACACHE, INSN_PxTLB) ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SPLIT_TLB, INSN_NOP) -#endif 88: ldil L%icache_stride, %r1 ldw R%icache_stride(%r1), %r31
Quoted 14 lines · Helge Deller
arch/parisc/kernel/pacache.S +6
-1+#ifdef CONFIG_PA20 +#define ALT_COND_PACACHE ALT_COND_ALWAYS +#else +#define ALT_COND_PACACHE ALT_COND_NO_SMP +#endif + ENTRY_CFI(flush_tlb_all_local) /* * The pitlbe and pdtlbe instructions should only be used to@@ -539,15 +545,10 @@ ENTRY_CFI(copy_user_page_asm) /* Purge any old translations */ -#ifdef CONFIG_PA20
arch/parisc/kernel/pacache.S ENTRY_CFI(copy_user_page_asm) · line 551
Quoted 10 lines
arch/parisc/kernel/pacache.S +2
-6- pdtlb,l %r0(%r28) - pdtlb,l %r0(%r29) -#else 0: pdtlb %r0(%r28) 1: pdtlb %r0(%r29) - ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) - ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB) -#endif + ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) + ALTERNATIVE(1b, 1b+4, ALT_COND_PACACHE, INSN_PxTLB)
This doesn't look correct. If ALT_COND_PACACHE is defined as ALT_COND_NO_SMP, the pdtlb instructions will be converted to pdtlb,l instructions when running UP. These are not supported on PA 1.1. When running SMP, we have pdtlb purges. For these, we need bus serialization.
These also don't look correct:
#define pdtlb(sr, addr) asm volatile("pdtlb 0(%%sr%0,%1)" \
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
: : "i"(sr), "r" (addr) : "memory") #define pitlb(sr, addr) asm volatile("pitlb 0(%%sr%0,%1)" \
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
ALTERNATIVE(ALT_COND_NO_SPLIT_TLB, INSN_NOP) \
: : "i"(sr), "r" (addr) : "memory")
We only have local purge on PA 2.0 machines.
Dave
Signature · 1 line
John David Anglin [email protected]
Helge Deller
maintainerQuoted 14 lines · John David Anglin
Quoted 13 lines · Helge Deller
arch/parisc/kernel/pacache.S +6
-0+#ifdef CONFIG_PA20 +#define ALT_COND_PACACHE ALT_COND_ALWAYS +#else +#define ALT_COND_PACACHE ALT_COND_NO_SMP +#endif +
ENTRY_CFI(flush_tlb_all_local)
/*
* The pitlbe and pdtlbe instructions should only be used toarch/parisc/kernel/pacache.S +0
-0@@ -539,15 +545,10 @@ ENTRY_CFI(copy_user_page_asm) /* Purge any old translations */
Quoted 14 lines
arch/parisc/kernel/pacache.S ENTRY_CFI(copy_user_page_asm) · line 551
Quoted 11 lines
arch/parisc/kernel/pacache.S +2
-7-#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) - pdtlb,l %r0(%r29) -#else 0: pdtlb %r0(%r28) 1: pdtlb %r0(%r29) - ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) - ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB) -#endif + ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) + ALTERNATIVE(1b, 1b+4, ALT_COND_PACACHE, INSN_PxTLB)This doesn't look correct. If
ALT_COND_PACACHEis defined asALT_COND_NO_SMP, the pdtlb instructions will be converted to pdtlb,l instructions when running UP. These are not supported on PA 1.1.
Your concern is correct, but there is an additonal check in the alternative-coding, which prevents enabling the local flag if we're not running on a PA2.0 CPU. So, those ALTERNATIVE() macros will only apply on PA2.0 machines.
Quoted 12 lines
When running SMP, we have pdtlb purges. For these, we need bus serialization.
These also don't look correct:
#define
pdtlb(sr, addr)asm volatile("pdtlb 0(%%sr%0,%1)" \
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB)\
: : "i"(sr), "r" (addr) : "memory")
#definepitlb(sr, addr)asm volatile("pitlb 0(%%sr%0,%1)" \
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB)\
ALTERNATIVE(ALT_COND_NO_SPLIT_TLB, INSN_NOP)\
: : "i"(sr), "r" (addr) : "memory")
Quoted 1 line
We only have local purge on PA 2.0 machines.
Same as above.
Helge
Quoted 30 lines · Helge Deller
Quoted 14 lines · John David Anglin
Quoted 13 lines · Helge Deller
arch/parisc/kernel/pacache.S +6
-0+#ifdef CONFIG_PA20 +#define ALT_COND_PACACHE ALT_COND_ALWAYS +#else +#define ALT_COND_PACACHE ALT_COND_NO_SMP +#endif +ENTRY_CFI(flush_tlb_all_local)
/*
* The pitlbe and pdtlbe instructions should only be used to @@ -539,15 +545,10 @@ ENTRY_CFI(copy_user_page_asm)/* Purge any old translations */
Quoted 14 lines
Quoted 11 lines
arch/parisc/kernel/pacache.S +0
-4-#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) - pdtlb,l %r0(%r29) -#else0: pdtlb %r0(%r28)
1: pdtlb %r0(%r29)
- ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) - ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB) -#endif
+ ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) + ALTERNATIVE(1b, 1b+4, ALT_COND_PACACHE, INSN_PxTLB)This doesn't look correct. If ALT_COND_PACACHE is defined as ALT_COND_NO_SMP, the pdtlb instructions will be converted to pdtlb,l instructions when running UP. These are not supported on PA 1.1.
Quoted 3 lines
Your concern is correct, but there is an additonal check in the alternative-coding, which prevents enabling the local flag if we're not running on a PA2.0 CPU. So, those ALTERNATIVE() macros will only apply on PA2.0 machines.
You are correct. Missed that.
That only leaves the bus serialization issue when pdtlb is used on an SMP machine.
Dave
Signature · 1 line
John David Anglin [email protected]
Helge Deller
maintainerQuoted 31 lines · John David Anglin
Quoted 30 lines · Helge Deller
Quoted 28 lines · John David Anglin
Quoted 17 lines · Helge Deller
arch/parisc/kernel/pacache.S +6
-0+#ifdef CONFIG_PA20 +#define ALT_COND_PACACHE ALT_COND_ALWAYS +#else +#define ALT_COND_PACACHE ALT_COND_NO_SMP +#endif +ENTRY_CFI(flush_tlb_all_local)
/*
* The pitlbe and pdtlbe instructions should only be used to @@ -539,15 +545,10 @@ ENTRY_CFI(copy_user_page_asm)/* Purge any old translations */
arch/parisc/kernel/pacache.S +0
-4-#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) - pdtlb,l %r0(%r29) -#elseQuoted 7 lines
0: pdtlb %r0(%r28)
1: pdtlb %r0(%r29)
- ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) - ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB) -#endif
+ ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) + ALTERNATIVE(1b, 1b+4, ALT_COND_PACACHE, INSN_PxTLB)This doesn't look correct. If ALT_COND_PACACHE is defined as ALT_COND_NO_SMP, the pdtlb instructions will be converted to pdtlb,l instructions when running UP. These are not supported on PA 1.1.
Quoted 6 lines
Quoted 3 lines
Your concern is correct, but there is an additonal check in the alternative-coding, which prevents enabling the local flag if we're not running on a PA2.0 CPU. So, those ALTERNATIVE() macros will only apply on PA2.0 machines.
You are correct. Missed that.
That only leaves the bus serialization issue when pdtlb is used on an SMP machine.
I think we are Ok with what's in the kernel already.
According to arch/parisc/include/asm/pgtable.h:
* This is for the serialization of PxTLB broadcasts. At least on the N class
* systems, only one PxTLB inter processor broadcast can be active at any one
* time on the Merced bus. */
extern spinlock_t pa_tlb_flush_lock;
#if defined(CONFIG_64BIT) && defined(CONFIG_SMP)
extern int pa_serialize_tlb_flushes;
#else
#define pa_serialize_tlb_flushes (0)
#endif
we currently do TLB serialization on 64-bit machines with a 64-bit kernel only. N-class machines are 64-bit-only machines which can't run a 32-bit kernel. So, 32-bit SMP kernels (which don't have serialization for PxTLB flushes) don't seem to be affected.
Helge
Quoted 53 lines · Helge Deller
Quoted 31 lines · John David Anglin
Quoted 30 lines · Helge Deller
Quoted 28 lines · John David Anglin
Quoted 17 lines · Helge Deller
arch/parisc/kernel/pacache.S +6
-0+#ifdef CONFIG_PA20 +#define ALT_COND_PACACHE ALT_COND_ALWAYS +#else +#define ALT_COND_PACACHE ALT_COND_NO_SMP +#endif +ENTRY_CFI(flush_tlb_all_local)
/*
* The pitlbe and pdtlbe instructions should only be used to @@ -539,15 +545,10 @@ ENTRY_CFI(copy_user_page_asm)/* Purge any old translations */
arch/parisc/kernel/pacache.S +0
-4-#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) - pdtlb,l %r0(%r29) -#elseQuoted 7 lines
0: pdtlb %r0(%r28)
1: pdtlb %r0(%r29)
- ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) - ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB) -#endif
+ ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) + ALTERNATIVE(1b, 1b+4, ALT_COND_PACACHE, INSN_PxTLB)This doesn't look correct. If ALT_COND_PACACHE is defined as ALT_COND_NO_SMP, the pdtlb instructions will be converted to pdtlb,l instructions when running UP. These are not supported on PA 1.1.
Quoted 6 lines
Quoted 3 lines
Your concern is correct, but there is an additonal check in the alternative-coding, which prevents enabling the local flag if we're not running on a PA2.0 CPU. So, those ALTERNATIVE() macros will only apply on PA2.0 machines.
You are correct. Missed that.
That only leaves the bus serialization issue when pdtlb is used on an SMP machine.
I think we are Ok with what's in the kernel already.
According to
arch/parisc/include/asm/pgtable.h:* This is for the serialization of PxTLB broadcasts. At least on the N class
* systems, only one PxTLB inter processor broadcast can be active at any one
* time on the Merced bus. */
externspinlock_tpa_tlb_flush_lock;
#ifdefined(CONFIG_64BIT)&&defined(CONFIG_SMP)
extern intpa_serialize_tlb_flushes;
#else
#define pa_serialize_tlb_flushes (0)
#endif
Quoted 4 lines
we currently do TLB serialization on 64-bit machines with a 64-bit kernel only. N-class machines are 64-bit-only machines which can't run a 32-bit kernel. So, 32-bit SMP kernels (which don't have serialization for PxTLB flushes) don't seem to be affected.
I don't know enough to be certain. I know the c8000/rp3440 with the Itanium/zx1 CPU/memory bus needs serialization (tried removing lock). I suspect all machines with Runway or Runway+ CPU/memory buses need serialization.
https://www.openpa.net/bus.html#runway
The openpa site says there are some PA-7200 machines (e.g., D class) with this bus. They would be 32-bit only.
Dave
Signature · 1 line
John David Anglin [email protected]
Helge Deller
maintainerQuoted 59 lines · John David Anglin
Quoted 53 lines · Helge Deller
Quoted 31 lines · John David Anglin
Quoted 30 lines · Helge Deller
Quoted 28 lines · John David Anglin
Quoted 17 lines · Helge Deller
arch/parisc/kernel/pacache.S +6
-0+#ifdef CONFIG_PA20 +#define ALT_COND_PACACHE ALT_COND_ALWAYS +#else +#define ALT_COND_PACACHE ALT_COND_NO_SMP +#endif +ENTRY_CFI(flush_tlb_all_local)
/*
* The pitlbe and pdtlbe instructions should only be used to @@ -539,15 +545,10 @@ ENTRY_CFI(copy_user_page_asm)/* Purge any old translations */
arch/parisc/kernel/pacache.S +0
-4-#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) - pdtlb,l %r0(%r29) -#elseQuoted 7 lines
0: pdtlb %r0(%r28)
1: pdtlb %r0(%r29)
- ALTERNATIVE(0b, 0b+4, ALT_COND_NO_SMP, INSN_PxTLB) - ALTERNATIVE(1b, 1b+4, ALT_COND_NO_SMP, INSN_PxTLB) -#endif
+ ALTERNATIVE(0b, 0b+4, ALT_COND_PACACHE, INSN_PxTLB) + ALTERNATIVE(1b, 1b+4, ALT_COND_PACACHE, INSN_PxTLB)This doesn't look correct. If ALT_COND_PACACHE is defined as ALT_COND_NO_SMP, the pdtlb instructions will be converted to pdtlb,l instructions when running UP. These are not supported on PA 1.1.
Quoted 6 lines
Quoted 3 lines
Your concern is correct, but there is an additonal check in the alternative-coding, which prevents enabling the local flag if we're not running on a PA2.0 CPU. So, those ALTERNATIVE() macros will only apply on PA2.0 machines.
You are correct. Missed that.
That only leaves the bus serialization issue when pdtlb is used on an SMP machine.
I think we are Ok with what's in the kernel already.
According to
arch/parisc/include/asm/pgtable.h:* This is for the serialization of PxTLB broadcasts. At least on the N class
* systems, only one PxTLB inter processor broadcast can be active at any one
* time on the Merced bus. */
externspinlock_tpa_tlb_flush_lock;
#ifdefined(CONFIG_64BIT)&&defined(CONFIG_SMP)
extern intpa_serialize_tlb_flushes;
#else
#define pa_serialize_tlb_flushes (0)
#endifQuoted 4 lines
we currently do TLB serialization on 64-bit machines with a 64-bit kernel only. N-class machines are 64-bit-only machines which can't run a 32-bit kernel. So, 32-bit SMP kernels (which don't have serialization for PxTLB flushes) don't seem to be affected.
Quoted 4 lines
I don't know enough to be certain. I know the c8000/rp3440 with the Itanium/zx1 CPU/memory bus needs serialization (tried removing lock). I suspect all machines with Runway or Runway+ CPU/memory buses need serialization.
https://www.openpa.net/bus.html#runway
Yes, but those all run only 64-bit kernels.
Quoted 1 line
The openpa site says there are some PA-7200 machines (e.g., D class) with this bus. They would be 32-bit only.
I don't have PA-7x00 SMP machines, but a J5000 (https://www.openpa.net/systems/hp-visualize_j5000_j5600_j7000_j7600.html)
with Astro memory/Runway controller on which I can try the 32-bit SMP kernel again.
Helge