From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Tim Deegan <tim@xen.org>, Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 3/3] x86/traps: Adjust paged-guest handling in the PV pagefault path
Date: Tue, 13 Dec 2016 16:54:34 +0000 [thread overview]
Message-ID: <1481648074-11455-4-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1481648074-11455-1-git-send-email-andrew.cooper3@citrix.com>
PV guests necessarily can't be external, as Xen must steal address space from
them. Pagefaults for HVM guests are handled by {vmx,svm}_vmexit_handler() and
don't enter the PV fixup_page_fault() path. Therefore, the first call to
paging_fault() is dead, and dropped.
Logdirty mode is now the only paging mode we should ever find a PV guest with,
so add a new predicate and assertion to this fact.
Drop the final reference to paging_mode_external(). It is more accurately now
only for logdirty guests.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>
CC: George Dunlap <george.dunlap@eu.citrix.com>
---
xen/arch/x86/traps.c | 16 +++++-----------
xen/include/asm-x86/paging.h | 3 +++
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 013e633..f76aec2 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1799,14 +1799,9 @@ static int fixup_page_fault(unsigned long addr, struct cpu_user_regs *regs)
if ( in_irq() || !(regs->eflags & X86_EFLAGS_IF) )
return 0;
- /* Faults from external-mode guests are handled by shadow/hap */
- if ( paging_mode_external(d) && guest_mode(regs) )
- {
- int ret = paging_fault(addr, regs);
- if ( ret == EXCRET_fault_fixed )
- trace_trap_two_addr(TRC_PV_PAGING_FIXUP, regs->eip, addr);
- return ret;
- }
+ /* Logdirty mode is the only expected paging mode for PV guests. */
+ if ( paging_mode_enabled(d) )
+ ASSERT(paging_mode_only_log_dirty(d));
if ( !(regs->error_code & PFEC_page_present) &&
(pagefault_by_memadd(addr, regs)) )
@@ -1838,9 +1833,8 @@ static int fixup_page_fault(unsigned long addr, struct cpu_user_regs *regs)
return EXCRET_fault_fixed;
}
- /* For non-external shadowed guests, we fix up both their own
- * pagefaults and Xen's, since they share the pagetables. */
- if ( paging_mode_enabled(d) && !paging_mode_external(d) )
+ /* Logdirty guests call back into the paging code to update shadows. */
+ if ( paging_mode_log_dirty(d) )
{
int ret = paging_fault(addr, regs);
if ( ret == EXCRET_fault_fixed )
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index cc29f9b..2243aa1 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -69,6 +69,9 @@
#define paging_mode_translate(_d) (!!((_d)->arch.paging.mode & PG_translate))
#define paging_mode_external(_d) (!!((_d)->arch.paging.mode & PG_external))
+#define paging_mode_only_log_dirty(_d) \
+ (((_d)->arch.paging.mode & PG_MASK) == PG_log_dirty)
+
/* flags used for paging debug */
#define PAGING_DEBUG_LOGDIRTY 0
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-12-13 16:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-13 16:54 [PATCH v2 0/3] x86: Remove vestigal PV Autotranslate pieces Andrew Cooper
2016-12-13 16:54 ` [PATCH 1/3] x86/paging: Enforce PG_external == PG_translate == PG_refcounts Andrew Cooper
2016-12-13 16:54 ` [PATCH 2/3] x86/shadow: Drop all emulation for PV vcpus Andrew Cooper
2016-12-13 16:54 ` Andrew Cooper [this message]
2016-12-13 17:02 ` [PATCH 3/3] x86/traps: Adjust paged-guest handling in the PV pagefault path Tim Deegan
2016-12-13 17:19 ` Jan Beulich
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=1481648074-11455-4-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=george.dunlap@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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).