|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 4/4] x86: add new pte_get_and_clear hypercall
This new hypercall uses the same interface as the mmu_update hypercall except
the old PTE value is returned in the mmu_update_t->val field.
The purpose of this new hypercall is to improve performance over the current
trap and emulate behavior. Only l1 PTEs are supported because they have the
biggest performance impact.
Signed-off-by: Kevin Lampis <kevin.lampis@xxxxxxxxxx>
---
xen/arch/x86/mm.c | 24 +++++++++++++++++-------
xen/include/hypercall-defs.c | 2 ++
xen/include/public/xen.h | 1 +
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 278b992aca5c..e5fdfc66081a 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -3993,6 +3993,7 @@ static long __do_mmu_update(
unsigned int count,
XEN_GUEST_HANDLE_PARAM(uint) pdone,
unsigned int foreigndom,
+ unsigned int op,
bool write_back_old)
{
struct mmu_update req;
@@ -4013,8 +4014,7 @@ static long __do_mmu_update(
{
if ( likely(rc == -ERESTART) )
rc = hypercall_create_continuation(
- __HYPERVISOR_mmu_update, "hihi", ureqs, count, pdone,
- foreigndom);
+ op, "hihi", ureqs, count, pdone, foreigndom);
return rc;
}
@@ -4316,8 +4316,8 @@ static long __do_mmu_update(
if ( rc == -ERESTART )
rc = hypercall_create_continuation(
- __HYPERVISOR_mmu_update, "hihi",
- ureqs, (count - i) | MMU_UPDATE_PREEMPTED, pdone, foreigndom);
+ op, "hihi", ureqs, (count - i) | MMU_UPDATE_PREEMPTED,
+ pdone, foreigndom);
else if ( curr->arch.old_guest_table )
{
XEN_GUEST_HANDLE_PARAM(void) null;
@@ -4330,8 +4330,7 @@ static long __do_mmu_update(
* on the fact that this argument isn't needed anymore.
*/
rc = hypercall_create_continuation(
- __HYPERVISOR_mmu_update, "hihi", null,
- MMU_UPDATE_PREEMPTED, null, rc);
+ op, "hihi", null, MMU_UPDATE_PREEMPTED, null, rc);
}
put_pg_owner(pg_owner);
@@ -4417,7 +4416,18 @@ long do_mmu_update(
XEN_GUEST_HANDLE_PARAM(uint) pdone,
unsigned int foreigndom)
{
- return __do_mmu_update(ureqs, count, pdone, foreigndom, false);
+ return __do_mmu_update(ureqs, count, pdone, foreigndom,
+ __HYPERVISOR_mmu_update, false);
+}
+
+long do_pte_get_and_clear(
+ XEN_GUEST_HANDLE_PARAM(mmu_update_t) ureqs,
+ unsigned int count,
+ XEN_GUEST_HANDLE_PARAM(uint) pdone,
+ unsigned int foreigndom)
+{
+ return __do_mmu_update(ureqs, count, pdone, foreigndom,
+ __HYPERVISOR_pte_get_and_clear, true);
}
#endif /* CONFIG_PV */
diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index a625d634b694..0552e93ab560 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -174,6 +174,7 @@ multicall(multicall_entry_t *call_list, unsigned long
nr_calls)
#ifdef CONFIG_PV
mmuext_op(mmuext_op_t *uops, unsigned int count, unsigned int *pdone, unsigned
int foreigndom)
mmu_update(mmu_update_t *ureqs, unsigned int count, unsigned int *pdone,
unsigned int foreigndom)
+pte_get_and_clear(mmu_update_t *ureqs, unsigned int count, unsigned int
*pdone, unsigned int foreigndom)
stack_switch(unsigned long ss, unsigned long esp)
fpu_taskswitch(int set)
set_debugreg(int reg, unsigned long value)
@@ -232,6 +233,7 @@ caller: arm
table: pv32 pv64 hvm32 hvm64 arm
set_trap_table compat do - - -
mmu_update do:1 do:1 - - -
+pte_get_and_clear do:1 do:1 - - -
set_gdt compat do - - -
stack_switch do:2 do:2 - - -
set_callbacks compat do - - -
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index 2149b8dd3808..9e2ba0107d3b 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -118,6 +118,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
#define __HYPERVISOR_xenpmu_op 40
#define __HYPERVISOR_dm_op 41
#define __HYPERVISOR_hypfs_op 42
+#define __HYPERVISOR_pte_get_and_clear 43
/* Architecture-specific hypercall definitions. */
#define __HYPERVISOR_arch_0 48
--
2.52.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |