From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Scott Wood <scottwood@freescale.com>,
"linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>,
Rex Feany <RFeany@mrv.com>
Subject: Re: [PATCH 3/6] 8xx: get rid of _PAGE_HWWRITE dependency in MMU.
Date: Tue, 6 Oct 2009 00:00:22 +0200 [thread overview]
Message-ID: <OF16069D5F.03682AAC-ONC1257646.00774BB8-C1257646.0078E24B@transmode.se> (raw)
In-Reply-To: <1254778643.7122.43.camel@pasglop>
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote on 05/10/2009 23:37:23:
>
> On Mon, 2009-10-05 at 23:25 +0200, Joakim Tjernlund wrote:
> >
> > Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote on 05/10/2009 22:17:04:
> > >
> > > On Mon, 2009-10-05 at 14:16 +0200, Joakim Tjernlund wrote:
> > > > Update the TLB asm to make proper use of _PAGE_DIRY and _PAGE_ACCESSED.
> > > > Pros:
> > > > - I/D TLB Miss never needs to write to the linux pte.
> > > > - _PAGE_ACCESSED is only set on I/D TLB Error fixing accounting
> > > > - _PAGE_DIRTY is mapped to 0x100, the changed bit, and is set directly
> > > > when a page has been made dirty.
> > >
> > > Not sure here. You seem to still set those from asm. Is that necessary ?
> >
> > Well, yes. head_32.S also sets ACCESSED and DIRTY from asm so why not me?
>
> Don't look at the hash 32 code :-)
So what to look at then? :)
>
> > The basic method I use is:
> > TLB gets mapped with NoAccess, then the first access will trap
> > into TLB error, where ACCESSED will be set if permission to access
> > the page is OK (and RW too). On first store 8xx will trap
> > into DTLB error and permissions is OK, DIRTY will be set too.
> > Is this wrong?
>
> >From your explanation it looks ok. IE. as long as !DIRTY -> not
> writeable (will fault on store) and !ACCESSED means not accessible (will
> fault on any access) then you are ok.
Yes, that is what I have (tried) to do.
>
> > Do I have to trap to C for first store?
>
> Most of the time you do anyways since the PTE isn't populated at all. At
> which point, Linux will populate a PTE with DIRTY and ACCESSED already
> set. It should be reasonably rare to actually fault because DIRTY and/or
> ACCESSED are missing.
I tried to unconditionally trap to C in DTLB error but it just hung if I did
that so the asm has to do something.
>
> > > The approach I take on BookE is to simply not set these from asm, -and-
> > > (this is important) not set write permission if dirty is not set in
Did you really mean "if dirty is not" ? I test RW for write permission.
Dirty is just set when the first write happens after the permission check.
> > > the TLB miss and set no access permission at all when accessed is not
> > > set. This is important or we'll miss dirty updates which can
> > > be fatal.
> >
> > not sure, but this seems similar to what I do. DIRTY will be set,
> > in asm, on first store.
>
> Don't set DIRTY if !VALID
I don't. !VALID trap to C
>
> > ACCESSED will only be set iff (USER && VALID)
>
> My point is that you should be able to simplify the code here, have only
> the TLB miss look at the PTE, not the data access and instruction
> access, and have the later be a boring exception going straight to C.
I do this, TLB Miss only looks at TLB and then transforms it into a HW pte.
The HW pte do not map 1:1 so I need to some magic to fit the linux pte
into a HW pte.
>
> > >
> > > The C code in handle_pte_fault() will fixup missing access and dirty
> > > if necessary and flush.
> > >
> > > Also look at the 440 code, I think you could simplify your
> > > implementation using similar techniques, such as andc of PTE against
> > > requested bits etc... and thus maybe save a couple of insns.
> >
> > Great, but first I want to make sure I doing it right :)
> >
> > So is there some golden rule I have to follow?
>
> Mostly only !ACCESSED -> no access permitted and !DIRTY -> no store
> permitted and don't write anything back if !VALID.
That should be !RW and not !DIRTY I hope? Then trap
first store and set DIRTY (without trapping to C)
>
> Cheers,
> Ben.
>
> > Jocke
> >
> > >
> > > Cheers,
> > > Ben.
> > >
> > > > - Proper RO/RW mapping of user space.
> > > > - Free up 2 SW TLB bits in the linux pte(add back _PAGE_WRITETHRU ?)
> > > > Cons:
> > > > - 4 more instructions in I/D TLB Miss, but the since the linux pte is
> > > > not written anymore, it should still be a win.
next prev parent reply other threads:[~2009-10-05 22:03 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-05 12:16 [PATCH 0/6] PowerPc 8xx TLB/MMU fixes Joakim Tjernlund
2009-10-05 12:16 ` [PATCH 1/6] 8xx: DTLB Error must check for more errors Joakim Tjernlund
2009-10-05 12:16 ` [PATCH 2/6] 8xx, fault: Add some debug code to do_page_fault() Joakim Tjernlund
2009-10-05 12:16 ` [PATCH 3/6] 8xx: get rid of _PAGE_HWWRITE dependency in MMU Joakim Tjernlund
2009-10-05 12:16 ` [PATCH 4/6] 8xx: Tag DAR with 0x00f0 to catch buggy instructions Joakim Tjernlund
2009-10-05 12:16 ` [PATCH 5/6] 8xx: Fixup DAR from buggy dcbX instructions Joakim Tjernlund
2009-10-05 12:16 ` [PATCH 6/6] 8xx: start using dcbX instructions in various copy routines Joakim Tjernlund
2009-10-05 20:17 ` [PATCH 3/6] 8xx: get rid of _PAGE_HWWRITE dependency in MMU Benjamin Herrenschmidt
2009-10-05 21:25 ` Joakim Tjernlund
2009-10-05 21:37 ` Benjamin Herrenschmidt
2009-10-05 22:00 ` Joakim Tjernlund [this message]
2009-10-05 22:09 ` Benjamin Herrenschmidt
2009-10-05 22:55 ` Joakim Tjernlund
2009-10-05 23:15 ` Benjamin Herrenschmidt
2009-10-05 23:35 ` Joakim Tjernlund
2009-10-06 0:34 ` Benjamin Herrenschmidt
2009-10-06 6:15 ` Joakim Tjernlund
2009-10-06 6:45 ` Benjamin Herrenschmidt
2009-10-06 7:54 ` Joakim Tjernlund
2009-10-06 15:40 ` Joakim Tjernlund
2009-10-06 17:28 ` Joakim Tjernlund
2009-10-06 22:05 ` Joakim Tjernlund
2009-10-06 23:25 ` Benjamin Herrenschmidt
2009-10-07 1:07 ` Benjamin Herrenschmidt
2009-10-07 7:47 ` Joakim Tjernlund
2009-10-05 18:12 ` [PATCH 0/6] PowerPc 8xx TLB/MMU fixes Scott Wood
2009-10-05 18:27 ` Joakim Tjernlund
2009-10-05 20:09 ` Scott Wood
2009-10-05 21:04 ` Joakim Tjernlund
2009-10-05 21:31 ` Benjamin Herrenschmidt
2009-10-05 21:41 ` Joakim Tjernlund
2009-10-05 21:46 ` Scott Wood
2009-10-05 21:31 ` Scott Wood
2009-10-05 22:04 ` Rex Feany
2009-10-05 22:31 ` Joakim Tjernlund
2009-10-05 22:37 ` Benjamin Herrenschmidt
2009-10-05 22:58 ` Joakim Tjernlund
2009-10-05 23:49 ` Joakim Tjernlund
2009-10-06 1:52 ` Benjamin Herrenschmidt
2009-10-06 8:06 ` Joakim Tjernlund
2009-10-06 8:32 ` Benjamin Herrenschmidt
2009-10-06 10:58 ` Joakim Tjernlund
2009-10-06 11:06 ` Benjamin Herrenschmidt
2009-10-06 11:39 ` Joakim Tjernlund
2009-10-06 13:18 ` Joakim Tjernlund
2009-10-05 22:42 ` Rex Feany
2009-10-05 23:00 ` Joakim Tjernlund
2009-10-06 6:25 ` Joakim Tjernlund
2009-10-06 6:44 ` Benjamin Herrenschmidt
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=OF16069D5F.03682AAC-ONC1257646.00774BB8-C1257646.0078E24B@transmode.se \
--to=joakim.tjernlund@transmode.se \
--cc=RFeany@mrv.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=scottwood@freescale.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 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).