All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC for next] xen: make grant table configurable
@ 2019-01-17 12:30 Wei Liu
  2019-01-17 17:36 ` Stefano Stabellini
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Wei Liu @ 2019-01-17 12:30 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, Roger Pau Monné

Introduce CONFIG_GRANT_TABLE. Provide stubs and make sure x86 and arm
hypervisors build with grant table disabled.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
I did this when I worked on splitting PV and HVM and thought this
might be useful and it was simple enough to get done.

RFC because I can envisage some configurations in the distant future
do away with grant table and event channel. There is small a benefit
to consider accepting this patch now so that Gitlab's randconf build
can start testing with grant table turned off right away.
---
 xen/arch/arm/setup.c              |  3 ++-
 xen/arch/arm/traps.c              |  2 ++
 xen/arch/x86/hvm/Makefile         |  2 +-
 xen/arch/x86/hvm/hypercall.c      |  4 ++++
 xen/arch/x86/hypercall.c          |  2 ++
 xen/arch/x86/pv/Makefile          |  2 +-
 xen/arch/x86/pv/hypercall.c       |  2 ++
 xen/arch/x86/setup.c              |  6 +++--
 xen/common/Kconfig                | 11 +++++++++
 xen/common/Makefile               |  2 +-
 xen/include/asm-arm/grant_table.h |  4 +++-
 xen/include/xen/grant_table.h     | 49 +++++++++++++++++++++++++++++++++++++--
 12 files changed, 80 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 444857a967..3cd3513928 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -740,7 +740,8 @@ void __init start_xen(unsigned long boot_phys_offset,
         .flags = XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap,
         .max_evtchn_port = -1,
         .max_grant_frames = gnttab_dom0_frames(),
-        .max_maptrack_frames = opt_max_maptrack_frames,
+        .max_maptrack_frames = IS_ENABLED(CONFIG_GRANT_TABLE) ?
+                               opt_max_maptrack_frames : 0,
     };
 
     dcache_line_bytes = read_dcache_line_bytes();
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 221c762ada..0f1c1b6431 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1392,7 +1392,9 @@ static arm_hypercall_t arm_hypercall_table[] = {
     HYPERCALL_DEPRECATED(physdev_op_compat, 1),
     HYPERCALL(sysctl, 2),
     HYPERCALL(hvm_op, 2),
+#ifdef CONFIG_GRANT_TABLE
     HYPERCALL(grant_table_op, 3),
+#endif
     HYPERCALL(multicall, 2),
     HYPERCALL(platform_op, 1),
     HYPERCALL_ARM(vcpu_op, 3),
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 86b106f8e7..43e5f3a21f 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -7,7 +7,7 @@ obj-y += dm.o
 obj-bin-y += dom0_build.init.o
 obj-y += domain.o
 obj-y += emulate.o
-obj-y += grant_table.o
+obj-$(CONFIG_GRANT_TABLE) += grant_table.o
 obj-y += hpet.o
 obj-y += hvm.o
 obj-y += hypercall.o
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 19d126377a..1f667efc36 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -47,6 +47,7 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     return rc;
 }
 
+#ifdef CONFIG_GRANT_TABLE
 static long hvm_grant_table_op(
     unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, unsigned int count)
 {
@@ -71,6 +72,7 @@ static long hvm_grant_table_op(
     else
         return compat_grant_table_op(cmd, uop, count);
 }
+#endif
 
 static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
@@ -119,7 +121,9 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
 static const hypercall_table_t hvm_hypercall_table[] = {
     HVM_CALL(memory_op),
+#ifdef CONFIG_GRANT_TABLE
     HVM_CALL(grant_table_op),
+#endif
     COMPAT_CALL(vcpu_op),
     HVM_CALL(physdev_op),
     COMPAT_CALL(xen_version),
diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c
index 032de8f8f8..9311b63c1e 100644
--- a/xen/arch/x86/hypercall.c
+++ b/xen/arch/x86/hypercall.c
@@ -47,7 +47,9 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls] =
     ARGS(xen_version, 2),
     ARGS(console_io, 3),
     ARGS(physdev_op_compat, 1),
+#ifdef CONFIG_GRANT_TABLE
     ARGS(grant_table_op, 3),
+#endif
     ARGS(vm_assist, 2),
     COMP(update_va_mapping_otherdomain, 4, 5),
     ARGS(vcpu_op, 3),
diff --git a/xen/arch/x86/pv/Makefile b/xen/arch/x86/pv/Makefile
index 65bca04175..cf28434ba9 100644
--- a/xen/arch/x86/pv/Makefile
+++ b/xen/arch/x86/pv/Makefile
@@ -5,7 +5,7 @@ obj-y += emulate.o
 obj-y += emul-gate-op.o
 obj-y += emul-inv-op.o
 obj-y += emul-priv-op.o
-obj-y += grant_table.o
+obj-$(CONFIG_GRANT_TABLE) += grant_table.o
 obj-y += hypercall.o
 obj-y += iret.o
 obj-y += misc-hypercalls.o
diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index 5d11911735..ee0a6da515 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -53,7 +53,9 @@ const hypercall_table_t pv_hypercall_table[] = {
     COMPAT_CALL(xen_version),
     HYPERCALL(console_io),
     COMPAT_CALL(physdev_op_compat),
+#ifdef CONFIG_GRANT_TABLE
     COMPAT_CALL(grant_table_op),
+#endif
     COMPAT_CALL(vm_assist),
     COMPAT_CALL(update_va_mapping_otherdomain),
     COMPAT_CALL(iret),
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 06eb483cb4..09ef0e90df 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -686,8 +686,10 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     struct xen_domctl_createdomain dom0_cfg = {
         .flags = XEN_DOMCTL_CDF_s3_integrity,
         .max_evtchn_port = -1,
-        .max_grant_frames = opt_max_grant_frames,
-        .max_maptrack_frames = opt_max_maptrack_frames,
+        .max_grant_frames = IS_ENABLED(CONFIG_GRANT_TABLE) ?
+                            opt_max_grant_frames : 0,
+        .max_maptrack_frames = IS_ENABLED(CONFIG_GRANT_TABLE) ?
+                               opt_max_maptrack_frames : 0,
     };
 
     /* Critical region without IDT or TSS.  Any fault is deadly! */
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index a79cd40441..18e0be3d98 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -11,6 +11,17 @@ config COMPAT
 config CORE_PARKING
 	bool
 
+config GRANT_TABLE
+	bool "Grant table support"
+	default y
+	---help---
+	  Grant table provides a generic mechanism to memory sharing
+	  between domains. This shared memory interface underpins the
+	  split device drivers for block and network IO in a classic
+	  Xen setup.
+
+	  If unsure, say Y.
+
 config HAS_ALTERNATIVE
 	bool
 
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 56fc201b6b..e748554a44 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -10,7 +10,7 @@ obj-y += event_2l.o
 obj-y += event_channel.o
 obj-y += event_fifo.o
 obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o
-obj-y += grant_table.o
+obj-$(CONFIG_GRANT_TABLE) += grant_table.o
 obj-y += guestcopy.o
 obj-bin-y += gunzip.init.o
 obj-y += irq.o
diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h
index 816e3c6d68..50a07b8b17 100644
--- a/xen/include/asm-arm/grant_table.h
+++ b/xen/include/asm-arm/grant_table.h
@@ -31,7 +31,9 @@ void gnttab_mark_dirty(struct domain *d, mfn_t mfn);
  * enough space for a large grant table
  */
 #define gnttab_dom0_frames()                                             \
-    min_t(unsigned int, opt_max_grant_frames, PFN_DOWN(_etext - _stext))
+    min_t(unsigned int,                                                  \
+          IS_ENABLED(CONFIG_GRANT_TABLE) ? opt_max_grant_frames : 0,     \
+          PFN_DOWN(_etext - _stext))
 
 #define gnttab_init_arch(gt)                                             \
 ({                                                                       \
diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
index 12e8a4b80b..f0498df727 100644
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -29,11 +29,12 @@
 #include <asm/page.h>
 #include <asm/grant_table.h>
 
-struct grant_table;
-
 extern unsigned int opt_max_grant_frames;
 extern unsigned int opt_max_maptrack_frames;
 
+#ifdef CONFIG_GRANT_TABLE
+struct grant_table;
+
 /* Create/destroy per-domain grant table context. */
 int grant_table_init(struct domain *d, unsigned int max_grant_frames,
                      unsigned int max_maptrack_frames);
@@ -61,4 +62,48 @@ int gnttab_get_shared_frame(struct domain *d, unsigned long idx,
 int gnttab_get_status_frame(struct domain *d, unsigned long idx,
                             mfn_t *mfn);
 
+#else
+
+static inline int grant_table_init(struct domain *d,
+                                   unsigned int max_grant_frames,
+                                   unsigned int max_maptrack_frames)
+{
+    return 0;
+}
+
+static inline void grant_table_destroy(struct domain *d) {}
+
+static inline void grant_table_init_vcpu(struct vcpu *v) {}
+
+static inline void grant_table_warn_active_grants(struct domain *d) {}
+
+static inline void gnttab_release_mappings(struct domain *d) {}
+
+static inline int mem_sharing_gref_to_gfn(struct grant_table *gt,
+                                          grant_ref_t ref,
+                                          gfn_t *gfn, uint16_t *status)
+{
+    return -EINVAL;
+}
+
+static inline int gnttab_map_frame(struct domain *d, unsigned long idx,
+                                   gfn_t gfn, mfn_t *mfn)
+{
+    return -EINVAL;
+}
+
+static inline int gnttab_get_shared_frame(struct domain *d, unsigned long idx,
+                                          mfn_t *mfn)
+{
+    return -EINVAL;
+}
+
+static inline int gnttab_get_status_frame(struct domain *d, unsigned long idx,
+                                          mfn_t *mfn)
+{
+    return -EINVAL;
+}
+
+#endif /* CONFIG_GRANT_TABLE */
+
 #endif /* __XEN_GRANT_TABLE_H__ */
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RFC for next] xen: make grant table configurable
  2019-01-17 12:30 [PATCH RFC for next] xen: make grant table configurable Wei Liu
@ 2019-01-17 17:36 ` Stefano Stabellini
  2019-01-17 17:38   ` Wei Liu
  2019-01-17 20:19 ` Andrew Cooper
  2019-01-18  7:48 ` Jan Beulich
  2 siblings, 1 reply; 9+ messages in thread
From: Stefano Stabellini @ 2019-01-17 17:36 UTC (permalink / raw)
  To: Wei Liu
  Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall,
	Jan Beulich, xen-devel, Roger Pau Monné

On Thu, 17 Jan 2019, Wei Liu wrote:
> Introduce CONFIG_GRANT_TABLE. Provide stubs and make sure x86 and arm
> hypervisors build with grant table disabled.

Looks like a good idea.


> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> I did this when I worked on splitting PV and HVM and thought this
> might be useful and it was simple enough to get done.
> 
> RFC because I can envisage some configurations in the distant future
> do away with grant table and event channel. There is small a benefit
> to consider accepting this patch now so that Gitlab's randconf build
> can start testing with grant table turned off right away.

Can Gitlab do Arm hypervisor builds?


> ---
>  xen/arch/arm/setup.c              |  3 ++-
>  xen/arch/arm/traps.c              |  2 ++
>  xen/arch/x86/hvm/Makefile         |  2 +-
>  xen/arch/x86/hvm/hypercall.c      |  4 ++++
>  xen/arch/x86/hypercall.c          |  2 ++
>  xen/arch/x86/pv/Makefile          |  2 +-
>  xen/arch/x86/pv/hypercall.c       |  2 ++
>  xen/arch/x86/setup.c              |  6 +++--
>  xen/common/Kconfig                | 11 +++++++++
>  xen/common/Makefile               |  2 +-
>  xen/include/asm-arm/grant_table.h |  4 +++-
>  xen/include/xen/grant_table.h     | 49 +++++++++++++++++++++++++++++++++++++--
>  12 files changed, 80 insertions(+), 9 deletions(-)
> 
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 444857a967..3cd3513928 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -740,7 +740,8 @@ void __init start_xen(unsigned long boot_phys_offset,
>          .flags = XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap,
>          .max_evtchn_port = -1,
>          .max_grant_frames = gnttab_dom0_frames(),
> -        .max_maptrack_frames = opt_max_maptrack_frames,
> +        .max_maptrack_frames = IS_ENABLED(CONFIG_GRANT_TABLE) ?
> +                               opt_max_maptrack_frames : 0,
>      };
>  
>      dcache_line_bytes = read_dcache_line_bytes();
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index 221c762ada..0f1c1b6431 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -1392,7 +1392,9 @@ static arm_hypercall_t arm_hypercall_table[] = {
>      HYPERCALL_DEPRECATED(physdev_op_compat, 1),
>      HYPERCALL(sysctl, 2),
>      HYPERCALL(hvm_op, 2),
> +#ifdef CONFIG_GRANT_TABLE
>      HYPERCALL(grant_table_op, 3),
> +#endif
>      HYPERCALL(multicall, 2),
>      HYPERCALL(platform_op, 1),
>      HYPERCALL_ARM(vcpu_op, 3),
> diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
> index 86b106f8e7..43e5f3a21f 100644
> --- a/xen/arch/x86/hvm/Makefile
> +++ b/xen/arch/x86/hvm/Makefile
> @@ -7,7 +7,7 @@ obj-y += dm.o
>  obj-bin-y += dom0_build.init.o
>  obj-y += domain.o
>  obj-y += emulate.o
> -obj-y += grant_table.o
> +obj-$(CONFIG_GRANT_TABLE) += grant_table.o
>  obj-y += hpet.o
>  obj-y += hvm.o
>  obj-y += hypercall.o
> diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
> index 19d126377a..1f667efc36 100644
> --- a/xen/arch/x86/hvm/hypercall.c
> +++ b/xen/arch/x86/hvm/hypercall.c
> @@ -47,6 +47,7 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>      return rc;
>  }
>  
> +#ifdef CONFIG_GRANT_TABLE
>  static long hvm_grant_table_op(
>      unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, unsigned int count)
>  {
> @@ -71,6 +72,7 @@ static long hvm_grant_table_op(
>      else
>          return compat_grant_table_op(cmd, uop, count);
>  }
> +#endif
>  
>  static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>  {
> @@ -119,7 +121,9 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>  
>  static const hypercall_table_t hvm_hypercall_table[] = {
>      HVM_CALL(memory_op),
> +#ifdef CONFIG_GRANT_TABLE
>      HVM_CALL(grant_table_op),
> +#endif
>      COMPAT_CALL(vcpu_op),
>      HVM_CALL(physdev_op),
>      COMPAT_CALL(xen_version),
> diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c
> index 032de8f8f8..9311b63c1e 100644
> --- a/xen/arch/x86/hypercall.c
> +++ b/xen/arch/x86/hypercall.c
> @@ -47,7 +47,9 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls] =
>      ARGS(xen_version, 2),
>      ARGS(console_io, 3),
>      ARGS(physdev_op_compat, 1),
> +#ifdef CONFIG_GRANT_TABLE
>      ARGS(grant_table_op, 3),
> +#endif
>      ARGS(vm_assist, 2),
>      COMP(update_va_mapping_otherdomain, 4, 5),
>      ARGS(vcpu_op, 3),
> diff --git a/xen/arch/x86/pv/Makefile b/xen/arch/x86/pv/Makefile
> index 65bca04175..cf28434ba9 100644
> --- a/xen/arch/x86/pv/Makefile
> +++ b/xen/arch/x86/pv/Makefile
> @@ -5,7 +5,7 @@ obj-y += emulate.o
>  obj-y += emul-gate-op.o
>  obj-y += emul-inv-op.o
>  obj-y += emul-priv-op.o
> -obj-y += grant_table.o
> +obj-$(CONFIG_GRANT_TABLE) += grant_table.o
>  obj-y += hypercall.o
>  obj-y += iret.o
>  obj-y += misc-hypercalls.o
> diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
> index 5d11911735..ee0a6da515 100644
> --- a/xen/arch/x86/pv/hypercall.c
> +++ b/xen/arch/x86/pv/hypercall.c
> @@ -53,7 +53,9 @@ const hypercall_table_t pv_hypercall_table[] = {
>      COMPAT_CALL(xen_version),
>      HYPERCALL(console_io),
>      COMPAT_CALL(physdev_op_compat),
> +#ifdef CONFIG_GRANT_TABLE
>      COMPAT_CALL(grant_table_op),
> +#endif
>      COMPAT_CALL(vm_assist),
>      COMPAT_CALL(update_va_mapping_otherdomain),
>      COMPAT_CALL(iret),
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index 06eb483cb4..09ef0e90df 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -686,8 +686,10 @@ void __init noreturn __start_xen(unsigned long mbi_p)
>      struct xen_domctl_createdomain dom0_cfg = {
>          .flags = XEN_DOMCTL_CDF_s3_integrity,
>          .max_evtchn_port = -1,
> -        .max_grant_frames = opt_max_grant_frames,
> -        .max_maptrack_frames = opt_max_maptrack_frames,
> +        .max_grant_frames = IS_ENABLED(CONFIG_GRANT_TABLE) ?
> +                            opt_max_grant_frames : 0,
> +        .max_maptrack_frames = IS_ENABLED(CONFIG_GRANT_TABLE) ?
> +                               opt_max_maptrack_frames : 0,
>      };
>  
>      /* Critical region without IDT or TSS.  Any fault is deadly! */
> diff --git a/xen/common/Kconfig b/xen/common/Kconfig
> index a79cd40441..18e0be3d98 100644
> --- a/xen/common/Kconfig
> +++ b/xen/common/Kconfig
> @@ -11,6 +11,17 @@ config COMPAT
>  config CORE_PARKING
>  	bool
>  
> +config GRANT_TABLE
> +	bool "Grant table support"
> +	default y
> +	---help---
> +	  Grant table provides a generic mechanism to memory sharing
> +	  between domains. This shared memory interface underpins the
> +	  split device drivers for block and network IO in a classic
> +	  Xen setup.
> +
> +	  If unsure, say Y.
> +
>  config HAS_ALTERNATIVE
>  	bool
>  
> diff --git a/xen/common/Makefile b/xen/common/Makefile
> index 56fc201b6b..e748554a44 100644
> --- a/xen/common/Makefile
> +++ b/xen/common/Makefile
> @@ -10,7 +10,7 @@ obj-y += event_2l.o
>  obj-y += event_channel.o
>  obj-y += event_fifo.o
>  obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o
> -obj-y += grant_table.o
> +obj-$(CONFIG_GRANT_TABLE) += grant_table.o
>  obj-y += guestcopy.o
>  obj-bin-y += gunzip.init.o
>  obj-y += irq.o
> diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h
> index 816e3c6d68..50a07b8b17 100644
> --- a/xen/include/asm-arm/grant_table.h
> +++ b/xen/include/asm-arm/grant_table.h
> @@ -31,7 +31,9 @@ void gnttab_mark_dirty(struct domain *d, mfn_t mfn);
>   * enough space for a large grant table
>   */
>  #define gnttab_dom0_frames()                                             \
> -    min_t(unsigned int, opt_max_grant_frames, PFN_DOWN(_etext - _stext))
> +    min_t(unsigned int,                                                  \
> +          IS_ENABLED(CONFIG_GRANT_TABLE) ? opt_max_grant_frames : 0,     \
> +          PFN_DOWN(_etext - _stext))
>  
>  #define gnttab_init_arch(gt)                                             \
>  ({                                                                       \
> diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
> index 12e8a4b80b..f0498df727 100644
> --- a/xen/include/xen/grant_table.h
> +++ b/xen/include/xen/grant_table.h
> @@ -29,11 +29,12 @@
>  #include <asm/page.h>
>  #include <asm/grant_table.h>
>  
> -struct grant_table;
> -
>  extern unsigned int opt_max_grant_frames;
>  extern unsigned int opt_max_maptrack_frames;
>  
> +#ifdef CONFIG_GRANT_TABLE
> +struct grant_table;
> +
>  /* Create/destroy per-domain grant table context. */
>  int grant_table_init(struct domain *d, unsigned int max_grant_frames,
>                       unsigned int max_maptrack_frames);
> @@ -61,4 +62,48 @@ int gnttab_get_shared_frame(struct domain *d, unsigned long idx,
>  int gnttab_get_status_frame(struct domain *d, unsigned long idx,
>                              mfn_t *mfn);
>  
> +#else
> +
> +static inline int grant_table_init(struct domain *d,
> +                                   unsigned int max_grant_frames,
> +                                   unsigned int max_maptrack_frames)
> +{
> +    return 0;
> +}
> +
> +static inline void grant_table_destroy(struct domain *d) {}
> +
> +static inline void grant_table_init_vcpu(struct vcpu *v) {}
> +
> +static inline void grant_table_warn_active_grants(struct domain *d) {}
> +
> +static inline void gnttab_release_mappings(struct domain *d) {}
> +
> +static inline int mem_sharing_gref_to_gfn(struct grant_table *gt,
> +                                          grant_ref_t ref,
> +                                          gfn_t *gfn, uint16_t *status)
> +{
> +    return -EINVAL;
> +}
> +
> +static inline int gnttab_map_frame(struct domain *d, unsigned long idx,
> +                                   gfn_t gfn, mfn_t *mfn)
> +{
> +    return -EINVAL;
> +}
> +
> +static inline int gnttab_get_shared_frame(struct domain *d, unsigned long idx,
> +                                          mfn_t *mfn)
> +{
> +    return -EINVAL;
> +}
> +
> +static inline int gnttab_get_status_frame(struct domain *d, unsigned long idx,
> +                                          mfn_t *mfn)
> +{
> +    return -EINVAL;
> +}
> +
> +#endif /* CONFIG_GRANT_TABLE */
> +
>  #endif /* __XEN_GRANT_TABLE_H__ */
> -- 
> 2.11.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RFC for next] xen: make grant table configurable
  2019-01-17 17:36 ` Stefano Stabellini
@ 2019-01-17 17:38   ` Wei Liu
  2019-01-17 17:41     ` Stefano Stabellini
  0 siblings, 1 reply; 9+ messages in thread
From: Wei Liu @ 2019-01-17 17:38 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Wei Liu, Konrad Rzeszutek Wilk, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, Julien Grall, Jan Beulich, xen-devel,
	Roger Pau Monné

On Thu, Jan 17, 2019 at 09:36:57AM -0800, Stefano Stabellini wrote:
> On Thu, 17 Jan 2019, Wei Liu wrote:
> > Introduce CONFIG_GRANT_TABLE. Provide stubs and make sure x86 and arm
> > hypervisors build with grant table disabled.
> 
> Looks like a good idea.
> 
> 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > ---
> > I did this when I worked on splitting PV and HVM and thought this
> > might be useful and it was simple enough to get done.
> > 
> > RFC because I can envisage some configurations in the distant future
> > do away with grant table and event channel. There is small a benefit
> > to consider accepting this patch now so that Gitlab's randconf build
> > can start testing with grant table turned off right away.
> 
> Can Gitlab do Arm hypervisor builds?

Yes. I hooked up a box from WorksOnArm for Arm64 builds.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RFC for next] xen: make grant table configurable
  2019-01-17 17:38   ` Wei Liu
@ 2019-01-17 17:41     ` Stefano Stabellini
  2019-01-21 15:55       ` Ed Vielmetti
  0 siblings, 1 reply; 9+ messages in thread
From: Stefano Stabellini @ 2019-01-17 17:41 UTC (permalink / raw)
  To: Wei Liu
  Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall,
	Jan Beulich, xen-devel, ed, Roger Pau Monné

On Thu, 17 Jan 2019, Wei Liu wrote:
> On Thu, Jan 17, 2019 at 09:36:57AM -0800, Stefano Stabellini wrote:
> > On Thu, 17 Jan 2019, Wei Liu wrote:
> > > Introduce CONFIG_GRANT_TABLE. Provide stubs and make sure x86 and arm
> > > hypervisors build with grant table disabled.
> > 
> > Looks like a good idea.
> > 
> > 
> > > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > > ---
> > > I did this when I worked on splitting PV and HVM and thought this
> > > might be useful and it was simple enough to get done.
> > > 
> > > RFC because I can envisage some configurations in the distant future
> > > do away with grant table and event channel. There is small a benefit
> > > to consider accepting this patch now so that Gitlab's randconf build
> > > can start testing with grant table turned off right away.
> > 
> > Can Gitlab do Arm hypervisor builds?
> 
> Yes. I hooked up a box from WorksOnArm for Arm64 builds.

Very nice!! You should write a blog post or something about it.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RFC for next] xen: make grant table configurable
  2019-01-17 12:30 [PATCH RFC for next] xen: make grant table configurable Wei Liu
  2019-01-17 17:36 ` Stefano Stabellini
@ 2019-01-17 20:19 ` Andrew Cooper
  2019-01-18  9:20   ` Wei Liu
  2019-01-18  7:48 ` Jan Beulich
  2 siblings, 1 reply; 9+ messages in thread
From: Andrew Cooper @ 2019-01-17 20:19 UTC (permalink / raw)
  To: Wei Liu, xen-devel
  Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, George Dunlap,
	Tim Deegan, Ian Jackson, Julien Grall, Jan Beulich,
	Roger Pau Monné

On 17/01/2019 12:30, Wei Liu wrote:
> Introduce CONFIG_GRANT_TABLE. Provide stubs and make sure x86 and arm
> hypervisors build with grant table disabled.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> I did this when I worked on splitting PV and HVM and thought this
> might be useful and it was simple enough to get done.
>
> RFC because I can envisage some configurations in the distant future
> do away with grant table and event channel. There is small a benefit
> to consider accepting this patch now so that Gitlab's randconf build
> can start testing with grant table turned off right away.
> ---
>  xen/arch/arm/setup.c              |  3 ++-
>  xen/arch/arm/traps.c              |  2 ++
>  xen/arch/x86/hvm/Makefile         |  2 +-
>  xen/arch/x86/hvm/hypercall.c      |  4 ++++
>  xen/arch/x86/hypercall.c          |  2 ++
>  xen/arch/x86/pv/Makefile          |  2 +-
>  xen/arch/x86/pv/hypercall.c       |  2 ++
>  xen/arch/x86/setup.c              |  6 +++--
>  xen/common/Kconfig                | 11 +++++++++
>  xen/common/Makefile               |  2 +-
>  xen/include/asm-arm/grant_table.h |  4 +++-
>  xen/include/xen/grant_table.h     | 49 +++++++++++++++++++++++++++++++++++++--
>  12 files changed, 80 insertions(+), 9 deletions(-)
>
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 444857a967..3cd3513928 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -740,7 +740,8 @@ void __init start_xen(unsigned long boot_phys_offset,
>          .flags = XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap,
>          .max_evtchn_port = -1,
>          .max_grant_frames = gnttab_dom0_frames(),
> -        .max_maptrack_frames = opt_max_maptrack_frames,
> +        .max_maptrack_frames = IS_ENABLED(CONFIG_GRANT_TABLE) ?
> +                               opt_max_maptrack_frames : 0,

You can remove this conditional logic by adding #define
opt_max_grant_frames 0 in the stubs in grant_table.h

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RFC for next] xen: make grant table configurable
  2019-01-17 12:30 [PATCH RFC for next] xen: make grant table configurable Wei Liu
  2019-01-17 17:36 ` Stefano Stabellini
  2019-01-17 20:19 ` Andrew Cooper
@ 2019-01-18  7:48 ` Jan Beulich
  2019-01-18  9:20   ` Wei Liu
  2 siblings, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2019-01-18  7:48 UTC (permalink / raw)
  To: Wei Liu
  Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall, xen-devel,
	Roger Pau Monne

>>> On 17.01.19 at 13:30, <wei.liu2@citrix.com> wrote:
> --- a/xen/common/Kconfig
> +++ b/xen/common/Kconfig
> @@ -11,6 +11,17 @@ config COMPAT
>  config CORE_PARKING
>  	bool
>  
> +config GRANT_TABLE
> +	bool "Grant table support"
> +	default y
> +	---help---
> +	  Grant table provides a generic mechanism to memory sharing
> +	  between domains. This shared memory interface underpins the
> +	  split device drivers for block and network IO in a classic
> +	  Xen setup.

I can see reasons why one may want this (along the lines of SILO
mode), but it'll produce an entirely ABI-incompatible hypervisor.
Most front-/backend driver pairs won't work without it. I'm not
sure the tool stack is prepared to act on such a hypervisor. I'm
pretty sure at least XenoLinux derivatives BUG() upon error
returns from certain gnttab hypercalls.

As such as well as to be within our general line of what Kconfig
options we permit, I think for the time being the prompt needs
to depend on EXPERT = "y".

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RFC for next] xen: make grant table configurable
  2019-01-18  7:48 ` Jan Beulich
@ 2019-01-18  9:20   ` Wei Liu
  0 siblings, 0 replies; 9+ messages in thread
From: Wei Liu @ 2019-01-18  9:20 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel, Roger Pau Monne

On Fri, Jan 18, 2019 at 12:48:42AM -0700, Jan Beulich wrote:
> >>> On 17.01.19 at 13:30, <wei.liu2@citrix.com> wrote:
> > --- a/xen/common/Kconfig
> > +++ b/xen/common/Kconfig
> > @@ -11,6 +11,17 @@ config COMPAT
> >  config CORE_PARKING
> >  	bool
> >  
> > +config GRANT_TABLE
> > +	bool "Grant table support"
> > +	default y
> > +	---help---
> > +	  Grant table provides a generic mechanism to memory sharing
> > +	  between domains. This shared memory interface underpins the
> > +	  split device drivers for block and network IO in a classic
> > +	  Xen setup.
> 
> I can see reasons why one may want this (along the lines of SILO
> mode), but it'll produce an entirely ABI-incompatible hypervisor.
> Most front-/backend driver pairs won't work without it. I'm not
> sure the tool stack is prepared to act on such a hypervisor. I'm
> pretty sure at least XenoLinux derivatives BUG() upon error
> returns from certain gnttab hypercalls.
> 
> As such as well as to be within our general line of what Kconfig
> options we permit, I think for the time being the prompt needs
> to depend on EXPERT = "y".

Good point. I will do that.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RFC for next] xen: make grant table configurable
  2019-01-17 20:19 ` Andrew Cooper
@ 2019-01-18  9:20   ` Wei Liu
  0 siblings, 0 replies; 9+ messages in thread
From: Wei Liu @ 2019-01-18  9:20 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall,
	Jan Beulich, xen-devel, Roger Pau Monné

On Thu, Jan 17, 2019 at 08:19:28PM +0000, Andrew Cooper wrote:
> On 17/01/2019 12:30, Wei Liu wrote:
> > Introduce CONFIG_GRANT_TABLE. Provide stubs and make sure x86 and arm
> > hypervisors build with grant table disabled.
> >
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > ---
> > I did this when I worked on splitting PV and HVM and thought this
> > might be useful and it was simple enough to get done.
> >
> > RFC because I can envisage some configurations in the distant future
> > do away with grant table and event channel. There is small a benefit
> > to consider accepting this patch now so that Gitlab's randconf build
> > can start testing with grant table turned off right away.
> > ---
> >  xen/arch/arm/setup.c              |  3 ++-
> >  xen/arch/arm/traps.c              |  2 ++
> >  xen/arch/x86/hvm/Makefile         |  2 +-
> >  xen/arch/x86/hvm/hypercall.c      |  4 ++++
> >  xen/arch/x86/hypercall.c          |  2 ++
> >  xen/arch/x86/pv/Makefile          |  2 +-
> >  xen/arch/x86/pv/hypercall.c       |  2 ++
> >  xen/arch/x86/setup.c              |  6 +++--
> >  xen/common/Kconfig                | 11 +++++++++
> >  xen/common/Makefile               |  2 +-
> >  xen/include/asm-arm/grant_table.h |  4 +++-
> >  xen/include/xen/grant_table.h     | 49 +++++++++++++++++++++++++++++++++++++--
> >  12 files changed, 80 insertions(+), 9 deletions(-)
> >
> > diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> > index 444857a967..3cd3513928 100644
> > --- a/xen/arch/arm/setup.c
> > +++ b/xen/arch/arm/setup.c
> > @@ -740,7 +740,8 @@ void __init start_xen(unsigned long boot_phys_offset,
> >          .flags = XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap,
> >          .max_evtchn_port = -1,
> >          .max_grant_frames = gnttab_dom0_frames(),
> > -        .max_maptrack_frames = opt_max_maptrack_frames,
> > +        .max_maptrack_frames = IS_ENABLED(CONFIG_GRANT_TABLE) ?
> > +                               opt_max_maptrack_frames : 0,
> 
> You can remove this conditional logic by adding #define
> opt_max_grant_frames 0 in the stubs in grant_table.h
> 

Ack.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RFC for next] xen: make grant table configurable
  2019-01-17 17:41     ` Stefano Stabellini
@ 2019-01-21 15:55       ` Ed Vielmetti
  0 siblings, 0 replies; 9+ messages in thread
From: Ed Vielmetti @ 2019-01-21 15:55 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Wei Liu, Konrad Rzeszutek Wilk, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, Julien Grall, Jan Beulich, xen-devel,
	Edward Vielmetti, Roger Pau Monné


[-- Attachment #1.1: Type: text/plain, Size: 1377 bytes --]

Yes! I'd love to hear more about what you did, to help me further promote
Xen as a Works on Arm supported project. Also, I'd love to hear more
details about the Gitlab integration, as I am working diligently to get
arm64 support into their mainline roadmap.

thanks

Ed

On Thu, Jan 17, 2019 at 12:41 PM Stefano Stabellini <sstabellini@kernel.org>
wrote:

> On Thu, 17 Jan 2019, Wei Liu wrote:
> > On Thu, Jan 17, 2019 at 09:36:57AM -0800, Stefano Stabellini wrote:
> > > On Thu, 17 Jan 2019, Wei Liu wrote:
> > > > Introduce CONFIG_GRANT_TABLE. Provide stubs and make sure x86 and arm
> > > > hypervisors build with grant table disabled.
> > >
> > > Looks like a good idea.
> > >
> > >
> > > > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > > > ---
> > > > I did this when I worked on splitting PV and HVM and thought this
> > > > might be useful and it was simple enough to get done.
> > > >
> > > > RFC because I can envisage some configurations in the distant future
> > > > do away with grant table and event channel. There is small a benefit
> > > > to consider accepting this patch now so that Gitlab's randconf build
> > > > can start testing with grant table turned off right away.
> > >
> > > Can Gitlab do Arm hypervisor builds?
> >
> > Yes. I hooked up a box from WorksOnArm for Arm64 builds.
>
> Very nice!! You should write a blog post or something about it.
>

[-- Attachment #1.2: Type: text/html, Size: 2009 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-01-21 15:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17 12:30 [PATCH RFC for next] xen: make grant table configurable Wei Liu
2019-01-17 17:36 ` Stefano Stabellini
2019-01-17 17:38   ` Wei Liu
2019-01-17 17:41     ` Stefano Stabellini
2019-01-21 15:55       ` Ed Vielmetti
2019-01-17 20:19 ` Andrew Cooper
2019-01-18  9:20   ` Wei Liu
2019-01-18  7:48 ` Jan Beulich
2019-01-18  9:20   ` Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.