LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls
@ 2015-01-21  7:49 Juergen Gross
  2015-01-21  7:49 ` [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols Juergen Gross
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Juergen Gross @ 2015-01-21  7:49 UTC (permalink / raw)
  To: linux-kernel, x86, xen-devel, konrad.wilk, david.vrabel,
	boris.ostrovsky, tglx, mingo, hpa, mmarek, linux-kbuild
  Cc: Juergen Gross

The Xen hypercalls are defined in include/xen/interface/xen.h. There
are some places where for each hypercall a table element is created.
Instead of manually add each hypercall element to these tables use
an auto generated header built during the make process of the kernel.

Changes in V2:
- add "autogenerated" comment to generated header file as suggested by
  David Vrabel (patch 1)
- some minor adjustments to patch 4 as suggested by David Vrabel

Juergen Gross (4):
  xen: build infrastructure for generating hypercall depending symbols
  xen: synchronize include/xen/interface/xen.h with xen
  xen: use generated hypervisor symbols in arch/x86/xen/trace.c
  xen: use generated hypercall symbols in arch/x86/xen/xen-head.S

 arch/x86/syscalls/Makefile  |  9 +++++++
 arch/x86/xen/trace.c        | 50 +++--------------------------------
 arch/x86/xen/xen-head.S     | 63 +++++++--------------------------------------
 include/xen/interface/xen.h |  6 ++++-
 scripts/xen-hypercalls.sh   | 12 +++++++++
 5 files changed, 40 insertions(+), 100 deletions(-)
 create mode 100644 scripts/xen-hypercalls.sh

-- 
2.1.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols
  2015-01-21  7:49 [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls Juergen Gross
@ 2015-01-21  7:49 ` Juergen Gross
  2015-01-28  5:11   ` Juergen Gross
                     ` (2 more replies)
  2015-01-21  7:49 ` [RESEND Patch V2 2/4] xen: synchronize include/xen/interface/xen.h with xen Juergen Gross
                   ` (3 subsequent siblings)
  4 siblings, 3 replies; 11+ messages in thread
From: Juergen Gross @ 2015-01-21  7:49 UTC (permalink / raw)
  To: linux-kernel, x86, xen-devel, konrad.wilk, david.vrabel,
	boris.ostrovsky, tglx, mingo, hpa, mmarek, linux-kbuild
  Cc: Juergen Gross

Today there are several places in the kernel which build tables
containing one entry for each possible Xen hypercall. Create an
infrastructure to be able to generate these tables at build time.

Based-on-patch-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
---
 arch/x86/syscalls/Makefile |  9 +++++++++
 scripts/xen-hypercalls.sh  | 12 ++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 scripts/xen-hypercalls.sh

diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile
index 3323c27..a55abb9 100644
--- a/arch/x86/syscalls/Makefile
+++ b/arch/x86/syscalls/Makefile
@@ -19,6 +19,9 @@ quiet_cmd_syshdr = SYSHDR  $@
 quiet_cmd_systbl = SYSTBL  $@
       cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@
 
+quiet_cmd_hypercalls = HYPERCALLS $@
+      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<,$^)
+
 syshdr_abi_unistd_32 := i386
 $(uapi)/unistd_32.h: $(syscall32) $(syshdr)
 	$(call if_changed,syshdr)
@@ -47,10 +50,16 @@ $(out)/syscalls_32.h: $(syscall32) $(systbl)
 $(out)/syscalls_64.h: $(syscall64) $(systbl)
 	$(call if_changed,systbl)
 
+$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh
+	$(call if_changed,hypercalls)
+
+$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
+
 uapisyshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
 syshdr-y			+= syscalls_32.h
 syshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
 syshdr-$(CONFIG_X86_64)		+= syscalls_64.h
+syshdr-$(CONFIG_XEN)		+= xen-hypercalls.h
 
 targets	+= $(uapisyshdr-y) $(syshdr-y)
 
diff --git a/scripts/xen-hypercalls.sh b/scripts/xen-hypercalls.sh
new file mode 100644
index 0000000..676d922
--- /dev/null
+++ b/scripts/xen-hypercalls.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+out="$1"
+shift
+in="$@"
+
+for i in $in; do
+	eval $CPP $LINUXINCLUDE -dD -imacros "$i" -x c /dev/null
+done | \
+awk '$1 == "#define" && $2 ~ /__HYPERVISOR_[a-z][a-z_0-9]*/ { v[$3] = $2 }
+	END {   print "/* auto-generated by scripts/xen-hypercall.sh */"
+		for (i in v) if (!(v[i] in v))
+			print "HYPERCALL("substr(v[i], 14)")"}' | sort -u >$out
-- 
2.1.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RESEND Patch V2 2/4] xen: synchronize include/xen/interface/xen.h with xen
  2015-01-21  7:49 [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls Juergen Gross
  2015-01-21  7:49 ` [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols Juergen Gross
@ 2015-01-21  7:49 ` Juergen Gross
  2015-01-21  7:49 ` [RESEND Patch V2 3/4] xen: use generated hypervisor symbols in arch/x86/xen/trace.c Juergen Gross
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Juergen Gross @ 2015-01-21  7:49 UTC (permalink / raw)
  To: linux-kernel, x86, xen-devel, konrad.wilk, david.vrabel,
	boris.ostrovsky, tglx, mingo, hpa, mmarek, linux-kbuild
  Cc: Juergen Gross

The header include/xen/interface/xen.h doesn't contain all definitions
from Xen's version of that header. Update it accordingly.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
---
 arch/x86/xen/trace.c        | 2 +-
 include/xen/interface/xen.h | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/xen/trace.c b/arch/x86/xen/trace.c
index 520022d..8296cdf 100644
--- a/arch/x86/xen/trace.c
+++ b/arch/x86/xen/trace.c
@@ -29,7 +29,7 @@ static const char *xen_hypercall_names[] = {
 	N(vcpu_op),
 	N(set_segment_base),
 	N(mmuext_op),
-	N(acm_op),
+	N(xsm_op),
 	N(nmi_op),
 	N(sched_op),
 	N(callback_op),
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index f68719f..a483789 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -67,7 +67,7 @@
 #define __HYPERVISOR_vcpu_op              24
 #define __HYPERVISOR_set_segment_base     25 /* x86/64 only */
 #define __HYPERVISOR_mmuext_op            26
-#define __HYPERVISOR_acm_op               27
+#define __HYPERVISOR_xsm_op               27
 #define __HYPERVISOR_nmi_op               28
 #define __HYPERVISOR_sched_op             29
 #define __HYPERVISOR_callback_op          30
@@ -75,7 +75,11 @@
 #define __HYPERVISOR_event_channel_op     32
 #define __HYPERVISOR_physdev_op           33
 #define __HYPERVISOR_hvm_op               34
+#define __HYPERVISOR_sysctl               35
+#define __HYPERVISOR_domctl               36
+#define __HYPERVISOR_kexec_op             37
 #define __HYPERVISOR_tmem_op              38
+#define __HYPERVISOR_xc_reserved_op       39 /* reserved for XenClient */
 
 /* Architecture-specific hypercall definitions. */
 #define __HYPERVISOR_arch_0               48
-- 
2.1.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RESEND Patch V2 3/4] xen: use generated hypervisor symbols in arch/x86/xen/trace.c
  2015-01-21  7:49 [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls Juergen Gross
  2015-01-21  7:49 ` [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols Juergen Gross
  2015-01-21  7:49 ` [RESEND Patch V2 2/4] xen: synchronize include/xen/interface/xen.h with xen Juergen Gross
@ 2015-01-21  7:49 ` Juergen Gross
  2015-01-21  7:49 ` [RESEND Patch V2 4/4] xen: use generated hypercall symbols in arch/x86/xen/xen-head.S Juergen Gross
  2015-03-02 11:00 ` [Xen-devel] [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls David Vrabel
  4 siblings, 0 replies; 11+ messages in thread
From: Juergen Gross @ 2015-01-21  7:49 UTC (permalink / raw)
  To: linux-kernel, x86, xen-devel, konrad.wilk, david.vrabel,
	boris.ostrovsky, tglx, mingo, hpa, mmarek, linux-kbuild
  Cc: Juergen Gross

Instead of manually list all hypervisor calls in arch/x86/xen/trace.c
use the auto generated list.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
---
 arch/x86/xen/trace.c | 50 ++++----------------------------------------------
 1 file changed, 4 insertions(+), 46 deletions(-)

diff --git a/arch/x86/xen/trace.c b/arch/x86/xen/trace.c
index 8296cdf..a702ec2 100644
--- a/arch/x86/xen/trace.c
+++ b/arch/x86/xen/trace.c
@@ -1,54 +1,12 @@
 #include <linux/ftrace.h>
 #include <xen/interface/xen.h>
+#include <xen/interface/xen-mca.h>
 
-#define N(x)	[__HYPERVISOR_##x] = "("#x")"
+#define HYPERCALL(x)	[__HYPERVISOR_##x] = "("#x")",
 static const char *xen_hypercall_names[] = {
-	N(set_trap_table),
-	N(mmu_update),
-	N(set_gdt),
-	N(stack_switch),
-	N(set_callbacks),
-	N(fpu_taskswitch),
-	N(sched_op_compat),
-	N(dom0_op),
-	N(set_debugreg),
-	N(get_debugreg),
-	N(update_descriptor),
-	N(memory_op),
-	N(multicall),
-	N(update_va_mapping),
-	N(set_timer_op),
-	N(event_channel_op_compat),
-	N(xen_version),
-	N(console_io),
-	N(physdev_op_compat),
-	N(grant_table_op),
-	N(vm_assist),
-	N(update_va_mapping_otherdomain),
-	N(iret),
-	N(vcpu_op),
-	N(set_segment_base),
-	N(mmuext_op),
-	N(xsm_op),
-	N(nmi_op),
-	N(sched_op),
-	N(callback_op),
-	N(xenoprof_op),
-	N(event_channel_op),
-	N(physdev_op),
-	N(hvm_op),
-
-/* Architecture-specific hypercall definitions. */
-	N(arch_0),
-	N(arch_1),
-	N(arch_2),
-	N(arch_3),
-	N(arch_4),
-	N(arch_5),
-	N(arch_6),
-	N(arch_7),
+#include <asm/xen-hypercalls.h>
 };
-#undef N
+#undef HYPERCALL
 
 static const char *xen_hypercall_name(unsigned op)
 {
-- 
2.1.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RESEND Patch V2 4/4] xen: use generated hypercall symbols in arch/x86/xen/xen-head.S
  2015-01-21  7:49 [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls Juergen Gross
                   ` (2 preceding siblings ...)
  2015-01-21  7:49 ` [RESEND Patch V2 3/4] xen: use generated hypervisor symbols in arch/x86/xen/trace.c Juergen Gross
@ 2015-01-21  7:49 ` Juergen Gross
  2015-03-02 11:00 ` [Xen-devel] [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls David Vrabel
  4 siblings, 0 replies; 11+ messages in thread
From: Juergen Gross @ 2015-01-21  7:49 UTC (permalink / raw)
  To: linux-kernel, x86, xen-devel, konrad.wilk, david.vrabel,
	boris.ostrovsky, tglx, mingo, hpa, mmarek, linux-kbuild
  Cc: Juergen Gross

Instead of manually list each hypercall in arch/x86/xen/xen-head.S
use the auto generated symbol list.

This also corrects the wrong address of xen_hypercall_mca which was
located 32 bytes higher than it should.

Symbol addresses have been verified to match the correct ones via
objdump output.

Based-on-patch-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
---
 arch/x86/xen/xen-head.S | 63 ++++++++-----------------------------------------
 1 file changed, 10 insertions(+), 53 deletions(-)

diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 674b2225..8afdfcc 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -12,6 +12,8 @@
 
 #include <xen/interface/elfnote.h>
 #include <xen/interface/features.h>
+#include <xen/interface/xen.h>
+#include <xen/interface/xen-mca.h>
 #include <asm/xen/interface.h>
 
 #ifdef CONFIG_XEN_PVH
@@ -85,59 +87,14 @@ ENTRY(xen_pvh_early_cpu_init)
 .pushsection .text
 	.balign PAGE_SIZE
 ENTRY(hypercall_page)
-#define NEXT_HYPERCALL(x) \
-	ENTRY(xen_hypercall_##x) \
-	.skip 32
-
-NEXT_HYPERCALL(set_trap_table)
-NEXT_HYPERCALL(mmu_update)
-NEXT_HYPERCALL(set_gdt)
-NEXT_HYPERCALL(stack_switch)
-NEXT_HYPERCALL(set_callbacks)
-NEXT_HYPERCALL(fpu_taskswitch)
-NEXT_HYPERCALL(sched_op_compat)
-NEXT_HYPERCALL(platform_op)
-NEXT_HYPERCALL(set_debugreg)
-NEXT_HYPERCALL(get_debugreg)
-NEXT_HYPERCALL(update_descriptor)
-NEXT_HYPERCALL(ni)
-NEXT_HYPERCALL(memory_op)
-NEXT_HYPERCALL(multicall)
-NEXT_HYPERCALL(update_va_mapping)
-NEXT_HYPERCALL(set_timer_op)
-NEXT_HYPERCALL(event_channel_op_compat)
-NEXT_HYPERCALL(xen_version)
-NEXT_HYPERCALL(console_io)
-NEXT_HYPERCALL(physdev_op_compat)
-NEXT_HYPERCALL(grant_table_op)
-NEXT_HYPERCALL(vm_assist)
-NEXT_HYPERCALL(update_va_mapping_otherdomain)
-NEXT_HYPERCALL(iret)
-NEXT_HYPERCALL(vcpu_op)
-NEXT_HYPERCALL(set_segment_base)
-NEXT_HYPERCALL(mmuext_op)
-NEXT_HYPERCALL(xsm_op)
-NEXT_HYPERCALL(nmi_op)
-NEXT_HYPERCALL(sched_op)
-NEXT_HYPERCALL(callback_op)
-NEXT_HYPERCALL(xenoprof_op)
-NEXT_HYPERCALL(event_channel_op)
-NEXT_HYPERCALL(physdev_op)
-NEXT_HYPERCALL(hvm_op)
-NEXT_HYPERCALL(sysctl)
-NEXT_HYPERCALL(domctl)
-NEXT_HYPERCALL(kexec_op)
-NEXT_HYPERCALL(tmem_op) /* 38 */
-ENTRY(xen_hypercall_rsvr)
-	.skip 320
-NEXT_HYPERCALL(mca) /* 48 */
-NEXT_HYPERCALL(arch_1)
-NEXT_HYPERCALL(arch_2)
-NEXT_HYPERCALL(arch_3)
-NEXT_HYPERCALL(arch_4)
-NEXT_HYPERCALL(arch_5)
-NEXT_HYPERCALL(arch_6)
-	.balign PAGE_SIZE
+	.skip PAGE_SIZE
+
+#define HYPERCALL(n) \
+	.equ xen_hypercall_##n, hypercall_page + __HYPERVISOR_##n * 32; \
+	.type xen_hypercall_##n, @function; .size xen_hypercall_##n, 32
+#include <asm/xen-hypercalls.h>
+#undef HYPERCALL
+
 .popsection
 
 	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz "linux")
-- 
2.1.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols
  2015-01-21  7:49 ` [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols Juergen Gross
@ 2015-01-28  5:11   ` Juergen Gross
  2015-02-06 15:00     ` Juergen Gross
  2015-02-19  0:00     ` Ingo Molnar
  2015-02-13  5:33   ` Juergen Gross
  2015-02-18 23:59   ` Ingo Molnar
  2 siblings, 2 replies; 11+ messages in thread
From: Juergen Gross @ 2015-01-28  5:11 UTC (permalink / raw)
  To: linux-kernel, x86, xen-devel, konrad.wilk, david.vrabel,
	boris.ostrovsky, tglx, mingo, hpa, mmarek, linux-kbuild

*Ping*

David wants a comment from the x86 maintainers.


Juergen

On 01/21/2015 08:49 AM, Juergen Gross wrote:
> Today there are several places in the kernel which build tables
> containing one entry for each possible Xen hypercall. Create an
> infrastructure to be able to generate these tables at build time.
>
> Based-on-patch-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: David Vrabel <david.vrabel@citrix.com>
> ---
>   arch/x86/syscalls/Makefile |  9 +++++++++
>   scripts/xen-hypercalls.sh  | 12 ++++++++++++
>   2 files changed, 21 insertions(+)
>   create mode 100644 scripts/xen-hypercalls.sh
>
> diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile
> index 3323c27..a55abb9 100644
> --- a/arch/x86/syscalls/Makefile
> +++ b/arch/x86/syscalls/Makefile
> @@ -19,6 +19,9 @@ quiet_cmd_syshdr = SYSHDR  $@
>   quiet_cmd_systbl = SYSTBL  $@
>         cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@
>
> +quiet_cmd_hypercalls = HYPERCALLS $@
> +      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<,$^)
> +
>   syshdr_abi_unistd_32 := i386
>   $(uapi)/unistd_32.h: $(syscall32) $(syshdr)
>   	$(call if_changed,syshdr)
> @@ -47,10 +50,16 @@ $(out)/syscalls_32.h: $(syscall32) $(systbl)
>   $(out)/syscalls_64.h: $(syscall64) $(systbl)
>   	$(call if_changed,systbl)
>
> +$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh
> +	$(call if_changed,hypercalls)
> +
> +$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
> +
>   uapisyshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
>   syshdr-y			+= syscalls_32.h
>   syshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
>   syshdr-$(CONFIG_X86_64)		+= syscalls_64.h
> +syshdr-$(CONFIG_XEN)		+= xen-hypercalls.h
>
>   targets	+= $(uapisyshdr-y) $(syshdr-y)
>
> diff --git a/scripts/xen-hypercalls.sh b/scripts/xen-hypercalls.sh
> new file mode 100644
> index 0000000..676d922
> --- /dev/null
> +++ b/scripts/xen-hypercalls.sh
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +out="$1"
> +shift
> +in="$@"
> +
> +for i in $in; do
> +	eval $CPP $LINUXINCLUDE -dD -imacros "$i" -x c /dev/null
> +done | \
> +awk '$1 == "#define" && $2 ~ /__HYPERVISOR_[a-z][a-z_0-9]*/ { v[$3] = $2 }
> +	END {   print "/* auto-generated by scripts/xen-hypercall.sh */"
> +		for (i in v) if (!(v[i] in v))
> +			print "HYPERCALL("substr(v[i], 14)")"}' | sort -u >$out
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols
  2015-01-28  5:11   ` Juergen Gross
@ 2015-02-06 15:00     ` Juergen Gross
  2015-02-19  0:00     ` Ingo Molnar
  1 sibling, 0 replies; 11+ messages in thread
From: Juergen Gross @ 2015-02-06 15:00 UTC (permalink / raw)
  To: x86, tglx, mingo, hpa
  Cc: linux-kernel, xen-devel, konrad.wilk, david.vrabel,
	boris.ostrovsky, mmarek, linux-kbuild

Hey, x86 maintainers!

could you please comment?


Juergen

On 01/28/2015 06:11 AM, Juergen Gross wrote:
> *Ping*
>
> David wants a comment from the x86 maintainers.
>
>
> Juergen
>
> On 01/21/2015 08:49 AM, Juergen Gross wrote:
>> Today there are several places in the kernel which build tables
>> containing one entry for each possible Xen hypercall. Create an
>> infrastructure to be able to generate these tables at build time.
>>
>> Based-on-patch-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> Reviewed-by: David Vrabel <david.vrabel@citrix.com>
>> ---
>>   arch/x86/syscalls/Makefile |  9 +++++++++
>>   scripts/xen-hypercalls.sh  | 12 ++++++++++++
>>   2 files changed, 21 insertions(+)
>>   create mode 100644 scripts/xen-hypercalls.sh
>>
>> diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile
>> index 3323c27..a55abb9 100644
>> --- a/arch/x86/syscalls/Makefile
>> +++ b/arch/x86/syscalls/Makefile
>> @@ -19,6 +19,9 @@ quiet_cmd_syshdr = SYSHDR  $@
>>   quiet_cmd_systbl = SYSTBL  $@
>>         cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@
>>
>> +quiet_cmd_hypercalls = HYPERCALLS $@
>> +      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<,$^)
>> +
>>   syshdr_abi_unistd_32 := i386
>>   $(uapi)/unistd_32.h: $(syscall32) $(syshdr)
>>       $(call if_changed,syshdr)
>> @@ -47,10 +50,16 @@ $(out)/syscalls_32.h: $(syscall32) $(systbl)
>>   $(out)/syscalls_64.h: $(syscall64) $(systbl)
>>       $(call if_changed,systbl)
>>
>> +$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh
>> +    $(call if_changed,hypercalls)
>> +
>> +$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
>> +
>>   uapisyshdr-y            += unistd_32.h unistd_64.h unistd_x32.h
>>   syshdr-y            += syscalls_32.h
>>   syshdr-$(CONFIG_X86_64)        += unistd_32_ia32.h unistd_64_x32.h
>>   syshdr-$(CONFIG_X86_64)        += syscalls_64.h
>> +syshdr-$(CONFIG_XEN)        += xen-hypercalls.h
>>
>>   targets    += $(uapisyshdr-y) $(syshdr-y)
>>
>> diff --git a/scripts/xen-hypercalls.sh b/scripts/xen-hypercalls.sh
>> new file mode 100644
>> index 0000000..676d922
>> --- /dev/null
>> +++ b/scripts/xen-hypercalls.sh
>> @@ -0,0 +1,12 @@
>> +#!/bin/sh
>> +out="$1"
>> +shift
>> +in="$@"
>> +
>> +for i in $in; do
>> +    eval $CPP $LINUXINCLUDE -dD -imacros "$i" -x c /dev/null
>> +done | \
>> +awk '$1 == "#define" && $2 ~ /__HYPERVISOR_[a-z][a-z_0-9]*/ { v[$3] =
>> $2 }
>> +    END {   print "/* auto-generated by scripts/xen-hypercall.sh */"
>> +        for (i in v) if (!(v[i] in v))
>> +            print "HYPERCALL("substr(v[i], 14)")"}' | sort -u >$out
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols
  2015-01-21  7:49 ` [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols Juergen Gross
  2015-01-28  5:11   ` Juergen Gross
@ 2015-02-13  5:33   ` Juergen Gross
  2015-02-18 23:59   ` Ingo Molnar
  2 siblings, 0 replies; 11+ messages in thread
From: Juergen Gross @ 2015-02-13  5:33 UTC (permalink / raw)
  To: x86, tglx, mingo, hpa
  Cc: linux-kernel, xen-devel, konrad.wilk, david.vrabel,
	boris.ostrovsky, mmarek, linux-kbuild

  ######   ###  #     #   #####
  #     #   #   ##    #  #     #
  #     #   #   # #   #  #
  ######    #   #  #  #  #  ####
  #         #   #   # #  #     #
  #         #   #    ##  #     #
  #        ###  #     #   #####

David still wants a comment from the x86 maintainers...

Juergen

On 01/21/2015 08:49 AM, Juergen Gross wrote:
> Today there are several places in the kernel which build tables
> containing one entry for each possible Xen hypercall. Create an
> infrastructure to be able to generate these tables at build time.
>
> Based-on-patch-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: David Vrabel <david.vrabel@citrix.com>
> ---
>   arch/x86/syscalls/Makefile |  9 +++++++++
>   scripts/xen-hypercalls.sh  | 12 ++++++++++++
>   2 files changed, 21 insertions(+)
>   create mode 100644 scripts/xen-hypercalls.sh
>
> diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile
> index 3323c27..a55abb9 100644
> --- a/arch/x86/syscalls/Makefile
> +++ b/arch/x86/syscalls/Makefile
> @@ -19,6 +19,9 @@ quiet_cmd_syshdr = SYSHDR  $@
>   quiet_cmd_systbl = SYSTBL  $@
>         cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@
>
> +quiet_cmd_hypercalls = HYPERCALLS $@
> +      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<,$^)
> +
>   syshdr_abi_unistd_32 := i386
>   $(uapi)/unistd_32.h: $(syscall32) $(syshdr)
>   	$(call if_changed,syshdr)
> @@ -47,10 +50,16 @@ $(out)/syscalls_32.h: $(syscall32) $(systbl)
>   $(out)/syscalls_64.h: $(syscall64) $(systbl)
>   	$(call if_changed,systbl)
>
> +$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh
> +	$(call if_changed,hypercalls)
> +
> +$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
> +
>   uapisyshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
>   syshdr-y			+= syscalls_32.h
>   syshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
>   syshdr-$(CONFIG_X86_64)		+= syscalls_64.h
> +syshdr-$(CONFIG_XEN)		+= xen-hypercalls.h
>
>   targets	+= $(uapisyshdr-y) $(syshdr-y)
>
> diff --git a/scripts/xen-hypercalls.sh b/scripts/xen-hypercalls.sh
> new file mode 100644
> index 0000000..676d922
> --- /dev/null
> +++ b/scripts/xen-hypercalls.sh
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +out="$1"
> +shift
> +in="$@"
> +
> +for i in $in; do
> +	eval $CPP $LINUXINCLUDE -dD -imacros "$i" -x c /dev/null
> +done | \
> +awk '$1 == "#define" && $2 ~ /__HYPERVISOR_[a-z][a-z_0-9]*/ { v[$3] = $2 }
> +	END {   print "/* auto-generated by scripts/xen-hypercall.sh */"
> +		for (i in v) if (!(v[i] in v))
> +			print "HYPERCALL("substr(v[i], 14)")"}' | sort -u >$out
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols
  2015-01-21  7:49 ` [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols Juergen Gross
  2015-01-28  5:11   ` Juergen Gross
  2015-02-13  5:33   ` Juergen Gross
@ 2015-02-18 23:59   ` Ingo Molnar
  2 siblings, 0 replies; 11+ messages in thread
From: Ingo Molnar @ 2015-02-18 23:59 UTC (permalink / raw)
  To: Juergen Gross
  Cc: linux-kernel, x86, xen-devel, konrad.wilk, david.vrabel,
	boris.ostrovsky, tglx, mingo, hpa, mmarek, linux-kbuild


* Juergen Gross <jgross@suse.com> wrote:

> Today there are several places in the kernel which build tables
> containing one entry for each possible Xen hypercall. Create an
> infrastructure to be able to generate these tables at build time.
> 
> Based-on-patch-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: David Vrabel <david.vrabel@citrix.com>
> ---
>  arch/x86/syscalls/Makefile |  9 +++++++++
>  scripts/xen-hypercalls.sh  | 12 ++++++++++++
>  2 files changed, 21 insertions(+)
>  create mode 100644 scripts/xen-hypercalls.sh
> 
> diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile
> index 3323c27..a55abb9 100644
> --- a/arch/x86/syscalls/Makefile
> +++ b/arch/x86/syscalls/Makefile
> @@ -19,6 +19,9 @@ quiet_cmd_syshdr = SYSHDR  $@
>  quiet_cmd_systbl = SYSTBL  $@
>        cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@
>  
> +quiet_cmd_hypercalls = HYPERCALLS $@
> +      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<,$^)
> +
>  syshdr_abi_unistd_32 := i386
>  $(uapi)/unistd_32.h: $(syscall32) $(syshdr)
>  	$(call if_changed,syshdr)
> @@ -47,10 +50,16 @@ $(out)/syscalls_32.h: $(syscall32) $(systbl)
>  $(out)/syscalls_64.h: $(syscall64) $(systbl)
>  	$(call if_changed,systbl)
>  
> +$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh
> +	$(call if_changed,hypercalls)
> +
> +$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
> +
>  uapisyshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
>  syshdr-y			+= syscalls_32.h
>  syshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
>  syshdr-$(CONFIG_X86_64)		+= syscalls_64.h
> +syshdr-$(CONFIG_XEN)		+= xen-hypercalls.h
>  
>  targets	+= $(uapisyshdr-y) $(syshdr-y)

>From a core x86 perspective:

Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols
  2015-01-28  5:11   ` Juergen Gross
  2015-02-06 15:00     ` Juergen Gross
@ 2015-02-19  0:00     ` Ingo Molnar
  1 sibling, 0 replies; 11+ messages in thread
From: Ingo Molnar @ 2015-02-19  0:00 UTC (permalink / raw)
  To: Juergen Gross
  Cc: linux-kernel, x86, xen-devel, konrad.wilk, david.vrabel,
	boris.ostrovsky, tglx, mingo, hpa, mmarek, linux-kbuild


* Juergen Gross <jgross@suse.com> wrote:

> *Ping*
> 
> David wants a comment from the x86 maintainers.

Well, I guess the 'xen: ...' title made us all to skip it 
and then it was all just shouting at us within a Xen thread 
we never read? :-)

You could change the title to something more exciting next 
time around.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Xen-devel] [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls
  2015-01-21  7:49 [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls Juergen Gross
                   ` (3 preceding siblings ...)
  2015-01-21  7:49 ` [RESEND Patch V2 4/4] xen: use generated hypercall symbols in arch/x86/xen/xen-head.S Juergen Gross
@ 2015-03-02 11:00 ` David Vrabel
  4 siblings, 0 replies; 11+ messages in thread
From: David Vrabel @ 2015-03-02 11:00 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, x86, xen-devel, konrad.wilk,
	david.vrabel, boris.ostrovsky, tglx, mingo, hpa, mmarek,
	linux-kbuild

On 21/01/15 07:49, Juergen Gross wrote:
> The Xen hypercalls are defined in include/xen/interface/xen.h. There
> are some places where for each hypercall a table element is created.
> Instead of manually add each hypercall element to these tables use
> an auto generated header built during the make process of the kernel.

Applied to devel/for-linus-4.1, thanks.

David

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-03-02 11:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21  7:49 [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls Juergen Gross
2015-01-21  7:49 ` [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols Juergen Gross
2015-01-28  5:11   ` Juergen Gross
2015-02-06 15:00     ` Juergen Gross
2015-02-19  0:00     ` Ingo Molnar
2015-02-13  5:33   ` Juergen Gross
2015-02-18 23:59   ` Ingo Molnar
2015-01-21  7:49 ` [RESEND Patch V2 2/4] xen: synchronize include/xen/interface/xen.h with xen Juergen Gross
2015-01-21  7:49 ` [RESEND Patch V2 3/4] xen: use generated hypervisor symbols in arch/x86/xen/trace.c Juergen Gross
2015-01-21  7:49 ` [RESEND Patch V2 4/4] xen: use generated hypercall symbols in arch/x86/xen/xen-head.S Juergen Gross
2015-03-02 11:00 ` [Xen-devel] [RESEND Patch V2 0/4] xen: auto-generate symbols for xen hypercalls David Vrabel

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).