* [PATCH] powerpc: Fix demotion of segments to 4K pages
@ 2007-10-29 1:05 Benjamin Herrenschmidt
2007-10-29 1:50 ` Olof Johansson
2007-10-29 2:18 ` Stephen Rothwell
0 siblings, 2 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-29 1:05 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev list
When demoting a process to use 4K HW pages (instead of 64K), which happens
under various circumstances such as doing cache inhibited mappings on
machines that do not support 64K CI pages, the assembly hash code calls
back into the C function flush_hash_page(). This function prototype was
recently changed to accomodate for 1T segments but the assembly call site
was not updated, causing applications that do demotion to hang. In addition,
when updating the per-CPU PACA for the new sizes, we didn't properly
update the slice "map", thus causing the SLB miss code to re-insert
segments for the wrong size.
This fixes both and adds a warning comment next to the C implementation to
try to avoid it next time someone changes it.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
Note that the PACA update bug is also present in 2.6.23, I'll do a patch
for -stable separately, once this one is upstream.
Index: linux-work/arch/powerpc/mm/hash_low_64.S
===================================================================
--- linux-work.orig/arch/powerpc/mm/hash_low_64.S 2007-10-29 10:15:48.000000000 +1100
+++ linux-work/arch/powerpc/mm/hash_low_64.S 2007-10-29 10:22:10.000000000 +1100
@@ -331,7 +331,7 @@ htab_pte_insert_failure:
*****************************************************************************/
/* _hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,
- * pte_t *ptep, unsigned long trap, int local)
+ * pte_t *ptep, unsigned long trap, int local, int ssize)
*/
/*
@@ -557,7 +557,8 @@ htab_inval_old_hpte:
mr r4,r31 /* PTE.pte */
li r5,0 /* PTE.hidx */
li r6,MMU_PAGE_64K /* psize */
- ld r7,STK_PARM(r8)(r1) /* local */
+ ld r7,STK_PARM(r9)(r1) /* ssize */
+ ld r8,STK_PARM(r8)(r1) /* local */
bl .flush_hash_page
b htab_insert_pte
Index: linux-work/arch/powerpc/mm/hash_utils_64.c
===================================================================
--- linux-work.orig/arch/powerpc/mm/hash_utils_64.c 2007-10-29 10:21:55.000000000 +1100
+++ linux-work/arch/powerpc/mm/hash_utils_64.c 2007-10-29 11:57:06.000000000 +1100
@@ -793,8 +793,7 @@ int hash_page(unsigned long ea, unsigned
}
if (user_region) {
if (psize != get_paca()->context.user_psize) {
- get_paca()->context.user_psize =
- mm->context.user_psize;
+ get_paca()->context = mm->context;
slb_flush_and_rebolt();
}
} else if (get_paca()->vmalloc_sllp !=
@@ -887,6 +886,9 @@ void hash_preload(struct mm_struct *mm,
local_irq_restore(flags);
}
+/* WARNING: This is called from hash_low_64.S, if you change this prototype,
+ * do not forget to update the assembly call site !
+ */
void flush_hash_page(unsigned long va, real_pte_t pte, int psize, int ssize,
int local)
{
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] powerpc: Fix demotion of segments to 4K pages
2007-10-29 1:05 [PATCH] powerpc: Fix demotion of segments to 4K pages Benjamin Herrenschmidt
@ 2007-10-29 1:50 ` Olof Johansson
2007-10-29 2:00 ` Benjamin Herrenschmidt
2007-10-29 2:18 ` Stephen Rothwell
1 sibling, 1 reply; 7+ messages in thread
From: Olof Johansson @ 2007-10-29 1:50 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, Paul Mackerras
Hi Ben,
On Mon, Oct 29, 2007 at 12:05:18PM +1100, Benjamin Herrenschmidt wrote:
> @@ -887,6 +886,9 @@ void hash_preload(struct mm_struct *mm,
> local_irq_restore(flags);
> }
>
> +/* WARNING: This is called from hash_low_64.S, if you change this prototype,
> + * do not forget to update the assembly call site !
> + */
Since we're already policing whitespace on this list today: We're normally
not using spaces before exclamation marks.
-Olof
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix demotion of segments to 4K pages
2007-10-29 1:50 ` Olof Johansson
@ 2007-10-29 2:00 ` Benjamin Herrenschmidt
2007-10-29 3:06 ` Olof Johansson
0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-29 2:00 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev list, Paul Mackerras
On Sun, 2007-10-28 at 20:50 -0500, Olof Johansson wrote:
> Hi Ben,
>
> On Mon, Oct 29, 2007 at 12:05:18PM +1100, Benjamin Herrenschmidt wrote:
> > @@ -887,6 +886,9 @@ void hash_preload(struct mm_struct *mm,
> > local_irq_restore(flags);
> > }
> >
> > +/* WARNING: This is called from hash_low_64.S, if you change this prototype,
> > + * do not forget to update the assembly call site !
> > + */
>
> Since we're already policing whitespace on this list today: We're normally
> not using spaces before exclamation marks.
And I don't care, I will continue adding them because the opposite is
fugly :-)
There is a limit to what I accept from the style police, it's not like
Linux has to look like it's written by a single person either.
Ben.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix demotion of segments to 4K pages
2007-10-29 2:00 ` Benjamin Herrenschmidt
@ 2007-10-29 3:06 ` Olof Johansson
2007-10-29 3:24 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 7+ messages in thread
From: Olof Johansson @ 2007-10-29 3:06 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, Paul Mackerras
On Mon, Oct 29, 2007 at 01:00:29PM +1100, Benjamin Herrenschmidt wrote:
> On Sun, 2007-10-28 at 20:50 -0500, Olof Johansson wrote:
> > Hi Ben,
> >
> > On Mon, Oct 29, 2007 at 12:05:18PM +1100, Benjamin Herrenschmidt wrote:
> > > @@ -887,6 +886,9 @@ void hash_preload(struct mm_struct *mm,
> > > local_irq_restore(flags);
> > > }
> > >
> > > +/* WARNING: This is called from hash_low_64.S, if you change this prototype,
> > > + * do not forget to update the assembly call site !
> > > + */
> >
> > Since we're already policing whitespace on this list today: We're normally
> > not using spaces before exclamation marks.
>
> And I don't care, I will continue adding them because the opposite is
> fugly :-)
Yeah , I know what you mean . This looks so much more natural .
> There is a limit to what I accept from the style police, it's not like
> Linux has to look like it's written by a single person either.
Good one ! That one goes to the bookmark list . :-)
I agree though , whitespace policing tends to be counter-productive ,
together with (minor) grammar and spelling errors in comments . Still,
people love to point them out so I figured I would do it too .
- Olof
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix demotion of segments to 4K pages
2007-10-29 3:06 ` Olof Johansson
@ 2007-10-29 3:24 ` Benjamin Herrenschmidt
2007-10-29 8:32 ` Geert Uytterhoeven
0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-29 3:24 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev list, Paul Mackerras
On Sun, 2007-10-28 at 22:06 -0500, Olof Johansson wrote:
> > And I don't care, I will continue adding them because the opposite
> is
> > fugly :-)
>
> Yeah , I know what you mean . This looks so much more natural .
Who said it has to be consistent ? :-)
I use spaces before ? and ! mostly. In fact, it might even be the rule
in french, I'm not too sure :-)
Ben.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix demotion of segments to 4K pages
2007-10-29 3:24 ` Benjamin Herrenschmidt
@ 2007-10-29 8:32 ` Geert Uytterhoeven
0 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2007-10-29 8:32 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Olof Johansson, linuxppc-dev list, Paul Mackerras
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1148 bytes --]
On Mon, 29 Oct 2007, Benjamin Herrenschmidt wrote:
> On Sun, 2007-10-28 at 22:06 -0500, Olof Johansson wrote:
> > > And I don't care, I will continue adding them because the opposite
> > is
> > > fugly :-)
> >
> > Yeah , I know what you mean . This looks so much more natural .
>
> Who said it has to be consistent ? :-)
>
> I use spaces before ? and ! mostly. In fact, it might even be the rule
> in french, I'm not too sure :-)
Yes it is http://en.wikipedia.org/wiki/Punctuation_in_French ;-)
C'est permis, mais seulement en Français ;-)
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix demotion of segments to 4K pages
2007-10-29 1:05 [PATCH] powerpc: Fix demotion of segments to 4K pages Benjamin Herrenschmidt
2007-10-29 1:50 ` Olof Johansson
@ 2007-10-29 2:18 ` Stephen Rothwell
1 sibling, 0 replies; 7+ messages in thread
From: Stephen Rothwell @ 2007-10-29 2:18 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev list, Paul Mackerras
[-- Attachment #1: Type: text/plain, Size: 255 bytes --]
On Mon, 29 Oct 2007 12:05:18 +1100 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
Just to be fair to Olof, "diffstats are good" ...
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-10-29 8:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-29 1:05 [PATCH] powerpc: Fix demotion of segments to 4K pages Benjamin Herrenschmidt
2007-10-29 1:50 ` Olof Johansson
2007-10-29 2:00 ` Benjamin Herrenschmidt
2007-10-29 3:06 ` Olof Johansson
2007-10-29 3:24 ` Benjamin Herrenschmidt
2007-10-29 8:32 ` Geert Uytterhoeven
2007-10-29 2:18 ` Stephen Rothwell
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).