Add V4V to Xen
cover Add V4V to Xen
V4V is a copy based inter vm communication system.
Please have a look at this thread for more detail
about V4V.
http://lists.xen.org/archives/html/xen-devel/2012-05/msg01866.html
This patch series is work in progress but I wanted to post it early enough so I can get feedback from people.
Jean Guyader (5):
xen: add ssize_t to types.h
xen: Add headers to include/Makefile
v4v: Introduce VIRQ_V4V
xen: Enforce casting for guest_handle_cast
xen: Add V4V implementation
xen/arch/x86/hvm/hvm.c | 9 +- xen/arch/x86/x86_32/entry.S | 2 + xen/arch/x86/x86_64/compat/entry.S | 2 + xen/arch/x86/x86_64/entry.S | 2 + xen/common/Makefile | 1 + xen/common/domain.c | 11 +- xen/common/event_channel.c | 1 + xen/common/v4v.c | 1779 ++++++++++++++++++++++++++++++++++++ xen/include/Makefile | 3 +- xen/include/asm-x86/guest_access.h | 2 +- xen/include/public/v4v.h | 544 +++++++++++ xen/include/public/xen.h | 4 +- xen/include/xen/sched.h | 5 + xen/include/xen/types.h | 1 + xen/include/xen/v4v.h | 109 +++ 15 files changed, 2467 insertions(+), 8 deletions(-) create mode 100644 xen/common/v4v.c create mode 100644 xen/include/public/v4v.h create mode 100644 xen/include/xen/v4v.h
Signature · 1 line
1.7.2.5
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 1/5 xen: add ssize_t to types.h
--- xen/include/xen/types.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
xen/include/xen/types.h +1 -0
@@ -58,5 +58,6 @@ typedef __u64 __le64;typedef __u64 __be64 ;typedef unsigned long uintptr_t ; +typedef int ssize_t ;#endif /* __TYPES_H__ */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 2/5 xen: Add headers to include/Makefile
In reply to Jean Guyader Add stdlib.h for size_t
Add string.h for memcpy
Add sys/types.h for ssize_t
--- xen/include/Makefile | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
xen/include/Makefile +2 -1
@@ -77,8 +77,9 @@ ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) all: headers.chk +INCLUDE_LIBS=stdint.h stdlib.h string.h sys/types.h headers.chk: $(filter-out public/arch-% public/%ctl.h public/xsm/% public/%hvm/save.h, $(wildcard public/*.h public/*/*.h) $(public-y)) Makefile - for i in $(filter %.h,$^); do $(CC) -ansi -include stdint.h -Wall -W -Werror -S -o /dev/null -xc $$i || exit 1; echo $$i; done >[email protected] + for i in $(filter %.h,$^); do $(CC) -ansi ${INCLUDE_LIBS:%.h=-include %.h} -Wall -W -Werror -S -o /dev/null -xc $$i || exit 1; echo $$i; done >[email protected] mv [email protected] $@ endif
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 3/5 v4v: Introduce VIRQ_V4V
In reply to Jean GuyaderIntroduce the global virq VIRQ_V4V
--- xen/common/event_channel.c | 1 + xen/include/public/xen.h | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
xen/common/event_channel.c +1 -0
@@ -107,6 +107,7 @@ static int virq_is_global(uint32_t virq)case VIRQ_TIMER :case VIRQ_DEBUG :case VIRQ_XENOPROF : +case VIRQ_V4V : rc =0 ;break ; case VIRQ_ARCH_0 ... VIRQ_ARCH_7:
xen/include/public/xen.h +1 -1
@@ -157,7 +157,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);#define VIRQ_CON_RING 8/* G. (DOM0) Bytes received on console */ #define VIRQ_PCPU_STATE 9/* G. (DOM0) PCPU state changed */ #define VIRQ_MEM_EVENT 10/* G. (DOM0) A memory event has occured */ -#define VIRQ_XC_RESERVED 11/* G. Reserved for XenClient */ +#define VIRQ_V4V 11/* G. V4V event has occurred */ #define VIRQ_ENOMEM 12/* G. (DOM0) Low on heap memory */ /* Architecture-specific VIRQ definitions. */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 4/5 xen: Enforce casting for guest_handle_cast
In reply to Jean GuyaderThis is useful if you want to cast a guest handle to char * to do pointer aritmetics afterwards with functions like guest_handle_add_offset.
--- xen/include/asm-x86/guest_access.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
xen/include/asm-x86/guest_access.h +1 -1
@@ -47,7 +47,7 @@/* Cast a guest handle to the specified type of handle. */ #define guest_handle_cast (hnd, type) ({ \ - type *_x = (hnd).p; \ + type *_x = (type *)(hnd).p; \ (XEN_GUEST_HANDLE(type)) { _x }; \ })
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 5/5 xen: Add V4V implementation
In reply to Jean GuyaderSetup of v4v domains a domain gets created and cleanup when a domain die. Wire up the v4v hypercall.
Include v4v internal and public headers.
--- xen/arch/x86/hvm/hvm.c | 9 +- xen/arch/x86/x86_32/entry.S | 2 + xen/arch/x86/x86_64/compat/entry.S | 2 + xen/arch/x86/x86_64/entry.S | 2 + xen/common/Makefile | 1 + xen/common/domain.c | 11 +- xen/common/v4v.c | 1779 ++++++++++++++++++++++++++++++++++++ xen/include/public/v4v.h | 544 +++++++++++ xen/include/public/xen.h | 2 +- xen/include/xen/sched.h | 5 + xen/include/xen/v4v.h | 109 +++ 11 files changed, 2461 insertions(+), 5 deletions(-) create mode 100644 xen/common/v4v.c create mode 100644 xen/include/public/v4v.h create mode 100644 xen/include/xen/v4v.h
xen/arch/x86/hvm/hvm.c +6 -3
@@ -3124,7 +3124,8 @@ static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = {HYPERCALL (set_timer_op),HYPERCALL (hvm_op),HYPERCALL (sysctl), -HYPERCALL (tmem_op) +HYPERCALL (tmem_op), +HYPERCALL (v4v_op) };#else /* defined(__x86_64__) */
@@ -3209,7 +3210,8 @@ static hvm_hypercall_t *hvm_hypercall64_table[NR_hypercalls] = {HYPERCALL (set_timer_op),HYPERCALL (hvm_op),HYPERCALL (sysctl), - HYPERCALL(tmem_op) +HYPERCALL (tmem_op), + HYPERCALL(v4v_op) };#define COMPAT_CALL (x) \
@@ -3226,7 +3228,8 @@ static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = {COMPAT_CALL (set_timer_op),HYPERCALL (hvm_op),HYPERCALL (sysctl), -HYPERCALL (tmem_op) +HYPERCALL (tmem_op), +HYPERCALL (v4v_op) };#endif /* defined(__x86_64__) */
xen/arch/x86/x86_32/entry.S +2 -0
@@ -700,6 +700,7 @@ ENTRY(hypercall_table) .long do_domctl .long do_kexec_op .long do_tmem_op + .long do_v4v_op .rept __HYPERVISOR_arch_0-((.-hypercall_table)/4) .long do_ni_hypercall .endr
@@ -748,6 +749,7 @@ ENTRY(hypercall_args_table) .byte 1 /* do_domctl */ .byte 2 /* do_kexec_op */ .byte 1 /* do_tmem_op */ + .byte 6 /* do_v4v_op */ .rept __HYPERVISOR_arch_0-(.-hypercall_args_table) .byte 0 /* do_ni_hypercall */ .endr
xen/arch/x86/x86_64/compat/entry.S +2 -0
@@ -414,6 +414,7 @@ ENTRY(compat_hypercall_table) .quad do_domctl .quad compat_kexec_op .quad do_tmem_op + .quad do_v4v_op .rept __HYPERVISOR_arch_0-((.-compat_hypercall_table)/8) .quad compat_ni_hypercall .endr
@@ -462,6 +463,7 @@ ENTRY(compat_hypercall_args_table) .byte 1 /* do_domctl */ .byte 2 /* compat_kexec_op */ .byte 1 /* do_tmem_op */ + .byte 6 /* do_v4v_op */ .rept __HYPERVISOR_arch_0-(.-compat_hypercall_args_table) .byte 0 /* compat_ni_hypercall */ .endr
xen/arch/x86/x86_64/entry.S +2 -0
@@ -699,6 +699,7 @@ ENTRY(hypercall_table) .quad do_domctl .quad do_kexec_op .quad do_tmem_op + .quad do_v4v_op .rept __HYPERVISOR_arch_0-((.-hypercall_table)/8) .quad do_ni_hypercall .endr
@@ -747,6 +748,7 @@ ENTRY(hypercall_args_table) .byte 1 /* do_domctl */ .byte 2 /* do_kexec */ .byte 1 /* do_tmem_op */ + .byte 6 /* do_v4v_op */ .rept __HYPERVISOR_arch_0-(.-hypercall_args_table) .byte 0 /* do_ni_hypercall */ .endr
xen/common/Makefile +1 -0
@@ -45,6 +45,7 @@ obj-y += tmem_xen.o obj-y += radix-tree.o obj-y += rbtree.o obj-y += lzo.o +obj-y += v4v.o obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz unlzma unlzo,$(n).init.o)
xen/common/domain.c +10 -1
@@ -195,7 +195,8 @@ struct domain *domain_create( {struct domain *d, **pd;enum { INIT_xsm =1u <<0 , INIT_watchdog =1u <<1 , INIT_rangeset =1u <<2 , - INIT_evtchn =1u <<3 , INIT_gnttab =1u <<4 , INIT_arch =1u <<5 }; + INIT_evtchn =1u <<3 , INIT_gnttab =1u <<4 , INIT_arch =1u <<5 , + INIT_v4v =1u <<6 };int init_status =0 ;int poolid =CPUPOOLID_NONE ;
@@ -219,6 +220,7 @@ struct domain *domain_create(spin_lock_init (&d->hypercall_deadlock_mutex);INIT_PAGE_LIST_HEAD (&d->page_list);INIT_PAGE_LIST_HEAD (&d->xenpage_list); +rwlock_init (&d->v4v_lock);spin_lock_init (&d->node_affinity_lock); d->node_affinity =NODE_MASK_ALL ;
@@ -274,6 +276,10 @@ struct domain *domain_create( goto fail; init_status |= INIT_gnttab; +if (v4v_init (d) !=0 ) + goto fail; + init_status |= INIT_v4v; + poolid =0 ; d->mem_event = xzalloc(struct mem_event_per_domain);
@@ -313,6 +319,8 @@ struct domain *domain_create(xfree (d->mem_event);if ( init_status & INIT_arch )arch_domain_destroy (d); +if ( init_status & INIT_v4v ) +v4v_destroy (d);if ( init_status & INIT_gnttab )grant_table_destroy (d);if ( init_status & INIT_evtchn )
@@ -466,6 +474,7 @@ int domain_kill(struct domain *d)domain_pause (d); d->is_dying = DOMDYING_dying;spin_barrier (&d->domain_lock); +v4v_destroy (d);evtchn_destroy (d);gnttab_release_mappings (d);tmem_destroy (d->tmem);
xen/common/v4v.c new file +1779 -0
1,779 lines not on this page · raw message
xen/include/public/v4v.h new file +544 -0
544 lines not on this page · raw message
xen/include/public/xen.h +1 -1
@@ -99,7 +99,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);#define __HYPERVISOR_domctl 36#define __HYPERVISOR_kexec_op 37#define __HYPERVISOR_tmem_op 38 -#define __HYPERVISOR_xc_reserved_op 39/* reserved for XenClient */ +#define __HYPERVISOR_v4v_op 39/* Architecture-specific hypercall definitions. */ #define __HYPERVISOR_arch_0 48
xen/include/xen/sched.h +5 -0
@@ -23,6 +23,7 @@#include <public/sysctl.h> #include <public/vcpu.h> #include <public/mem_event.h> +#include <xen/v4v.h> #ifdef CONFIG_COMPAT #include <compat/vcpu.h>
@@ -350,6 +351,10 @@ struct domainnodemask_t node_affinity;unsigned int last_alloc_node;spinlock_t node_affinity_lock; + +/* v4v */ +rwlock_t v4v_lock; +struct v4v_domain *v4v; };struct domain_setup_info
xen/include/xen/v4v.h new file +109 -0
109 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel