All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: David Daney <david.daney@cavium.com>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH 2/2 v2] MIPS: Close races in TLB modify handlers.
Date: Thu, 21 Jul 2011 14:55:25 +0100	[thread overview]
Message-ID: <20110721135525.GB27341@linux-mips.org> (raw)
In-Reply-To: <1309908886-1624-2-git-send-email-david.daney@cavium.com>

On Tue, Jul 05, 2011 at 04:34:46PM -0700, David Daney wrote:

> Page table entries are made invalid by writing a zero into the the PTE
> slot in a page table.  This creates a race condition with the TLB
> modify handlers when they are updating the PTE.
> 
> CPU0                              CPU1
> 
> Test for _PAGE_PRESENT
> .                                 set to not _PAGE_PRESENT (zero)
> Set to _PAGE_VALID
> 
> So now the page not present value (zero) is suddenly valid and user
> space programs have access to physical page zero.
> 
> We close the race by putting the test for _PAGE_PRESENT and setting of
> _PAGE_VALID into an atomic LL/SC section.  This requires more
> registers than just K0 and K1 in the handlers, so we need to save some
> registers to a save area and then restore them when we are done.
> 
> The save area is an array of cacheline aligned structures that should
> not suffer cache line bouncing as they are CPU private.
> 
> Signed-off-by: David Daney <david.daney@cavium.com>

Looks good and nobody else has complained but backporting to <= 2.6.37 is
gonna be ugly.  I either have to resolve huge conflicts or alternatively
backport tons of other tlbex.c patches.  The latter is less risky and
time consuming and will provide additional benefit so I'll do it.  Just
be prepared for a storm on the linux-git list.

  Ralf

  reply	other threads:[~2011-07-21 13:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05 23:34 [PATCH 1/2] MIPS: Add uasm UASM_i_SRL_SAFE macro David Daney
2011-07-05 23:34 ` [PATCH 2/2 v2] MIPS: Close races in TLB modify handlers David Daney
2011-07-21 13:55   ` Ralf Baechle [this message]
2011-07-22 10:11     ` Ralf Baechle
2011-07-27  7:06       ` Ralf Baechle

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=20110721135525.GB27341@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=david.daney@cavium.com \
    --cc=linux-mips@linux-mips.org \
    /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.