linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Check _PAGE_RW and _PAGE_PRESENT on kernel addresses.
@ 2007-08-21 21:10 Scott Wood
  2007-08-22  3:52 ` Paul Mackerras
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Wood @ 2007-08-21 21:10 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Previously, the TLB miss handlers assumed that pages above KERNELBASE are
always present and read/write.  This assumption is false in the case of
CONFIG_DEBUG_PAGEALLOC.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/kernel/head_32.S |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 7d73a13..2d3b804 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -475,10 +475,10 @@ InstructionTLBMiss:
 	li	r1,_PAGE_USER|_PAGE_PRESENT /* low addresses tested as user */
 	lwz	r2,PGDIR(r2)
 	blt+	112f
+	mfspr	r2,SPRN_SRR1		/* and MSR_PR bit from SRR1 */
+	rlwinm	r1,r2,32-12,29,29	/* shift MSR_PR to _PAGE_USER posn */
 	lis	r2,swapper_pg_dir@ha	/* if kernel address, use */
 	addi	r2,r2,swapper_pg_dir@l	/* kernel page table */
-	mfspr	r1,SPRN_SRR1		/* and MSR_PR bit from SRR1 */
-	rlwinm	r1,r1,32-12,29,29	/* shift MSR_PR to _PAGE_USER posn */
 112:	tophys(r2,r2)
 	rlwimi	r2,r3,12,20,29		/* insert top 10 bits of address */
 	lwz	r2,0(r2)		/* get pmd entry */
@@ -549,10 +549,10 @@ DataLoadTLBMiss:
 	li	r1,_PAGE_USER|_PAGE_PRESENT /* low addresses tested as user */
 	lwz	r2,PGDIR(r2)
 	blt+	112f
+	mfspr	r2,SPRN_SRR1		/* and MSR_PR bit from SRR1 */
+	rlwinm	r1,r2,32-12,29,29	/* shift MSR_PR to _PAGE_USER posn */
 	lis	r2,swapper_pg_dir@ha	/* if kernel address, use */
 	addi	r2,r2,swapper_pg_dir@l	/* kernel page table */
-	mfspr	r1,SPRN_SRR1		/* and MSR_PR bit from SRR1 */
-	rlwinm	r1,r1,32-12,29,29	/* shift MSR_PR to _PAGE_USER posn */
 112:	tophys(r2,r2)
 	rlwimi	r2,r3,12,20,29		/* insert top 10 bits of address */
 	lwz	r2,0(r2)		/* get pmd entry */
@@ -621,10 +621,10 @@ DataStoreTLBMiss:
 	li	r1,_PAGE_RW|_PAGE_USER|_PAGE_PRESENT /* access flags */
 	lwz	r2,PGDIR(r2)
 	blt+	112f
+	mfspr	r2,SPRN_SRR1		/* and MSR_PR bit from SRR1 */
+	rlwimi	r1,r2,32-12,29,29	/* shift MSR_PR to _PAGE_USER posn */
 	lis	r2,swapper_pg_dir@ha	/* if kernel address, use */
 	addi	r2,r2,swapper_pg_dir@l	/* kernel page table */
-	mfspr	r1,SPRN_SRR1		/* and MSR_PR bit from SRR1 */
-	rlwinm	r1,r1,32-12,29,29	/* shift MSR_PR to _PAGE_USER posn */
 112:	tophys(r2,r2)
 	rlwimi	r2,r3,12,20,29		/* insert top 10 bits of address */
 	lwz	r2,0(r2)		/* get pmd entry */
-- 
1.5.0.3

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

* Re: [PATCH] Check _PAGE_RW and _PAGE_PRESENT on kernel addresses.
  2007-08-21 21:10 [PATCH] Check _PAGE_RW and _PAGE_PRESENT on kernel addresses Scott Wood
@ 2007-08-22  3:52 ` Paul Mackerras
  2007-08-22  4:22   ` Scott Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Mackerras @ 2007-08-22  3:52 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev

Scott Wood writes:

> Previously, the TLB miss handlers assumed that pages above KERNELBASE are
> always present and read/write.  This assumption is false in the case of
> CONFIG_DEBUG_PAGEALLOC.

>  	blt+	112f
> +	mfspr	r2,SPRN_SRR1		/* and MSR_PR bit from SRR1 */
> +	rlwinm	r1,r2,32-12,29,29	/* shift MSR_PR to _PAGE_USER posn */
>  	lis	r2,swapper_pg_dir@ha	/* if kernel address, use */
>  	addi	r2,r2,swapper_pg_dir@l	/* kernel page table */
> -	mfspr	r1,SPRN_SRR1		/* and MSR_PR bit from SRR1 */
> -	rlwinm	r1,r1,32-12,29,29	/* shift MSR_PR to _PAGE_USER posn */

I don't see that just moving those two lines up changes anything.  If
you turned the rlwinm into an rlwimi (as you did in the DataStoreTLBMiss
case) then it might make more sense.  Is this just an oversight?

Paul.

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

* Re: [PATCH] Check _PAGE_RW and _PAGE_PRESENT on kernel addresses.
  2007-08-22  3:52 ` Paul Mackerras
@ 2007-08-22  4:22   ` Scott Wood
  0 siblings, 0 replies; 3+ messages in thread
From: Scott Wood @ 2007-08-22  4:22 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

On Wed, Aug 22, 2007 at 01:52:49PM +1000, Paul Mackerras wrote:
> Scott Wood writes:
> 
> > Previously, the TLB miss handlers assumed that pages above KERNELBASE are
> > always present and read/write.  This assumption is false in the case of
> > CONFIG_DEBUG_PAGEALLOC.
> 
> >  	blt+	112f
> > +	mfspr	r2,SPRN_SRR1		/* and MSR_PR bit from SRR1 */
> > +	rlwinm	r1,r2,32-12,29,29	/* shift MSR_PR to _PAGE_USER posn */
> >  	lis	r2,swapper_pg_dir@ha	/* if kernel address, use */
> >  	addi	r2,r2,swapper_pg_dir@l	/* kernel page table */
> > -	mfspr	r1,SPRN_SRR1		/* and MSR_PR bit from SRR1 */
> > -	rlwinm	r1,r1,32-12,29,29	/* shift MSR_PR to _PAGE_USER posn */
> 
> I don't see that just moving those two lines up changes anything.  If
> you turned the rlwinm into an rlwimi (as you did in the DataStoreTLBMiss
> case) then it might make more sense.  Is this just an oversight?

Sorry, rlwimi was what I meant...

The data store path was what I found the problem and tested with, the
others were an apparently botched replication to the other handlers.

-Scott

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

end of thread, other threads:[~2007-08-22  4:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-21 21:10 [PATCH] Check _PAGE_RW and _PAGE_PRESENT on kernel addresses Scott Wood
2007-08-22  3:52 ` Paul Mackerras
2007-08-22  4:22   ` Scott Wood

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