linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave@sr71.net>
To: Anthony Iliopoulos <anthony.iliopoulos@huawei.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Shay Goikhman <shay.goikhman@huawei.com>,
	Paul Mundt <paul.mundt@huawei.com>,
	Carlos Villavieja <villavieja@hps.utexas.edu>,
	Nacho Navarro <nacho.navarro@bsc.es>,
	Avi Mendelson <avi.mendelson@tce.technion.ac.il>,
	Yoav Etsion <yetsion@tce.technion.ac.il>,
	Gerald Schaefer <gerald.schaefer@de.ibm.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	linux-arch <linux-arch@vger.kernel.org>
Subject: Re: [PATCH] x86, hugetlb: add missing TLB page invalidation for hugetlb_cow()
Date: Tue, 13 May 2014 15:44:55 -0700	[thread overview]
Message-ID: <5372A067.9010808@sr71.net> (raw)
In-Reply-To: <20140514092948.GA17391@server-36.huawei.corp>

On 05/14/2014 02:29 AM, Anthony Iliopoulos wrote:
> The invalidation is required in order to maintain proper semantics
> under CoW conditions. In scenarios where a process clones several
> threads, a thread operating on a core whose DTLB entry for a
> particular hugepage has not been invalidated, will be reading from
> the hugepage that belongs to the forked child process, even after
> hugetlb_cow().
> 
> The thread will not see the updated page as long as the stale DTLB
> entry remains cached, the thread attempts to write into the page,
> the child process exits, or the thread gets migrated to a different
> processor.

No to be too nitpicky, but this applies to ITLB too, right?

I believe this bug came all the way back from:

> commit 1e8f889b10d8d2223105719e36ce45688fedbd59
> Author: David Gibson <david@gibson.dropbear.id.au>
> Date:   Fri Jan 6 00:10:44 2006 -0800
> 
>     [PATCH] Hugetlb: Copy on Write support

It was probably the first time that we ever changed an _existing_
hugetlbfs pte, and that patch probably just missed the TLB flush because
none of the other pte-setting hugetlb.c code needed TLB flushes.

The bogus x86 version of huge_ptep_clear_flush() came from the s390
guys, so double-shame on IBM! :P

> commit 8fe627ec5b7c47b1654dff50536d9709863295a3
> Author: Gerald Schaefer <gerald.schaefer@de.ibm.com>
> Date:   Mon Apr 28 02:13:28 2008 -0700
> 
>     hugetlbfs: add missing TLB flush to hugetlb_cow()

This is probably an opportunity for all the other architecture
maintainers to make sure that they have proper copies of
huge_ptep_clear_flush().

I went through the hugetlb code on x86 and couldn't find another TLB
flush that fixes this issue, and I believe this is correct, so:

Acked-by: Dave Hansen <dave.hansen@intel.com>

       reply	other threads:[~2014-05-13 22:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140514092948.GA17391@server-36.huawei.corp>
2014-05-13 22:44 ` Dave Hansen [this message]
2014-05-15 17:00   ` [PATCH] x86, hugetlb: add missing TLB page invalidation for hugetlb_cow() Anthony Iliopoulos
2014-05-14 17:24     ` Dave Hansen
2014-05-15  7:05     ` Oren Twaig
2014-05-15  7:05       ` Oren Twaig
2014-05-17  9:24       ` Anthony Iliopoulos

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=5372A067.9010808@sr71.net \
    --to=dave@sr71.net \
    --cc=anthony.iliopoulos@huawei.com \
    --cc=avi.mendelson@tce.technion.ac.il \
    --cc=david@gibson.dropbear.id.au \
    --cc=gerald.schaefer@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nacho.navarro@bsc.es \
    --cc=paul.mundt@huawei.com \
    --cc=shay.goikhman@huawei.com \
    --cc=tglx@linutronix.de \
    --cc=villavieja@hps.utexas.edu \
    --cc=x86@kernel.org \
    --cc=yetsion@tce.technion.ac.il \
    /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).