Skip to contentSkip to conversation

RFC: xencomm in common

PATCH Tristan Gingold 4 participants 8 messages Aug 21, 2006 – Aug 24, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

xencomm is the ppc infrastructure to do hypercalls with guest physical addresses instead of virtual address.

Because ia64 should also use physicall address, I think it's better to re-use the ppc code and to put into common code.

I'd propose to submit this patch is every part is OK (ie no NAK).

This patch creates include/xen/xencomm_access.h which is to be included by asm/guest_access.h. It also creates common/xencomm.c which is compiled only if HAS_XENCOMM is y in Rules.mk.

Arch using xencomm should defines a few arch-specific macros and function.

I will submit the linux side soon.

Tristan.

xen/common/Makefile +2 -0
diff -r 1a542420ccf4 xen/common/Makefile
@@ -26,6 +26,8 @@ obj-y += vsprintf.o
 obj-y += vsprintf.o
 obj-y += xmalloc.o
 
+obj-$(HAS_XENCOMM) += xencomm.o
+
 obj-$(perfc)       += perfc.o
 obj-$(crash_debug) += gdbstub.o
 
xen/include/public/xencomm.h +11 -0
diff -r 1a542420ccf4 xen/include/public/xencomm.h
@@ -34,4 +34,15 @@ struct xencomm_desc {
     uint64_t address[0];
 };
 
+/* Inline Xencomm.
+   If the inline flag is set, the descriptor is simply a the flagged
+   physical address of the buffer which is known to be contiguous in
+   physical memory.  Because the kernels are often 1:1 mapped, this is
+   interesting for kernel issued hypercalls.  */
+/* These macros should be defined by arch-xxx.h:
+   XENCOMM_IS_INLINE(addr): true if ADDR is an inline address.
+   XENCOMM_INLINE_ADDR(addr): extract the physical address (as an unsigned).
+   XENCOMM_INLINE_MAKE(addr): flag ADDR and returns an unsigned.
+*/
+
 #endif /* _XEN_XENCOMM_H_ */
xen/common/xencomm.c new file +316 -0

316 lines not on this page · raw message

xen/include/xen/xencomm_access.h new file +107 -0

107 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 11 lines · Tristan Gingold

xencomm is the ppc infrastructure to do hypercalls with guest physical addresses instead of virtual address.

Because ia64 should also use physicall address, I think it's better to re-use the ppc code and to put into common code.

I'd propose to submit this patch is every part is OK (ie no NAK).

This patch creates include/xen/xencomm_access.h which is to be included by asm/guest_access.h. It also creates common/xencomm.c which is compiled only if HAS_XENCOMM is y in Rules.mk.

Fine in principle. Specific comments:
* powerpc should be cleaned up at the same time to use the common
infrastructure. I don't want duplicated code hanging around in arch/powerpc
* The code you add to common/ should obey the coding style of other files
in that directory
* Arguably we should have an asm-generic for the xencomm guest-access
macros. That's a Linux-ism which I think fits well in this particular case.

-- Keir

#2 lore raw
Quoted 9 lines · Keir Fraser
Quoted 8 lines · Tristan Gingold

xencomm is the ppc infrastructure to do hypercalls with guest physical addresses instead of virtual address.

Because ia64 should also use physicall address, I think it's better to re-use the ppc code and to put into common code.

I'd propose to submit this patch is every part is OK (ie no NAK).

Quoted 7 lines
Quoted 3 lines

This patch creates include/xen/xencomm_access.h which is to be included by asm/guest_access.h. It also creates common/xencomm.c which is compiled only if HAS_XENCOMM is y in Rules.mk.

Fine in principle. Specific comments:
* powerpc should be cleaned up at the same time to use the common
infrastructure. I don't want duplicated code hanging around in arch/powerpc

I have attached a blindly-made patch again powerpc files. If ppc people could check this, I'd be happy.

Quoted 4 lines

* The code you add to common/ should obey the coding style of other files
in that directory
* Arguably we should have an asm-generic for the xencomm guest-access
macros. That's a Linux-ism which I think fits well in this particular case.

Taken into account in this updated patch.

Tristan.

xen/common/Makefile +2 -0
diff -r d42e9a6f5378 xen/common/Makefile
@@ -26,6 +26,8 @@ obj-y += vsprintf.o
 obj-y += vsprintf.o
 obj-y += xmalloc.o
 
+obj-$(HAS_XENCOMM) += xencomm.o
+
 obj-$(perfc)       += perfc.o
 obj-$(crash_debug) += gdbstub.o
 
xen/include/public/xencomm.h +11 -0
diff -r d42e9a6f5378 xen/include/public/xencomm.h
@@ -34,4 +34,15 @@ struct xencomm_desc {
     uint64_t address[0];
 };
 
+/* Inline Xencomm.
+   If the inline flag is set, the descriptor is simply a the flagged
+   physical address of the buffer which is known to be contiguous in
+   physical memory.  Because the kernels are often 1:1 mapped, this is
+   interesting for kernel issued hypercalls.  */
+/* These macros should be defined by arch-xxx.h:
+   XENCOMM_IS_INLINE(addr): true if ADDR is an inline address.
+   XENCOMM_INLINE_ADDR(addr): extract the physical address (as an unsigned).
+   XENCOMM_INLINE_MAKE(addr): flag ADDR and returns an unsigned.
+*/
+
 #endif /* _XEN_XENCOMM_H_ */
xen/common/xencomm.c new file +348 -0

348 lines not on this page · raw message

xen/include/asm-generic/xencomm_access.h new file +107 -0

107 lines not on this page · raw message

xen/arch/powerpc/usercopy.c +1 -187

198 lines not on this page · raw message

xen/include/asm-powerpc/guest_access.h +1 -77

83 lines not on this page · raw message

xen/include/public/arch-powerpc.h +6 -0
diff -r d42e9a6f5378 xen/include/public/arch-powerpc.h
@@ -114,6 +114,12 @@ struct arch_vcpu_info {
 
 /* Support for multi-processor guests. */
 #define MAX_VIRT_CPUS 32
+
+/* Currently powerpc doesn't use inline xencomm.  */
+#define XENCOMM_IS_INLINE(addr) 0
+#define XENCOMM_INLINE_ADDR(addr) 0
+#define XENCOMM_INLINE_CREATE(addr) 0
+
 #endif
 
 #endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 11 lines · Tristan Gingold
Quoted 3 lines

Fine in principle. Specific comments:
* powerpc should be cleaned up at the same time to use the common
infrastructure. I don't want duplicated code hanging around in arch/powerpc

I have attached a blindly-made patch again powerpc files. If ppc people could check this, I'd be happy.

Quoted 4 lines

* The code you add to common/ should obey the coding style of other files
in that directory
* Arguably we should have an asm-generic for the xencomm guest-access
macros. That's a Linux-ism which I think fits well in this particular case.

Taken into account in this updated patch.

Looks better. I assume you'll resend with signed-off-by when you want these applied.

-- Keir

#4 lore raw
Quoted 15 lines · Keir Fraser
Quoted 14 lines · Tristan Gingold
Quoted 4 lines

Fine in principle. Specific comments:
* powerpc should be cleaned up at the same time to use the common
infrastructure. I don't want duplicated code hanging around in arch/powerpc

I have attached a blindly-made patch again powerpc files. If ppc people could check this, I'd be happy.

Quoted 5 lines

* The code you add to common/ should obey the coding style of other
files in that directory
* Arguably we should have an asm-generic for the xencomm guest-access
macros. That's a Linux-ism which I think fits well in this particular case.

Quoted 4 lines
Quoted 1 line

Taken into account in this updated patch.

Looks better. I assume you'll resend with signed-off-by when you want these applied.

Hi,

here are the signed-off-by patches for xen.
I took the liberty to add Hollis Blanchard in signed-off-by of the first patch because he is the primary author of these files.

I don't know wether or not these patches should be put off beacause of the freeze, but they are a no-op for x86.

Tristan.

# HG changeset patch
# User gingold@virtu10
# Node ID cbe47a6938d17983c29d6baab5b6f81b9485451a # Parent 91169603a8e8dded9eba6cb6c3421b5d58a85a97 Xencomm in common code.

xen/common/Makefile +2 -0
diff -r 91169603a8e8 -r cbe47a6938d1 xen/common/Makefile
@@ -26,6 +26,8 @@ obj-y += vsprintf.o
 obj-y += vsprintf.o
 obj-y += xmalloc.o
 
+obj-$(HAS_XENCOMM) += xencomm.o
+
 obj-$(perfc)       += perfc.o
 obj-$(crash_debug) += gdbstub.o
 
xen/include/public/xencomm.h +11 -0
diff -r 91169603a8e8 -r cbe47a6938d1 xen/include/public/xencomm.h
@@ -34,4 +34,15 @@ struct xencomm_desc {
     uint64_t address[0];
 };
 
+/* Inline Xencomm.
+   If the inline flag is set, the descriptor is simply a the flagged
+   physical address of the buffer which is known to be contiguous in
+   physical memory.  Because the kernels are often 1:1 mapped, this is
+   interesting for kernel issued hypercalls.  */
+/* These macros should be defined by arch-xxx.h:
+   XENCOMM_IS_INLINE(addr): true if ADDR is an inline address.
+   XENCOMM_INLINE_ADDR(addr): extract the physical address (as an unsigned).
+   XENCOMM_INLINE_MAKE(addr): flag ADDR and returns an unsigned.
+*/
+
 #endif /* _XEN_XENCOMM_H_ */
xen/common/xencomm.c new file +348 -0

348 lines not on this page · raw message

xen/include/asm-generic/xencomm_access.h new file +107 -0

107 lines not on this page · raw message

# HG changeset patch
# User gingold@virtu10
# Node ID 38947373a0fad500aacb3f28b82f35f95ead73f9 # Parent cbe47a6938d17983c29d6baab5b6f81b9485451a Use common xencomm code.

xen/arch/powerpc/Rules.mk +1 -0
diff -r cbe47a6938d1 -r 38947373a0fa xen/arch/powerpc/Rules.mk
@@ -1,4 +1,5 @@ HAS_PPC64 := y
 HAS_PPC64 := y
+HAS_XENCOMM := y
 
 CC := $(CROSS_COMPILE)gcc
 LD := $(CROSS_COMPILE)ld
xen/arch/powerpc/usercopy.c +1 -187

198 lines not on this page · raw message

xen/include/asm-powerpc/guest_access.h +1 -77

83 lines not on this page · raw message

xen/include/public/arch-powerpc.h +6 -0
diff -r cbe47a6938d1 -r 38947373a0fa xen/include/public/arch-powerpc.h
@@ -114,6 +114,12 @@ struct arch_vcpu_info {
 
 /* Support for multi-processor guests. */
 #define MAX_VIRT_CPUS 32
+
+/* Currently powerpc doesn't use inline xencomm.  */
+#define XENCOMM_IS_INLINE(addr) 0
+#define XENCOMM_INLINE_ADDR(addr) 0
+#define XENCOMM_INLINE_CREATE(addr) 0
+
 #endif
 
 #endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw
Quoted 20 lines · Tristan Gingold

[-- text/plain, encoding quoted-printable, charset: iso-8859-1, 34 lines --]

Quoted 17 lines · Keir Fraser
Quoted 15 lines · Tristan Gingold
Quoted 4 lines

Fine in principle. Specific comments:
* powerpc should be cleaned up at the same time to use the common
infrastructure. I don't want duplicated code hanging around in arch/powerpc

I have attached a blindly-made patch again powerpc files. If ppc people could check this, I'd be happy.

Quoted 5 lines

* The code you add to common/ should obey the coding style of other
files in that directory
* Arguably we should have an asm-generic for the xencomm guest-access
macros. That's a Linux-ism which I think fits well in this particular case.

Taken into account in this updated patch.

Quoted 7 lines
Quoted 2 lines

Looks better. I assume you'll resend with signed-off-by when you want these applied.

Hi,

here are the signed-off-by patches for xen.
I took the liberty to add Hollis Blanchard in signed-off-by of the first patch because he is the primary author of these files.

I suspect that CC is better than Signed-Off in this case.

Signature · 3 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/
#6 lore raw
In reply to Tristan Gingold

Hi Tristan.
Since I looked the patch very roughly, I might be wrong and parania though.

xencomm_copy_from_guest(), xencomm_copy_to_guest() converts address, then acessses a page.
The Xen/IA64 P2M table is lockless so that the page can be freed by another cpu and used for other purpose at the same time. (Actually such a guest behaviour doesn't make sense, but possible.) get_page()/put_page() are necessary to prevent such a situation. Actually Xen/IA64's vcpu_get_domain_bundle() and efi_translate_domain_addr() do it.

Quoted 37 lines · Tristan Gingold
Quoted 15 lines · Keir Fraser
Quoted 14 lines · Tristan Gingold
Quoted 4 lines

Fine in principle. Specific comments:
* powerpc should be cleaned up at the same time to use the common
infrastructure. I don't want duplicated code hanging around in arch/powerpc

I have attached a blindly-made patch again powerpc files. If ppc people could check this, I'd be happy.

Quoted 5 lines

* The code you add to common/ should obey the coding style of other
files in that directory
* Arguably we should have an asm-generic for the xencomm guest-access
macros. That's a Linux-ism which I think fits well in this particular case.

Quoted 4 lines
Quoted 1 line

Taken into account in this updated patch.

Looks better. I assume you'll resend with signed-off-by when you want these applied.

Hi,

here are the signed-off-by patches for xen.
I took the liberty to add Hollis Blanchard in signed-off-by of the first patch because he is the primary author of these files.

I don't know wether or not these patches should be put off beacause of the freeze, but they are a no-op for x86.

Tristan.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 1 line
yamahata
#7 lore raw
Quoted 11 lines · Isaku Yamahata

Hi Tristan.
Since I looked the patch very roughly, I might be wrong and parania though.

xencomm_copy_from_guest(), xencomm_copy_to_guest() converts address, then acessses a page.
The Xen/IA64 P2M table is lockless so that the page can be freed by another cpu and used for other purpose at the same time. (Actually such a guest behaviour doesn't make sense, but possible.) get_page()/put_page() are necessary to prevent such a situation. Actually Xen/IA64's vcpu_get_domain_bundle() and efi_translate_domain_addr() do it.

Ok, I have to add get_page/put_page.
Thank you for the comment.

Tristan.