mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
To: Hugh Dickins <hugh@veritas.com>
Cc: Jan Beulich <jbeulich@novell.com>,
	Zachary Amsden <zach@vmware.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i386: PAE entries must have their low word cleared first
Date: Wed, 26 Apr 2006 16:06:31 +0100	[thread overview]
Message-ID: <946b367619cfd3dcd3ba547e216e494b@cl.cam.ac.uk> (raw)
In-Reply-To: <Pine.LNX.4.64.0604261538260.9915@blonde.wat.veritas.com>


On 26 Apr 2006, at 15:46, Hugh Dickins wrote:

> If that's so (I don't trust my judgement on matters of speculative
> execution), then I think you'd do better to replace the *ptep = 
> __pte(0)
> by pte_clear(mm, addr, ptep), and so avoid your ugly #ifdef'ing: please
> check, but I think you'll find that reduces to just the barrier you 
> want.
> CC'ed Zach since it's his optimization, and he'll judge that 
> spexecution.

In more detail the problem is that, since we're still running on the 
page tables while clearing them, the CPU may choose to prefetch a 
half-cleared pte into its TLB, and then execute speculative memory 
accesses based on that mapping (including ones that may write-allocate 
cachelines, leading to problems like the AMD AGP GART deadlock Linux 
had a year or so back).

The barrier is needed to ensure that the bottom half is cleared before 
the top half. In fact it probably ought to be wmb() -- that's clearer 
in intent and actually reduces to barrier() on all PAE-capable 
platforms.

We cannot use pte_clear() unless we redefine it for PAE. Currently it 
reduces to set_pte() which explicitly uses the wrong ordering (sets 
high *then* low, because it's normally used to introduce a mapping).

Also, I think wmb() should be used in PAE's set_pte(), rather than the 
current smp_wmb(). They reduce to the same thing, but wmb() makes it 
clear this is is not an issue specific to SMP systems.

  -- Keir


  reply	other threads:[~2006-04-26 15:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-26 13:46 Jan Beulich
2006-04-26 14:46 ` Hugh Dickins
2006-04-26 15:06   ` Keir Fraser [this message]
2006-04-26 15:44     ` Zachary Amsden
2006-04-26 15:57       ` Hugh Dickins
2006-04-26 16:12         ` Keir Fraser
2006-04-26 15:45     ` Hugh Dickins
2006-04-26 16:06       ` Nick Piggin
2006-04-26 15:58     ` Nick Piggin
2006-04-27 10:27       ` Sonny Rao
2006-04-27 13:39         ` Nick Piggin
2006-04-26 22:11 Brunner, Richard
2006-04-26 22:22 ` Zachary Amsden
2006-04-26 22:27   ` Zachary Amsden

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=946b367619cfd3dcd3ba547e216e494b@cl.cam.ac.uk \
    --to=keir.fraser@cl.cam.ac.uk \
    --cc=hugh@veritas.com \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zach@vmware.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

all inboxes | Powered by JetHome®