public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@novell.com>
To: Rik van Riel <riel@redhat.com>
Cc: "Martin J. Bligh" <mbligh@aracnet.com>,
	Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: ptep_establish/establish_pte needs set_pte_atomic and all set_pte must be written in asm
Date: Sun, 26 Sep 2004 02:31:20 +0200	[thread overview]
Message-ID: <20040926003120.GQ3309@dualathlon.random> (raw)
In-Reply-To: <Pine.LNX.4.44.0409251941590.28582-100000@chimarrao.boston.redhat.com>

On Sat, Sep 25, 2004 at 07:44:05PM -0400, Rik van Riel wrote:
> On Sat, 25 Sep 2004, Andrea Arcangeli wrote:
> 
> > set_pte), while something like this should be fine:
> > 
> > 	ptep_get_and_clear
> > 	set_pte
> > 	flush_tlb
> 
> Almost.  Think of software TLB refills, especially HPTE.
> The order needs to be:
> 
> 	ptep_get_and_clear
> 	flush_tlb
> 	set_pte

Interesting point. I sure agree it's saner to have the flush_tlb in
between ptep_get_and_clear and set_pte, I said the other version just
because I'm thinking hardware TLB and it shouldn't make any difference
on hardware TLB anyways, does it?

> Any page faults happening "in the middle" will end up as
> virtual no-ops once they grab the page_table_lock.

I'm not very fond on software TLBs and their internal locking, but
exactly because of what you said ("they grab the page_table_lock."), how
can the software TLB ever care about the flush_tlb in between
ptep_get_and_clear and set_pte?

ptep_establish is obviously always called with the page_table_lock hold.
Nobody is allowed to call ptep_establish without it. So a larger code
sequence of my version expands to:

	spin_lock(&page_table_lock)
	ptep_establish() {
		ptep_get_and_clear
		set_pte
		flush_tlb
	}
	spin_unlock(&page_table_lock)

How can a software TLB care about a tlb flush in between two pieces of
code that are anyways under the page_table_lock?

  reply	other threads:[~2004-09-26  0:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-25 15:54 ptep_establish/establish_pte needs set_pte_atomic and all set_pte must be written in asm Andrea Arcangeli
2004-09-25 23:33 ` Benjamin Herrenschmidt
2004-09-26  0:20   ` Andrea Arcangeli
2004-09-26  0:31     ` Rik van Riel
2004-09-26  0:46       ` Andrea Arcangeli
2004-09-26  0:59         ` Benjamin Herrenschmidt
2004-09-26  1:36           ` Andrea Arcangeli
2004-09-26  5:31             ` Benjamin Herrenschmidt
2004-09-26 20:30           ` Paul Mackerras
     [not found]             ` <20040926203640.GR2499@dualathlon.random>
2004-09-27 16:41               ` Andrea Arcangeli
2004-09-28  9:12         ` Pavel Machek
2004-09-26  0:44     ` Benjamin Herrenschmidt
2004-09-26  1:32       ` Andrea Arcangeli
2004-09-26  5:29         ` Benjamin Herrenschmidt
2004-09-26 15:39           ` Andrea Arcangeli
2004-09-26 14:41       ` Martin J. Bligh
2004-09-26 15:41         ` Andrea Arcangeli
2004-09-25 23:44 ` Rik van Riel
2004-09-26  0:31   ` Andrea Arcangeli [this message]
2004-09-26  0:37     ` Rik van Riel

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=20040926003120.GQ3309@dualathlon.random \
    --to=andrea@novell.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@aracnet.com \
    --cc=riel@redhat.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