All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Byrne <john.l.byrne@hp.com>
To: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>
Cc: xen-devel <xen-devel@lists.xensource.com>
Subject: Re: Live migration leaves page tables read-only?
Date: Fri, 08 Dec 2006 21:40:56 -0800	[thread overview]
Message-ID: <457A4C68.6050800@hp.com> (raw)
In-Reply-To: <8A87A9A84C201449A0C56B728ACF491E01FA69@liverpoolst.ad.cl.cam.ac.uk>

[-- Attachment #1: Type: text/plain, Size: 1583 bytes --]

Ian Pratt wrote:
>>>> What happens if you use non-live relo?
>>> I thought I had tested that way back at the beginning without seeing
> the
>>> problem, but I must not have, because I just retested it to be sure
> and
>>> it died the same way. (Now I am truly confused and I need to go back
> and
>>> re-examine some of my earlier experiments.)
>>>
>> After redoing some of my tests and understanding more about how Xen
>> handles page tables, I started looking at ptwr_do_page_fault() and put
>> debugging code into it. (On Xen 3.0.3 x86-64.)  The fixup is failing
> in
>> x86_emulate_memop(). Building a debug version of Xen provided some
>> additional information (the final line is from my debugging, after the
>> ":" is domid, addr, pte, pte flags, type_info, page owner, domain):
> 
> You say you can repro the problem using non-live relo. In that case, you
> should also be able to repro it using save/restore, which has almost
> identical code paths.
> 
> Please try and isolate whether the crash happens on save or restore, and
> further whether a given saved images crashes every time in the same way
> when you try and restore it (mfns will be different, but pfns may be the
> same).
> 
>  
> Ian
> 
> 

I finally ran down the problem. SAP is protecting the pages PROT_NONE, 
so the page-present bit in the pte is not set and 
canonicalize/uncanonicalize code in save/restore ignore the pte. I've 
attached a patch. It is possible that this change should be made to the 
l1e tests in xc_ptrace.c; I'm not sure.

John Byrne

Signed-off-by: John Byrne <john.l.byrne@hp.com>

[-- Attachment #2: migprotnone.patch --]
[-- Type: text/x-patch, Size: 1444 bytes --]

diff -r 1ad7dff99968 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c	Fri Dec 08 18:37:19 2006 +0000
+++ b/tools/libxc/xc_linux_restore.c	Fri Dec 08 21:37:27 2006 -0600
@@ -73,7 +73,7 @@ static int uncanonicalize_pagetable(unsi
         else
             pte = ((uint64_t *)page)[i];
 
-        if(pte & _PAGE_PRESENT) {
+        if(pte_present(pte)) {
 
             pfn = (pte >> PAGE_SHIFT) & 0xffffffff;
 
diff -r 1ad7dff99968 tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c	Fri Dec 08 18:37:19 2006 +0000
+++ b/tools/libxc/xc_linux_save.c	Fri Dec 08 21:36:59 2006 -0600
@@ -471,7 +471,7 @@ static int canonicalize_pagetable(unsign
         if (i >= xen_start && i < xen_end)
             pte = 0;
 
-        if (pte & _PAGE_PRESENT) {
+        if (pte_present(pte)) {
 
             mfn = (pte >> PAGE_SHIFT) & 0xfffffff;
             if (!MFN_IS_IN_PSEUDOPHYS_MAP(mfn)) {
diff -r 1ad7dff99968 tools/libxc/xg_private.h
--- a/tools/libxc/xg_private.h	Fri Dec 08 18:37:19 2006 +0000
+++ b/tools/libxc/xg_private.h	Fri Dec 08 17:48:49 2006 -0600
@@ -46,6 +46,10 @@ unsigned long csum_page (void * page);
 #define _PAGE_PSE       0x080
 #define _PAGE_GLOBAL    0x100
 
+#define _PAGE_PROTNONE	0x080 /* If not present */
+
+#define pte_present(_pteval)	((_pteval) & (_PAGE_PRESENT|_PAGE_PROTNONE))
+
 #define L1_PAGETABLE_SHIFT_PAE   12
 #define L2_PAGETABLE_SHIFT_PAE   21
 #define L3_PAGETABLE_SHIFT_PAE   30

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2006-12-09  5:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-29  0:13 Live migration leaves page tables read-only? John Byrne
2006-11-29  0:22 ` John Byrne
2006-11-29  1:36   ` Ian Pratt
2006-11-29  2:52     ` John Byrne
2006-11-29  7:42       ` Keir Fraser
2006-11-29 16:49         ` John Byrne
2006-11-30 23:36       ` John Byrne
2006-12-01  1:13         ` Ian Pratt
2006-12-09  5:40           ` John Byrne [this message]
2006-12-09  5:44             ` John Byrne
2006-12-09  8:33             ` Ian Pratt
2006-12-09  9:22               ` Keir Fraser
2006-12-09  9:34                 ` Keir Fraser
2006-12-09  9:48                   ` Keir Fraser
2006-12-11 17:00               ` Joe Bonasera
2006-12-11 18:29                 ` Ian Pratt
2006-12-11 19:55                   ` John Byrne
2006-12-11 21:30                   ` Joe Bonasera
2007-01-14  4:11               ` John Byrne
2007-01-14  8:21                 ` Ian Pratt

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=457A4C68.6050800@hp.com \
    --to=john.l.byrne@hp.com \
    --cc=m+Ian.Pratt@cl.cam.ac.uk \
    --cc=xen-devel@lists.xensource.com \
    /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.