[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86/HVM: don't use confusing/non-suitable XSM checks



On Fri, May 16, 2014 at 5:25 AM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
XSM_TARGET checks following rcu_lock_{,live_}remote_domain_by_id() are
rather pointless and potentially confusing. Use XSM_DM_PRIV there
instead.

Note that setting flask_ops.hvm_control to flask_hvm_param() (instead
of introducing flask_hvm_control() is intentional - that function is
already separating the contol and non-control sub-operations.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Sharing/access/mem_event bits Reviewed-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>

Thanks
AndresÂ

--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4748,7 +4748,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
    Âif ( a.nr > GB(1) >> PAGE_SHIFT )
      Âgoto param_fail2;

- Â Â Â Ârc = xsm_hvm_param(XSM_TARGET, d, op);
+ Â Â Â Ârc = xsm_hvm_control(XSM_DM_PRIV, d, op);
    Âif ( rc )
      Âgoto param_fail2;

@@ -4786,7 +4786,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
    Âif ( !is_hvm_domain(d) )
      Âgoto param_fail3;

- Â Â Â Ârc = xsm_hvm_param(XSM_TARGET, d, op);
+ Â Â Â Ârc = xsm_hvm_control(XSM_DM_PRIV, d, op);
    Âif ( rc )
      Âgoto param_fail3;

@@ -4896,7 +4896,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
    Âif ( !is_hvm_domain(d) )
      Âgoto param_fail4;

- Â Â Â Ârc = xsm_hvm_param(XSM_TARGET, d, op);
+ Â Â Â Ârc = xsm_hvm_control(XSM_DM_PRIV, d, op);
    Âif ( rc )
      Âgoto param_fail4;

@@ -5026,7 +5026,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
    Âif ( !is_hvm_domain(d) )
      Âgoto param_fail8;

- Â Â Â Ârc = xsm_hvm_param(XSM_TARGET, d, op);
+ Â Â Â Ârc = xsm_hvm_control(XSM_DM_PRIV, d, op);
    Âif ( rc )
      Âgoto param_fail8;

--- a/xen/arch/x86/mm/mem_access.c
+++ b/xen/arch/x86/mm/mem_access.c
@@ -47,7 +47,7 @@ int mem_access_memop(unsigned long cmd,
  Âif ( !is_hvm_domain(d) )
    Âgoto out;

- Â Ârc = xsm_mem_event_op(XSM_TARGET, d, XENMEM_access_op);
+ Â Ârc = xsm_mem_event_op(XSM_DM_PRIV, d, XENMEM_access_op);
  Âif ( rc )
    Âgoto out;

--- a/xen/arch/x86/mm/mem_event.c
+++ b/xen/arch/x86/mm/mem_event.c
@@ -449,7 +449,7 @@ int do_mem_event_op(int op, uint32_t dom
  Âif ( ret )
    Âreturn ret;

- Â Âret = xsm_mem_event_op(XSM_TARGET, d, op);
+ Â Âret = xsm_mem_event_op(XSM_DM_PRIV, d, op);
  Âif ( ret )
    Âgoto out;

--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -1358,7 +1358,7 @@ int mem_sharing_memop(struct domain *d,
      Âif ( rc )
        Âreturn rc;

- Â Â Â Â Â Ârc = xsm_mem_sharing_op(XSM_TARGET, d, cd, mec->op);
+ Â Â Â Â Â Ârc = xsm_mem_sharing_op(XSM_DM_PRIV, d, cd, mec->op);
      Âif ( rc )
      Â{
        Ârcu_unlock_domain(cd);
@@ -1422,7 +1422,7 @@ int mem_sharing_memop(struct domain *d,
      Âif ( rc )
        Âreturn rc;

- Â Â Â Â Â Ârc = xsm_mem_sharing_op(XSM_TARGET, d, cd, mec->op);
+ Â Â Â Â Â Ârc = xsm_mem_sharing_op(XSM_DM_PRIV, d, cd, mec->op);
      Âif ( rc )
      Â{
        Ârcu_unlock_domain(cd);
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -495,6 +495,12 @@ static XSM_INLINE int xsm_hvm_param(XSM_
  Âreturn xsm_default_action(action, current->domain, d);
Â}

+static XSM_INLINE int xsm_hvm_control(XSM_DEFAULT_ARG struct domain *d, unsigned long op)
+{
+ Â ÂXSM_ASSERT_ACTION(XSM_DM_PRIV);
+ Â Âreturn xsm_default_action(action, current->domain, d);
+}
+
Âstatic XSM_INLINE int xsm_hvm_param_nested(XSM_DEFAULT_ARG struct domain *d)
Â{
  ÂXSM_ASSERT_ACTION(XSM_PRIV);
@@ -546,13 +552,13 @@ static XSM_INLINE int xsm_mem_event_cont

Âstatic XSM_INLINE int xsm_mem_event_op(XSM_DEFAULT_ARG struct domain *d, int op)
Â{
- Â ÂXSM_ASSERT_ACTION(XSM_TARGET);
+ Â ÂXSM_ASSERT_ACTION(XSM_DM_PRIV);
  Âreturn xsm_default_action(action, current->domain, d);
Â}

Âstatic XSM_INLINE int xsm_mem_sharing_op(XSM_DEFAULT_ARG struct domain *d, struct domain *cd, int op)
Â{
- Â ÂXSM_ASSERT_ACTION(XSM_TARGET);
+ Â ÂXSM_ASSERT_ACTION(XSM_DM_PRIV);
  Âreturn xsm_default_action(action, current->domain, cd);
Â}

--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -137,6 +137,7 @@ struct xsm_operations {
Â#endif

  Âint (*hvm_param) (struct domain *d, unsigned long op);
+ Â Âint (*hvm_control) (struct domain *d, unsigned long op);
  Âint (*hvm_param_nested) (struct domain *d);

Â#ifdef CONFIG_X86
@@ -522,6 +523,11 @@ static inline int xsm_hvm_param (xsm_def
  Âreturn xsm_ops->hvm_param(d, op);
Â}

+static inline int xsm_hvm_control(xsm_default_t def, struct domain *d, unsigned long op)
+{
+ Â Âreturn xsm_ops->hvm_control(d, op);
+}
+
Âstatic inline int xsm_hvm_param_nested (xsm_default_t def, struct domain *d)
Â{
  Âreturn xsm_ops->hvm_param_nested(d);
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -105,6 +105,7 @@ void xsm_fixup_ops (struct xsm_operation
  Âset_to_dummy_if_null(ops, tmem_op);
  Âset_to_dummy_if_null(ops, tmem_control);
  Âset_to_dummy_if_null(ops, hvm_param);
+ Â Âset_to_dummy_if_null(ops, hvm_control);
  Âset_to_dummy_if_null(ops, hvm_param_nested);

  Âset_to_dummy_if_null(ops, do_xsm_op);
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1543,6 +1543,7 @@ static struct xsm_operations flask_ops =
  Â.tmem_op = flask_tmem_op,
  Â.tmem_control = flask_tmem_control,
  Â.hvm_param = flask_hvm_param,
+ Â Â.hvm_control = flask_hvm_param,
  Â.hvm_param_nested = flask_hvm_param_nested,

  Â.do_xsm_op = do_flask_op,





--
Gridcentric LogoÂÂ
Scalable, Efficient, Instant-On Virtualization


Andres Lagar-Cavilla
Chief Scientist
Phone: 647-778-4380

Email:Âandres@xxxxxxxxxxxxxxx
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.