mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Hugh Dickins <hugh@veritas.com>
Cc: Andi Kleen <ak@suse.de>, Dave Jones <davej@redhat.com>,
	"Sergey S. Kostyliov" <rathamahata@ehouse.ru>,
	Clem Taylor <clem.taylor@gmail.com>,
	Chris Wright <chrisw@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: x86-64 bad pmds in 2.6.11.6
Date: Thu, 14 Apr 2005 20:10:15 +0200	[thread overview]
Message-ID: <20050414181015.GH22573@wotan.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.61.0504141804480.26008@goblin.wat.veritas.com>

On Thu, Apr 14, 2005 at 06:34:58PM +0100, Hugh Dickins wrote:
> On Thu, 14 Apr 2005, Andi Kleen wrote:
> > 
> > Thanks for the analysis. However I doubt the load_cr3 patch can fix
> > it. All it does is to stop the CPU from prefetching mappings (which
> > can cause different problem).
> 
> I thought that the leave_mm code (before your patch) flushes the TLB, but
> restores cr3 to the mm, while removing that cpu from the mm's cpu_vm_mask.
> 
> So any speculation, not just prefetching, on that cpu is in danger of
> bringing address translations according to that mm back into the TLB.
> 
> But when the mm is torn down in exit_mmap, there's no longer any record
> that the TLB on that cpu needs flushing, so stale translations remain.
> 
> As a rule, we always flush TLB _after_ invalidating, not just before,
> for this kind of reason.

Yes this is all true. In fact I have several bug fixes for problems
in this area.

But this all cannot explain corruptions comming from the kernel, 
you tend to only see problems with the CPU prefetching something.

Note that with the cr3 reload you end up with init_mm, which
is not any useful mm. So even if there was a store from the kernel
into a stale mapping it would cause -EFAULT now.  But that is
not happening.

> 
> My paranoia of speculation may be excessive: I _think_ what I outline
> above is a real possibility on Intel, but you and others know AMD much
> better than I (and the reports I've seen are on AMD64, not EM64T).

It is not both on Intel and AMD :) These CPUs do a lot of prefetching
behind your back, any stale mappings at any time in the TLB eventually
cause problems. But other ones than this.


> Sure, the "mm/memory.c:97: bad pmd" messages are coming from
> clear_pmd_range, when the corrupted task exits later (but probably
> not much later, since its user stack is oddly distributed across
> two different pages: some mentioned SIGSEGVs I think).
> 
> The pmd really is bad, but it got to be bad because it had stack data
> written into it by create_elf_tables, when the TLB mistakenly thought
> it already knew what physical page 0x00007ffffffff000 was mapped to
> (prior kernel accesses to that user stack are not by user address).

What I meant is that the overwriting must be from Linux code
acting in the direct mapping, not due stale TLBs for addresses < __PAGE_OFFSET.

I will take a closer look at the rc1/rc2 patches later this evening
and see if I can spot something. Can only report back tomorrow though.

-Andi

  reply	other threads:[~2005-04-14 18:10 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-30 21:44 Dave Jones
2005-03-31 10:41 ` Andi Kleen
2005-03-31 21:52   ` Dave Jones
2005-04-01 11:52     ` Sergey S. Kostyliov
2005-04-07  2:49   ` Dave Jones
2005-04-07  6:29     ` Andi Kleen
2005-04-14 13:54       ` Hugh Dickins
2005-04-14 17:01         ` Andi Kleen
2005-04-14 17:34           ` Hugh Dickins
2005-04-14 18:10             ` Andi Kleen [this message]
2005-04-14 18:11               ` x86-64 bad pmds in 2.6.11.6 II Andi Kleen
2005-04-14 18:27                 ` Chris Wright
2005-04-15 17:24                   ` Andi Kleen
2005-04-15 17:28                     ` Chris Wright
2005-04-15 17:58                       ` Hugh Dickins
2005-04-15 18:07                         ` Dave Jones
2005-04-22 17:37                           ` Debugging patch was " Andi Kleen
2005-04-27 14:23                           ` New debugging " Andi Kleen
2005-04-27 17:37                             ` Dave Jones
2005-04-29 11:07                               ` Hans Kristian Rosbach
2005-04-19 13:35                         ` Andi Kleen
2005-04-19 15:52                           ` Hugh Dickins
2005-04-29 11:12                             ` Christopher Warner
2005-04-29 16:13                               ` Chris Wright
2005-04-29 17:32                               ` Dave Jones
2005-05-02 17:00                                 ` Andi Kleen
2005-05-02 15:28                                   ` Christopher Warner
2005-05-02 20:33                                     ` Chris Wright
2005-05-02 21:08                                       ` Dave Jones
2005-05-03 14:28                                         ` Andi Kleen
2005-05-03 15:15                                           ` Dave Jones
2005-05-10  9:36                                     ` Christopher Warner
2005-05-10 16:26                                       ` Chris Wright
2005-05-10 12:03                                         ` Christopher Warner
2005-05-10 16:38                                       ` Dave Jones
2005-05-10 16:46                                         ` Andi Kleen
2005-05-10 16:59                                           ` Dave Jones
2005-05-10 20:32                                             ` Andi Kleen
2005-05-10 20:43                                               ` Chris Wright
2005-05-12 21:23                                             ` Andi Kleen
2005-05-13 21:51                                               ` Peter J. Stieber
2005-05-14 17:29                                                 ` Peter J. Stieber
2005-04-08 16:33 x86-64 bad pmds in 2.6.11.6 Clem Taylor
2005-08-08 16:55 Andy Davidson
2005-09-20 17:12 Charles McCreary
2005-09-20 17:30 ` Linus Torvalds
2005-09-20 19:44   ` Chris Wedgwood
2005-09-20 23:23     ` Dave Jones

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=20050414181015.GH22573@wotan.suse.de \
    --to=ak@suse.de \
    --cc=chrisw@osdl.org \
    --cc=clem.taylor@gmail.com \
    --cc=davej@redhat.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rathamahata@ehouse.ru \
    /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®