xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"yinghai@kernel.org" <yinghai@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 1/2] xen/mmu: Add workaround "x86-64, mm: Put early page table high"
Date: Tue, 3 May 2011 11:27:45 -0400	[thread overview]
Message-ID: <20110503152745.GB8868@dumpdata.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1105031351190.10886@kaball-desktop>

On Tue, May 03, 2011 at 02:20:25PM +0100, Stefano Stabellini wrote:
> On Mon, 2 May 2011, Konrad Rzeszutek Wilk wrote:
> > As a consequence of the commit:
> > 
> > commit 4b239f458c229de044d6905c2b0f9fe16ed9e01e
> > Author: Yinghai Lu <yinghai@kernel.org>
> > Date:   Fri Dec 17 16:58:28 2010 -0800
> > 
> >     x86-64, mm: Put early page table high
> > 
> > it causes the Linux kernel to crash under Xen:
> > 
> > mapping kernel into physical memory
> > Xen: setup ISA identity maps
> > about to get started...
> > (XEN) mm.c:2466:d0 Bad type (saw 7400000000000001 != exp 1000000000000000) for mfn b1d89 (pfn bacf7)
> > (XEN) mm.c:3027:d0 Error while pinning mfn b1d89
> > (XEN) traps.c:481:d0 Unhandled invalid opcode fault/trap [#6] on VCPU 0 [ec=0000]
> > (XEN) domain_crash_sync called from entry.S
> > (XEN) Domain 0 (vcpu#0) crashed on cpu#0:

.. snip..
> 
> 
> Unless I am missing something there is no guarantee that somebody else
> won't use memory in the pgt_buf_end-pgt_buf_top range when the range is
> still RO before mark_rw_past_pgt() is called again.  If so this code
> works by coincidence, that is the reason why I didn't try to reuse the
> pagetable_setup_done or the pagetable_setup_start hooks.

It looks that during sequence of events after the initial pagetable is created
and when we get to the post-allocator nobody is touching those pages.
(also one of them - the 0-4GB pagetable has been .. made RW). But if you do find it
dying/crashing, please tell so that we can revert it and use the generic work-around
or revert Yinghai's patch.
 
> In any case this code looks very ugly and fragile, do we really want to
> add a workaround as bad as this one rather than reverting the original
> commit? I think it creates a bad precedent.

This is the second one. We had the swapper_pg_dir/initial_page_table dance in x86_32
where we mark it RO, then RW (after a cr3 load) then RO and then back to RW.
(Details escape me, but it was some form of that)

But I wonder how many workarounds the generic code has because of us?

I think we need to setup some form of meeting with the x86 maintainers
to figure out some better way of handling this.

  reply	other threads:[~2011-05-03 15:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 17:22 [PATCH] Two patches fixing regression introduced by 'x86-64, mm: Put early page table high' Konrad Rzeszutek Wilk
2011-05-02 17:22 ` [PATCH 1/2] xen/mmu: Add workaround "x86-64, mm: Put early page table high" Konrad Rzeszutek Wilk
2011-05-03  0:55   ` Daniel Kiper
2011-05-03 15:12     ` Konrad Rzeszutek Wilk
2011-05-03 19:51       ` Daniel Kiper
2011-05-04 18:59         ` Daniel Kiper
2011-05-04 19:33           ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-05-05 11:34             ` Daniel Kiper
2011-05-05 12:55           ` Stefano Stabellini
2011-05-05 14:01             ` Konrad Rzeszutek Wilk
2011-05-05 14:06               ` Stefano Stabellini
2011-05-09  7:06                 ` Daniel Kiper
2011-05-03 13:20   ` Stefano Stabellini
2011-05-03 15:27     ` Konrad Rzeszutek Wilk [this message]
2011-05-02 17:22 ` [PATCH 2/2] xen: mask_rw_pte mark RO all pagetable pages up to pgt_buf_top Konrad Rzeszutek Wilk
2011-05-02 17:31 ` [PATCH] Two patches fixing regression introduced by 'x86-64, mm: Put early page table high' H. Peter Anvin
2011-05-02 18:08   ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-05-02 18:33     ` H. Peter Anvin
2011-05-02 19:34       ` Konrad Rzeszutek Wilk
2011-05-02 19:59         ` [Xen-devel] " H. Peter Anvin
2011-05-02 20:07           ` Konrad Rzeszutek Wilk
2011-05-02 20:16             ` Yinghai Lu
2011-05-05 16:28           ` Re: [PATCH] Two patches fixing regression introduced by 'x86-64, mm: Put early page table high' - does not work Konrad Rzeszutek Wilk
2011-05-05 18:45             ` [Xen-devel] " Konrad Rzeszutek Wilk

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=20110503152745.GB8868@dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=yinghai@kernel.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).