* [Qemu-devel] [PATCH 2/2] ppc: Fix tlb invalidations on 6xx/7xx/7xxx 32-bit processors
@ 2016-06-06 9:52 Benjamin Herrenschmidt
2016-06-06 10:47 ` Cédric Le Goater
2016-06-07 1:40 ` David Gibson
0 siblings, 2 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2016-06-06 9:52 UTC (permalink / raw)
To: qemu-ppc
Cc: qemu-devel, David Gibson, Cédric Le Goater, Mark Cave-Ayland
The processor only uses some bits of the address and invalidates an
entire congruence class. Some OSes such as Darwin and HelenOS take
advantage of this and occasionally invalidate the entire TLB by just
doing a series of 64 consecutive tlbie for example.
Our code tries to be too smart here only invalidating a segment
congruence class (ie, allowing more address bits to be relevant
in the invalidation), this fails miserably on those OSes.
Instead don't bother, do like ppc64 and blow the whole tlb when tlbie
is executed.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
target-ppc/mmu_helper.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index f5c4e69..a5e3878 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -1969,6 +1969,11 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr)
/* XXX: this case should be optimized,
* giving a mask to tlb_flush_page
*/
+ /* This is broken, some CPUs invalidate a whole congruence
+ * class on an even smaller subset of bits and some OSes take
+ * advantage of this. Just blow the whole thing away.
+ */
+#if 0
tlb_flush_page(cs, addr | (0x0 << 28));
tlb_flush_page(cs, addr | (0x1 << 28));
tlb_flush_page(cs, addr | (0x2 << 28));
@@ -1985,6 +1990,9 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr)
tlb_flush_page(cs, addr | (0xD << 28));
tlb_flush_page(cs, addr | (0xE << 28));
tlb_flush_page(cs, addr | (0xF << 28));
+#else
+ tlb_flush(cs, 1);
+#endif
break;
#if defined(TARGET_PPC64)
case POWERPC_MMU_64B:
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] ppc: Fix tlb invalidations on 6xx/7xx/7xxx 32-bit processors
2016-06-06 9:52 [Qemu-devel] [PATCH 2/2] ppc: Fix tlb invalidations on 6xx/7xx/7xxx 32-bit processors Benjamin Herrenschmidt
@ 2016-06-06 10:47 ` Cédric Le Goater
2016-06-07 1:40 ` David Gibson
1 sibling, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2016-06-06 10:47 UTC (permalink / raw)
To: benh, qemu-ppc; +Cc: qemu-devel, David Gibson, Mark Cave-Ayland
On 06/06/2016 11:52 AM, Benjamin Herrenschmidt wrote:
> The processor only uses some bits of the address and invalidates an
> entire congruence class. Some OSes such as Darwin and HelenOS take
> advantage of this and occasionally invalidate the entire TLB by just
> doing a series of 64 consecutive tlbie for example.
>
> Our code tries to be too smart here only invalidating a segment
> congruence class (ie, allowing more address bits to be relevant
> in the invalidation), this fails miserably on those OSes.
>
> Instead don't bother, do like ppc64 and blow the whole tlb when tlbie
> is executed.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Looks good on G3 and G4 running macosx10.2 and macosx10.4.
Tested-by: Cédric Le Goater <clg@kaod.org>
> ---
> target-ppc/mmu_helper.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
> index f5c4e69..a5e3878 100644
> --- a/target-ppc/mmu_helper.c
> +++ b/target-ppc/mmu_helper.c
> @@ -1969,6 +1969,11 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr)
> /* XXX: this case should be optimized,
> * giving a mask to tlb_flush_page
> */
> + /* This is broken, some CPUs invalidate a whole congruence
> + * class on an even smaller subset of bits and some OSes take
> + * advantage of this. Just blow the whole thing away.
> + */
> +#if 0
> tlb_flush_page(cs, addr | (0x0 << 28));
> tlb_flush_page(cs, addr | (0x1 << 28));
> tlb_flush_page(cs, addr | (0x2 << 28));
> @@ -1985,6 +1990,9 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr)
> tlb_flush_page(cs, addr | (0xD << 28));
> tlb_flush_page(cs, addr | (0xE << 28));
> tlb_flush_page(cs, addr | (0xF << 28));
> +#else
> + tlb_flush(cs, 1);
> +#endif
> break;
> #if defined(TARGET_PPC64)
> case POWERPC_MMU_64B:
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] ppc: Fix tlb invalidations on 6xx/7xx/7xxx 32-bit processors
2016-06-06 9:52 [Qemu-devel] [PATCH 2/2] ppc: Fix tlb invalidations on 6xx/7xx/7xxx 32-bit processors Benjamin Herrenschmidt
2016-06-06 10:47 ` Cédric Le Goater
@ 2016-06-07 1:40 ` David Gibson
2016-06-07 2:14 ` Benjamin Herrenschmidt
1 sibling, 1 reply; 4+ messages in thread
From: David Gibson @ 2016-06-07 1:40 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: qemu-ppc, qemu-devel, Cédric Le Goater, Mark Cave-Ayland
[-- Attachment #1: Type: text/plain, Size: 2412 bytes --]
On Mon, Jun 06, 2016 at 07:52:48PM +1000, Benjamin Herrenschmidt wrote:
> The processor only uses some bits of the address and invalidates an
> entire congruence class. Some OSes such as Darwin and HelenOS take
> advantage of this and occasionally invalidate the entire TLB by just
> doing a series of 64 consecutive tlbie for example.
>
> Our code tries to be too smart here only invalidating a segment
> congruence class (ie, allowing more address bits to be relevant
> in the invalidation), this fails miserably on those OSes.
>
> Instead don't bother, do like ppc64 and blow the whole tlb when tlbie
> is executed.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Ugh, this patch too is showing as corrupt for me. I suspect the
problem is on my end, but I have no idea what, yet.
The concept looks good here, but I don't see much point to keeping the
old broken code around under the #if 0. I'll rewite accordingly and merge.
> ---
> target-ppc/mmu_helper.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
> index f5c4e69..a5e3878 100644
> --- a/target-ppc/mmu_helper.c
> +++ b/target-ppc/mmu_helper.c
> @@ -1969,6 +1969,11 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr)
> /* XXX: this case should be optimized,
> * giving a mask to tlb_flush_page
> */
> + /* This is broken, some CPUs invalidate a whole congruence
> + * class on an even smaller subset of bits and some OSes take
> + * advantage of this. Just blow the whole thing away.
> + */
> +#if 0
> tlb_flush_page(cs, addr | (0x0 << 28));
> tlb_flush_page(cs, addr | (0x1 << 28));
> tlb_flush_page(cs, addr | (0x2 << 28));
> @@ -1985,6 +1990,9 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr)
> tlb_flush_page(cs, addr | (0xD << 28));
> tlb_flush_page(cs, addr | (0xE << 28));
> tlb_flush_page(cs, addr | (0xF << 28));
> +#else
> + tlb_flush(cs, 1);
> +#endif
> break;
> #if defined(TARGET_PPC64)
> case POWERPC_MMU_64B:
>
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] ppc: Fix tlb invalidations on 6xx/7xx/7xxx 32-bit processors
2016-06-07 1:40 ` David Gibson
@ 2016-06-07 2:14 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2016-06-07 2:14 UTC (permalink / raw)
To: David Gibson
Cc: qemu-ppc, qemu-devel, Cédric Le Goater, Mark Cave-Ayland
On Tue, 2016-06-07 at 11:40 +1000, David Gibson wrote:
> Ugh, this patch too is showing as corrupt for me. I suspect the
> problem is on my end, but I have no idea what, yet.
No it's on mine. The latest update of evolution in Fedora broke sending
patches :-(
It unconditionally replaces 2 or more consecutive spaces with some
unicode non-breakable space character even in text/plain and preformat
mode. Ugh...
I'll resend the whole lot later today using git-send-email
> The concept looks good here, but I don't see much point to keeping the
> old broken code around under the #if 0. I'll rewite accordingly and merge.
Don't bother, my next patch that does the batching takes it out.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-07 2:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-06 9:52 [Qemu-devel] [PATCH 2/2] ppc: Fix tlb invalidations on 6xx/7xx/7xxx 32-bit processors Benjamin Herrenschmidt
2016-06-06 10:47 ` Cédric Le Goater
2016-06-07 1:40 ` David Gibson
2016-06-07 2:14 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).