LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [POWERPC] 8xx: fix swap
@ 2008-03-06 10:53 Vitaly Bordug
  2008-03-06 15:56 ` Kumar Gala
  2008-03-07 14:46 ` Kumar Gala
  0 siblings, 2 replies; 6+ messages in thread
From: Vitaly Bordug @ 2008-03-06 10:53 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, LKML

This makes swap routines operate correctly on the ppc_8xx based machines.
Code has been revalidated on mpc885ads (8M sdram) with recent kernel. Based
on patch from Yuri Tikhonov <yur@emcraft.com> to do the same on arch/ppc
instance.

Recent kernel's size makes swap feature very important on low-memory platforms,
those are actually non-operable without it.

Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
---

 arch/powerpc/kernel/head_8xx.S      |   30 +++++++++++++++++++++++++++++-
 include/asm-powerpc/pgtable-ppc32.h |    8 --------
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index f745839..3c9452d 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -332,8 +332,18 @@ InstructionTLBMiss:
 	mfspr	r11, SPRN_MD_TWC	/* ....and get the pte address */
 	lwz	r10, 0(r11)	/* Get the pte */
 
+#ifdef CONFIG_SWAP
+	/* do not set the _PAGE_ACCESSED bit of a non-present page */
+	andi.	r11, r10, _PAGE_PRESENT
+	beq	4f
+	ori	r10, r10, _PAGE_ACCESSED
+	mfspr	r11, SPRN_MD_TWC	/* get the pte address again */
+	stw	r10, 0(r11)
+4:
+#else
 	ori	r10, r10, _PAGE_ACCESSED
 	stw	r10, 0(r11)
+#endif
 
 	/* The Linux PTE won't go exactly into the MMU TLB.
 	 * Software indicator bits 21, 22 and 28 must be clear.
@@ -398,8 +408,17 @@ DataStoreTLBMiss:
 	DO_8xx_CPU6(0x3b80, r3)
 	mtspr	SPRN_MD_TWC, r11
 
-	mfspr	r11, SPRN_MD_TWC	/* get the pte address again */
+#ifdef CONFIG_SWAP
+	/* do not set the _PAGE_ACCESSED bit of a non-present page */
+	andi.	r11, r10, _PAGE_PRESENT
+	beq	4f
 	ori	r10, r10, _PAGE_ACCESSED
+4:
+	/* and update pte in table */
+#else
+	ori	r10, r10, _PAGE_ACCESSED
+#endif
+	mfspr	r11, SPRN_MD_TWC	/* get the pte address again */
 	stw	r10, 0(r11)
 
 	/* The Linux PTE won't go exactly into the MMU TLB.
@@ -507,7 +526,16 @@ DataTLBError:
 
 	/* Update 'changed', among others.
 	*/
+#ifdef CONFIG_SWAP
+	ori	r10, r10, _PAGE_DIRTY|_PAGE_HWWRITE
+	/* do not set the _PAGE_ACCESSED bit of a non-present page */
+	andi.	r11, r10, _PAGE_PRESENT
+	beq	4f
+	ori	r10, r10, _PAGE_ACCESSED
+4:
+#else
 	ori	r10, r10, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
+#endif
 	mfspr	r11, SPRN_MD_TWC		/* Get pte address again */
 	stw	r10, 0(r11)		/* and update pte in table */
 
diff --git a/include/asm-powerpc/pgtable-ppc32.h b/include/asm-powerpc/pgtable-ppc32.h
index d1332bb..2c79f55 100644
--- a/include/asm-powerpc/pgtable-ppc32.h
+++ b/include/asm-powerpc/pgtable-ppc32.h
@@ -339,14 +339,6 @@ extern int icache_44x_need_flush;
 #define _PMD_PAGE_MASK	0x000c
 #define _PMD_PAGE_8M	0x000c
 
-/*
- * The 8xx TLB miss handler allegedly sets _PAGE_ACCESSED in the PTE
- * for an address even if _PAGE_PRESENT is not set, as a performance
- * optimization.  This is a bug if you ever want to use swap unless
- * _PAGE_ACCESSED is 2, which it isn't, or unless you have 8xx-specific
- * definitions for __swp_entry etc. below, which would be gross.
- *  -- paulus
- */
 #define _PTE_NONE_MASK _PAGE_ACCESSED
 
 #else /* CONFIG_6xx */


-- 
Sincerely, 
Vitaly

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [POWERPC] 8xx: fix swap
  2008-03-06 10:53 [POWERPC] 8xx: fix swap Vitaly Bordug
@ 2008-03-06 15:56 ` Kumar Gala
  2008-03-06 16:05   ` Scott Wood
                     ` (2 more replies)
  2008-03-07 14:46 ` Kumar Gala
  1 sibling, 3 replies; 6+ messages in thread
From: Kumar Gala @ 2008-03-06 15:56 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: Paul Mackerras, linuxppc-dev, LKML


On Mar 6, 2008, at 4:53 AM, Vitaly Bordug wrote:

> This makes swap routines operate correctly on the ppc_8xx based  
> machines.
> Code has been revalidated on mpc885ads (8M sdram) with recent  
> kernel. Based
> on patch from Yuri Tikhonov <yur@emcraft.com> to do the same on arch/ 
> ppc
> instance.
>
> Recent kernel's size makes swap feature very important on low-memory  
> platforms,
> those are actually non-operable without it.
>
> Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> ---
>
> arch/powerpc/kernel/head_8xx.S      |   30 ++++++++++++++++++++++++++ 
> +++-
> include/asm-powerpc/pgtable-ppc32.h |    8 --------
> 2 files changed, 29 insertions(+), 9 deletions(-)

do we need similar fixes to arch/ppc ?

- k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [POWERPC] 8xx: fix swap
  2008-03-06 15:56 ` Kumar Gala
@ 2008-03-06 16:05   ` Scott Wood
  2008-03-06 16:09   ` Vitaly Bordug
  2008-03-06 16:12   ` Segher Boessenkool
  2 siblings, 0 replies; 6+ messages in thread
From: Scott Wood @ 2008-03-06 16:05 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Vitaly Bordug, linuxppc-dev, Paul Mackerras, LKML

On Thu, Mar 06, 2008 at 09:56:58AM -0600, Kumar Gala wrote:
> On Mar 6, 2008, at 4:53 AM, Vitaly Bordug wrote:
> > arch/powerpc/kernel/head_8xx.S      |   30 ++++++++++++++++++++++++++ 
> > +++-
> > include/asm-powerpc/pgtable-ppc32.h |    8 --------
> > 2 files changed, 29 insertions(+), 9 deletions(-)
> 
> do we need similar fixes to arch/ppc ?

Yes, a patch was posted a while ago.

-Scott

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [POWERPC] 8xx: fix swap
  2008-03-06 15:56 ` Kumar Gala
  2008-03-06 16:05   ` Scott Wood
@ 2008-03-06 16:09   ` Vitaly Bordug
  2008-03-06 16:12   ` Segher Boessenkool
  2 siblings, 0 replies; 6+ messages in thread
From: Vitaly Bordug @ 2008-03-06 16:09 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Paul Mackerras, linuxppc-dev, LKML

On Thu, 6 Mar 2008 09:56:58 -0600
Kumar Gala wrote:

> 
> On Mar 6, 2008, at 4:53 AM, Vitaly Bordug wrote:
> 
> > This makes swap routines operate correctly on the ppc_8xx based  
> > machines.
> > Code has been revalidated on mpc885ads (8M sdram) with recent  
> > kernel. Based
> > on patch from Yuri Tikhonov <yur@emcraft.com> to do the same on
> > arch/ ppc
> > instance.
> >
> > Recent kernel's size makes swap feature very important on
> > low-memory platforms,
> > those are actually non-operable without it.
> >
> > Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
> > Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> > ---
> >
> > arch/powerpc/kernel/head_8xx.S      |   30
> > ++++++++++++++++++++++++++ +++-
> > include/asm-powerpc/pgtable-ppc32.h |    8 --------
> > 2 files changed, 29 insertions(+), 9 deletions(-)
> 
> do we need similar fixes to arch/ppc ?
> 
there's patch from Yuri that does it for ppc/ - I guess you may just pick it up and place to your tree.

-- 
Sincerely, Vitaly

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [POWERPC] 8xx: fix swap
  2008-03-06 15:56 ` Kumar Gala
  2008-03-06 16:05   ` Scott Wood
  2008-03-06 16:09   ` Vitaly Bordug
@ 2008-03-06 16:12   ` Segher Boessenkool
  2 siblings, 0 replies; 6+ messages in thread
From: Segher Boessenkool @ 2008-03-06 16:12 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras, Vitaly Bordug, LKML

> do we need similar fixes to arch/ppc ?

Do we care?

arch/ppc needs many fixes, when you have implemented all of that, you
get a clone of arch/powerpc ;-)


Segher


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [POWERPC] 8xx: fix swap
  2008-03-06 10:53 [POWERPC] 8xx: fix swap Vitaly Bordug
  2008-03-06 15:56 ` Kumar Gala
@ 2008-03-07 14:46 ` Kumar Gala
  1 sibling, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2008-03-07 14:46 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: Paul Mackerras, linuxppc-dev, LKML


On Mar 6, 2008, at 4:53 AM, Vitaly Bordug wrote:

> This makes swap routines operate correctly on the ppc_8xx based  
> machines.
> Code has been revalidated on mpc885ads (8M sdram) with recent  
> kernel. Based
> on patch from Yuri Tikhonov <yur@emcraft.com> to do the same on arch/ 
> ppc
> instance.
>
> Recent kernel's size makes swap feature very important on low-memory  
> platforms,
> those are actually non-operable without it.
>
> Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> ---
>
> arch/powerpc/kernel/head_8xx.S      |   30 ++++++++++++++++++++++++++ 
> +++-
> include/asm-powerpc/pgtable-ppc32.h |    8 --------
> 2 files changed, 29 insertions(+), 9 deletions(-)

applied.

- k


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-03-07 14:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-06 10:53 [POWERPC] 8xx: fix swap Vitaly Bordug
2008-03-06 15:56 ` Kumar Gala
2008-03-06 16:05   ` Scott Wood
2008-03-06 16:09   ` Vitaly Bordug
2008-03-06 16:12   ` Segher Boessenkool
2008-03-07 14:46 ` Kumar Gala

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).