Re: [POWERPC] 8xx: fix swap

Previous thread: [PATCH] fix xt_time_match() never matches on Sundays by Andrew Schulman on Thursday, March 6, 2008 - 6:53 am. (1 message)

Next thread: 2.6.25-rc4: crash on boot when SMP enabled by Pavel Machek on Thursday, March 6, 2008 - 6:29 am. (12 messages)
To: Paul Mackerras <paulus@...>
Cc: linuxppc-dev <linuxppc-dev@...>, LKML <linux-kernel@...>
Date: Thursday, March 6, 2008 - 6:53 am

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

To: Vitaly Bordug <vitb@...>
Cc: Paul Mackerras <paulus@...>, linuxppc-dev <linuxppc-dev@...>, LKML <linux-kernel@...>
Date: Friday, March 7, 2008 - 10:46 am

applied.

- k

--

To: Vitaly Bordug <vitb@...>
Cc: Paul Mackerras <paulus@...>, linuxppc-dev <linuxppc-dev@...>, LKML <linux-kernel@...>
Date: Thursday, March 6, 2008 - 11:56 am

do we need similar fixes to arch/ppc ?

- k
--

To: Kumar Gala <galak@...>
Cc: Vitaly Bordug <vitb@...>, linuxppc-dev <linuxppc-dev@...>, Paul Mackerras <paulus@...>, LKML <linux-kernel@...>
Date: Thursday, March 6, 2008 - 12:05 pm

Yes, a patch was posted a while ago.

-Scott
--

To: Kumar Gala <galak@...>
Cc: linuxppc-dev <linuxppc-dev@...>, Paul Mackerras <paulus@...>, Vitaly Bordug <vitb@...>, LKML <linux-kernel@...>
Date: Thursday, March 6, 2008 - 12:12 pm

> 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

--

To: Kumar Gala <galak@...>
Cc: Paul Mackerras <paulus@...>, linuxppc-dev <linuxppc-dev@...>, LKML <linux-kernel@...>
Date: Thursday, March 6, 2008 - 12:09 pm

On Thu, 6 Mar 2008 09:56:58 -0600
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
--

Previous thread: [PATCH] fix xt_time_match() never matches on Sundays by Andrew Schulman on Thursday, March 6, 2008 - 6:53 am. (1 message)

Next thread: 2.6.25-rc4: crash on boot when SMP enabled by Pavel Machek on Thursday, March 6, 2008 - 6:29 am. (12 messages)