linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andy Whitcroft <apw@shadowen.org>
Cc: linuxppc-dev@ozlabs.org, paulus@samba.org
Subject: Re: [PATCH 1/1] powerpc: add 64 bit version of huge_ptep_set_wrprotect
Date: Thu, 26 Jun 2008 20:51:42 +1000	[thread overview]
Message-ID: <1214477502.8011.459.camel@pasglop> (raw)
In-Reply-To: <1214474158-17870-1-git-send-email-apw@shadowen.org>

On Thu, 2008-06-26 at 10:55 +0100, Andy Whitcroft wrote:
> The implementation of huge_ptep_set_wrprotect() directly calls
> ptep_set_wrprotect() to mark a hugepte write protected.  However this
> call is not appropriate on ppc64 kernels as this is a small page only
> implementation.  This can lead to the hash not being flushed correctly
> when a mapping is being converted to COW, allowing processes to continue
> using the original copy.
> 
> Currently huge_ptep_set_wrprotect() unconditionally calls
> ptep_set_wrprotect().  This is fine on ppc32 kernels as this call is
> generic.  On 64 bit this is implemented as:
> 
> 	pte_update(mm, addr, ptep, _PAGE_RW, 0);
> 
> On ppc64 this last parameter is the page size and is passed directly on
> to hpte_need_flush():
> 
> 	hpte_need_flush(mm, addr, ptep, old, huge);
> 
> And this directly affects the page size we pass to flush_hash_page():
> 
> 	flush_hash_page(vaddr, rpte, psize, ssize, 0);
> 
> As this changes the way the hash is calculated we will flush the wrong
> pages, potentially leaving live hashes to the original page.
> 
> Move the definition of huge_ptep_set_wrprotect() to the 32/64 bit specific
> headers.
> 
> Signed-off-by: Andy Whitcroft <apw@shadowen.org>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Good catch btw !

Cheers,
Ben.

      reply	other threads:[~2008-06-26 11:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26  9:55 [PATCH 1/1] powerpc: add 64 bit version of huge_ptep_set_wrprotect Andy Whitcroft
2008-06-26 10:51 ` Benjamin Herrenschmidt [this message]

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=1214477502.8011.459.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=apw@shadowen.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.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 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).