All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Yuri Tikhonov <yur@emcraft.com>
Cc: linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH 1/1] [PPC] 8xx swap bug-fix
Date: Tue, 05 Feb 2008 18:37:07 +1100	[thread overview]
Message-ID: <1202197027.7079.57.camel@pasglop> (raw)
In-Reply-To: <200802021047.32055.yur@emcraft.com>


On Sat, 2008-02-02 at 10:47 +0300, Yuri Tikhonov wrote:
> Hello,
> 
>  Here is the patch which makes Linux-2.6 swap routines operate correctly on
> the ppc-8xx-based machines.

Best is to just remove writeback completely and let the generic
code handle it.

Ben.

> Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
> --
> diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S
> index eb8d26f..321bda2 100644
> --- a/arch/ppc/kernel/head_8xx.S
> +++ b/arch/ppc/kernel/head_8xx.S
> @@ -329,8 +329,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.
> @@ -395,8 +405,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.
> @@ -575,7 +594,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-ppc/pgtable.h b/include/asm-ppc/pgtable.h
> index c159315..76717ff 100644
> --- a/include/asm-ppc/pgtable.h
> +++ b/include/asm-ppc/pgtable.h
> @@ -341,14 +341,6 @@ extern unsigned long ioremap_bot, ioremap_base;
>  #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 */
> 

  parent reply	other threads:[~2008-02-05  7:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-02  0:10 [PATCH 3/3] powerpc: mpc83xx_defconfig: enable math emulation and ucc_geth Kim Phillips
2008-02-02  7:47 ` [PATCH 1/1] [PPC] 8xx swap bug-fix Yuri Tikhonov
2008-02-02 11:22   ` Jochen Friedrich
2008-02-02 11:30     ` Yuri Tikhonov
2008-02-04 18:24     ` Scott Wood
2008-02-04 22:38       ` Vitaly Bordug
2008-02-21 12:21         ` Wolfgang Denk
2008-02-21 22:57           ` Vitaly Bordug
2008-02-05  6:46       ` Yuri Tikhonov
2008-02-05 10:01         ` Jochen Friedrich
2008-02-05  7:37   ` Benjamin Herrenschmidt [this message]
2008-03-10 14:39   ` Kumar Gala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1202197027.7079.57.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    --cc=yur@emcraft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.