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

[Xen-changelog] [xen-unstable] xen: sysctl XSM hook removal


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Wed, 16 Jan 2013 08:22:14 +0000
  • Delivery-date: Wed, 16 Jan 2013 08:22:24 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
# Date 1357900950 0
# Node ID 0bc879ecb8b3ece2fd879578f18c9565e82f175b
# Parent  6672ac1415b1a94f5287d9a34ac4cd9e8e9d536a
xen: sysctl XSM hook removal

A number of the sysctl XSM hooks have no parameters or only pass the
operation ID, making them redundant with the xsm_sysctl hook. Remove
these redundant hooks.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 6672ac1415b1 -r 0bc879ecb8b3 xen/arch/x86/sysctl.c
--- a/xen/arch/x86/sysctl.c     Fri Jan 11 10:41:51 2013 +0000
+++ b/xen/arch/x86/sysctl.c     Fri Jan 11 10:42:30 2013 +0000
@@ -69,11 +69,6 @@ long arch_do_sysctl(
     {
         xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
 
-        ret = xsm_physinfo();
-        if ( ret )
-            break;
-
-
         memset(pi, 0, sizeof(*pi));
         pi->threads_per_core =
             cpumask_weight(per_cpu(cpu_sibling_mask, 0));
@@ -103,10 +98,6 @@ long arch_do_sysctl(
         uint32_t i, max_cpu_index, last_online_cpu;
         xen_sysctl_topologyinfo_t *ti = &sysctl->u.topologyinfo;
 
-        ret = xsm_physinfo();
-        if ( ret )
-            break;
-
         last_online_cpu = cpumask_last(&cpu_online_map);
         max_cpu_index = min_t(uint32_t, ti->max_cpu_index, last_online_cpu);
         ti->max_cpu_index = last_online_cpu;
@@ -144,10 +135,6 @@ long arch_do_sysctl(
         uint32_t i, j, max_node_index, last_online_node;
         xen_sysctl_numainfo_t *ni = &sysctl->u.numainfo;
 
-        ret = xsm_physinfo();
-        if ( ret )
-            break;
-
         last_online_node = last_node(node_online_map);
         max_node_index = min_t(uint32_t, ni->max_node_index, last_online_node);
         ni->max_node_index = last_online_node;
diff -r 6672ac1415b1 -r 0bc879ecb8b3 xen/common/sysctl.c
--- a/xen/common/sysctl.c       Fri Jan 11 10:41:51 2013 +0000
+++ b/xen/common/sysctl.c       Fri Jan 11 10:42:30 2013 +0000
@@ -65,18 +65,10 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe
         break;
 
     case XEN_SYSCTL_tbuf_op:
-        ret = xsm_tbufcontrol();
-        if ( ret )
-            break;
-
         ret = tb_control(&op->u.tbuf_op);
         break;
     
     case XEN_SYSCTL_sched_id:
-        ret = xsm_sched_id();
-        if ( ret )
-            break;
-
         op->u.sched_id.sched_id = sched_id();
         break;
 
@@ -122,20 +114,12 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe
 
 #ifdef PERF_COUNTERS
     case XEN_SYSCTL_perfc_op:
-        ret = xsm_perfcontrol();
-        if ( ret )
-            break;
-
         ret = perfc_control(&op->u.perfc_op);
         break;
 #endif
 
 #ifdef LOCK_PROFILE
     case XEN_SYSCTL_lockprof_op:
-        ret = xsm_lockprof();
-        if ( ret )
-            break;
-
         ret = spinlock_profile_control(&op->u.lockprof_op);
         break;
 #endif
@@ -144,10 +128,6 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe
         char c;
         uint32_t i;
 
-        ret = xsm_debug_keys();
-        if ( ret )
-            break;
-
         ret = -EFAULT;
         for ( i = 0; i < op->u.debug_keys.nr_keys; i++ )
         {
@@ -167,10 +147,6 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe
 
         nr_cpus = min(op->u.getcpuinfo.max_cpus, nr_cpu_ids);
 
-        ret = xsm_getcpuinfo();
-        if ( ret )
-            break;
-
         ret = -EFAULT;
         for ( i = 0; i < nr_cpus; i++ )
         {
@@ -186,10 +162,6 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe
     break;
 
     case XEN_SYSCTL_availheap:
-        ret = xsm_availheap();
-        if ( ret )
-            break;
-
         op->u.availheap.avail_bytes = avail_domheap_pages_region(
             op->u.availheap.node,
             op->u.availheap.min_bitwidth,
@@ -199,18 +171,10 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe
 
 #ifdef HAS_ACPI
     case XEN_SYSCTL_get_pmstat:
-        ret = xsm_get_pmstat();
-        if ( ret )
-            break;
-
         ret = do_get_pm_info(&op->u.get_pmstat);
         break;
 
     case XEN_SYSCTL_pm_op:
-        ret = xsm_pm_op();
-        if ( ret )
-            break;
-
         ret = do_pm_op(&op->u.pm_op);
         if ( ret == -EAGAIN )
             copyback = 1;
@@ -278,18 +242,10 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe
     break;
 
     case XEN_SYSCTL_cpupool_op:
-        ret = xsm_cpupool_op();
-        if ( ret )
-            break;
-
         ret = cpupool_do_sysctl(&op->u.cpupool_op);
         break;
 
     case XEN_SYSCTL_scheduler_op:
-        ret = xsm_sched_op();
-        if ( ret )
-            break;
-
         ret = sched_adjust_global(&op->u.scheduler_op);
         break;
 
diff -r 6672ac1415b1 -r 0bc879ecb8b3 xen/include/xsm/dummy.h
--- a/xen/include/xsm/dummy.h   Fri Jan 11 10:41:51 2013 +0000
+++ b/xen/include/xsm/dummy.h   Fri Jan 11 10:42:30 2013 +0000
@@ -58,41 +58,16 @@ static XSM_INLINE int xsm_sysctl(int cmd
     return 0;
 }
 
-static XSM_INLINE int xsm_tbufcontrol(void)
-{
-    return 0;
-}
-
 static XSM_INLINE int xsm_readconsole(uint32_t clear)
 {
     return 0;
 }
 
-static XSM_INLINE int xsm_sched_id(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_perfcontrol(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_debug_keys(void)
-{
-    return 0;
-}
-
 static XSM_INLINE int xsm_getcpuinfo(void)
 {
     return 0;
 }
 
-static XSM_INLINE int xsm_get_pmstat(void)
-{
-    return 0;
-}
-
 static XSM_INLINE int xsm_setpminfo(void)
 {
     return 0;
@@ -110,11 +85,6 @@ static XSM_INLINE int xsm_do_mca(void)
     return 0;
 }
 
-static XSM_INLINE int xsm_availheap(void)
-{
-    return 0;
-}
-
 static XSM_INLINE int xsm_alloc_security_domain(struct domain *d)
 {
     return 0;
@@ -353,21 +323,6 @@ static XSM_INLINE int xsm_page_offline(u
     return 0;
 }
 
-static XSM_INLINE int xsm_lockprof(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_cpupool_op(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_sched_op(void)
-{
-    return 0;
-}
-
 static XSM_INLINE long xsm_do_xsm_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) op)
 {
     return -ENOSYS;
@@ -496,11 +451,6 @@ static XSM_INLINE int xsm_microcode(void
     return 0;
 }
 
-static XSM_INLINE int xsm_physinfo(void)
-{
-    return 0;
-}
-
 static XSM_INLINE int xsm_platform_quirk(uint32_t quirk)
 {
     return 0;
diff -r 6672ac1415b1 -r 0bc879ecb8b3 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h     Fri Jan 11 10:41:51 2013 +0000
+++ b/xen/include/xsm/xsm.h     Fri Jan 11 10:42:30 2013 +0000
@@ -46,14 +46,8 @@ struct xsm_operations {
     int (*set_target) (struct domain *d, struct domain *e);
     int (*domctl) (struct domain *d, int cmd);
     int (*sysctl) (int cmd);
-    int (*tbufcontrol) (void);
     int (*readconsole) (uint32_t clear);
-    int (*sched_id) (void);
-    int (*perfcontrol) (void);
-    int (*debug_keys) (void);
     int (*getcpuinfo) (void);
-    int (*availheap) (void);
-    int (*get_pmstat) (void);
     int (*setpminfo) (void);
     int (*pm_op) (void);
     int (*do_mca) (void);
@@ -116,9 +110,6 @@ struct xsm_operations {
     int (*resource_setup_misc) (void);
 
     int (*page_offline)(uint32_t cmd);
-    int (*lockprof)(void);
-    int (*cpupool_op)(void);
-    int (*sched_op)(void);
 
     long (*do_xsm_op) (XEN_GUEST_HANDLE_PARAM(xsm_op_t) op);
 
@@ -136,7 +127,6 @@ struct xsm_operations {
     int (*xen_settime) (void);
     int (*memtype) (uint32_t access);
     int (*microcode) (void);
-    int (*physinfo) (void);
     int (*platform_quirk) (uint32_t);
     int (*platform_op) (uint32_t cmd);
     int (*firmware_info) (void);
@@ -199,46 +189,16 @@ static inline int xsm_sysctl (int cmd)
     return xsm_ops->sysctl(cmd);
 }
 
-static inline int xsm_tbufcontrol (void)
-{
-    return xsm_ops->tbufcontrol();
-}
-
 static inline int xsm_readconsole (uint32_t clear)
 {
     return xsm_ops->readconsole(clear);
 }
 
-static inline int xsm_sched_id (void)
-{
-    return xsm_ops->sched_id();
-}
-
-static inline int xsm_perfcontrol (void)
-{
-    return xsm_ops->perfcontrol();
-}
-
-static inline int xsm_debug_keys (void)
-{
-    return xsm_ops->debug_keys();
-}
-
-static inline int xsm_availheap (void)
-{
-    return xsm_ops->availheap();
-}
-
-static inline int xsm_getcpuinfo (void)
+static inline int xsm_getcpuinfo(void)
 {
     return xsm_ops->getcpuinfo();
 }
 
-static inline int xsm_get_pmstat(void)
-{
-    return xsm_ops->get_pmstat();
-}
-
 static inline int xsm_setpminfo(void)
 {
     return xsm_ops->setpminfo();
@@ -495,21 +455,6 @@ static inline int xsm_page_offline(uint3
     return xsm_ops->page_offline(cmd);
 }
 
-static inline int xsm_lockprof(void)
-{
-    return xsm_ops->lockprof();
-}
-
-static inline int xsm_cpupool_op(void)
-{
-    return xsm_ops->cpupool_op();
-}
-
-static inline int xsm_sched_op(void)
-{
-    return xsm_ops->sched_op();
-}
-
 static inline long xsm_do_xsm_op (XEN_GUEST_HANDLE_PARAM(xsm_op_t) op)
 {
     return xsm_ops->do_xsm_op(op);
@@ -581,11 +526,6 @@ static inline int xsm_microcode (void)
     return xsm_ops->microcode();
 }
 
-static inline int xsm_physinfo (void)
-{
-    return xsm_ops->physinfo();
-}
-
 static inline int xsm_platform_quirk (uint32_t quirk)
 {
     return xsm_ops->platform_quirk(quirk);
diff -r 6672ac1415b1 -r 0bc879ecb8b3 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c   Fri Jan 11 10:41:51 2013 +0000
+++ b/xen/xsm/dummy.c   Fri Jan 11 10:42:30 2013 +0000
@@ -35,14 +35,8 @@ void xsm_fixup_ops (struct xsm_operation
     set_to_dummy_if_null(ops, set_target);
     set_to_dummy_if_null(ops, domctl);
     set_to_dummy_if_null(ops, sysctl);
-    set_to_dummy_if_null(ops, tbufcontrol);
     set_to_dummy_if_null(ops, readconsole);
-    set_to_dummy_if_null(ops, sched_id);
-    set_to_dummy_if_null(ops, perfcontrol);
-    set_to_dummy_if_null(ops, debug_keys);
     set_to_dummy_if_null(ops, getcpuinfo);
-    set_to_dummy_if_null(ops, availheap);
-    set_to_dummy_if_null(ops, get_pmstat);
     set_to_dummy_if_null(ops, setpminfo);
     set_to_dummy_if_null(ops, pm_op);
     set_to_dummy_if_null(ops, do_mca);
@@ -103,9 +97,6 @@ void xsm_fixup_ops (struct xsm_operation
     set_to_dummy_if_null(ops, resource_setup_misc);
 
     set_to_dummy_if_null(ops, page_offline);
-    set_to_dummy_if_null(ops, lockprof);
-    set_to_dummy_if_null(ops, cpupool_op);
-    set_to_dummy_if_null(ops, sched_op);
 
     set_to_dummy_if_null(ops, do_xsm_op);
 
@@ -123,7 +114,6 @@ void xsm_fixup_ops (struct xsm_operation
     set_to_dummy_if_null(ops, xen_settime);
     set_to_dummy_if_null(ops, memtype);
     set_to_dummy_if_null(ops, microcode);
-    set_to_dummy_if_null(ops, physinfo);
     set_to_dummy_if_null(ops, platform_quirk);
     set_to_dummy_if_null(ops, platform_op);
     set_to_dummy_if_null(ops, firmware_info);
diff -r 6672ac1415b1 -r 0bc879ecb8b3 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c     Fri Jan 11 10:41:51 2013 +0000
+++ b/xen/xsm/flask/hooks.c     Fri Jan 11 10:42:30 2013 +0000
@@ -702,37 +702,57 @@ static int flask_sysctl(int cmd)
     {
     /* These have individual XSM hooks */
     case XEN_SYSCTL_readconsole:
+    case XEN_SYSCTL_getdomaininfolist:
+    case XEN_SYSCTL_page_offline_op:
+#ifdef CONFIG_X86
+    case XEN_SYSCTL_cpu_hotplug:
+#endif
+        return 0;
+
     case XEN_SYSCTL_tbuf_op:
+        return domain_has_xen(current->domain, XEN__TBUFCONTROL);
+
     case XEN_SYSCTL_sched_id:
+        return domain_has_xen(current->domain, XEN__SCHEDULER);
+
     case XEN_SYSCTL_perfc_op:
-    case XEN_SYSCTL_getdomaininfolist:
+        return domain_has_xen(current->domain, XEN__PERFCONTROL);
+
     case XEN_SYSCTL_debug_keys:
+        return domain_has_xen(current->domain, XEN__DEBUG);
+
     case XEN_SYSCTL_getcpuinfo:
+        return domain_has_xen(current->domain, XEN__GETCPUINFO);
+
     case XEN_SYSCTL_availheap:
+        return domain_has_xen(current->domain, XEN__HEAP);
+
     case XEN_SYSCTL_get_pmstat:
+        return domain_has_xen(current->domain, XEN__PM_OP);
+
     case XEN_SYSCTL_pm_op:
-    case XEN_SYSCTL_page_offline_op:
+        return domain_has_xen(current->domain, XEN__PM_OP);
+
     case XEN_SYSCTL_lockprof_op:
+        return domain_has_xen(current->domain, XEN__LOCKPROF);
+
     case XEN_SYSCTL_cpupool_op:
+        return domain_has_xen(current->domain, XEN__CPUPOOL_OP);
+
     case XEN_SYSCTL_scheduler_op:
-#ifdef CONFIG_X86
+        return domain_has_xen(current->domain, XEN__SCHED_OP);
+
     case XEN_SYSCTL_physinfo:
-    case XEN_SYSCTL_cpu_hotplug:
     case XEN_SYSCTL_topologyinfo:
     case XEN_SYSCTL_numainfo:
-#endif
-        return 0;
+        return domain_has_xen(current->domain, XEN__PHYSINFO);
+
     default:
         printk("flask_sysctl: Unknown op %d\n", cmd);
         return -EPERM;
     }
 }
 
-static int flask_tbufcontrol(void)
-{
-    return domain_has_xen(current->domain, XEN__TBUFCONTROL);
-}
-
 static int flask_readconsole(uint32_t clear)
 {
     u32 perms = XEN__READCONSOLE;
@@ -743,41 +763,6 @@ static int flask_readconsole(uint32_t cl
     return domain_has_xen(current->domain, perms);
 }
 
-static int flask_sched_id(void)
-{
-    return domain_has_xen(current->domain, XEN__SCHEDULER);
-}
-
-static int flask_debug_keys(void)
-{
-    return domain_has_xen(current->domain, XEN__DEBUG);
-}
-
-static int flask_getcpuinfo(void)
-{
-    return domain_has_xen(current->domain, XEN__GETCPUINFO);
-}
-
-static int flask_availheap(void)
-{
-    return domain_has_xen(current->domain, XEN__HEAP);
-}
-
-static int flask_get_pmstat(void)
-{
-    return domain_has_xen(current->domain, XEN__PM_OP);
-}
-
-static int flask_setpminfo(void)
-{
-    return domain_has_xen(current->domain, XEN__PM_OP);
-}
-
-static int flask_pm_op(void)
-{
-    return domain_has_xen(current->domain, XEN__PM_OP);
-}
-
 static int flask_do_mca(void)
 {
     return domain_has_xen(current->domain, XEN__MCA_OP);
@@ -1032,26 +1017,6 @@ static inline int flask_page_offline(uin
     }
 }
 
-static inline int flask_lockprof(void)
-{
-    return domain_has_xen(current->domain, XEN__LOCKPROF);
-}
-
-static inline int flask_cpupool_op(void)
-{
-    return domain_has_xen(current->domain, XEN__CPUPOOL_OP);
-}
-
-static inline int flask_sched_op(void)
-{
-    return domain_has_xen(current->domain, XEN__SCHED_OP);
-}
-
-static int flask_perfcontrol(void)
-{
-    return domain_has_xen(current->domain, XEN__PERFCONTROL);
-}
-
 #ifdef CONFIG_X86
 static int flask_shadow_control(struct domain *d, uint32_t op)
 {
@@ -1244,11 +1209,6 @@ static int flask_microcode(void)
     return domain_has_xen(current->domain, XEN__MICROCODE);
 }
 
-static int flask_physinfo(void)
-{
-    return domain_has_xen(current->domain, XEN__PHYSINFO);
-}
-
 static int flask_platform_quirk(uint32_t quirk)
 {
     return avc_current_has_perm(SECINITSID_XEN, SECCLASS_XEN, XEN__QUIRK, 
NULL);
@@ -1269,17 +1229,21 @@ static int flask_platform_op(uint32_t op
     case XENPF_enter_acpi_sleep:
     case XENPF_change_freq:
     case XENPF_getidletime:
-    case XENPF_set_processor_pminfo:
-    case XENPF_get_cpuinfo:
-    case XENPF_get_cpu_version:
     case XENPF_cpu_online:
     case XENPF_cpu_offline:
     case XENPF_cpu_hotadd:
     case XENPF_mem_hotadd:
         /* These operations have their own XSM hooks */
         return 0;
+
+    case XENPF_set_processor_pminfo:
     case XENPF_core_parking:
         return domain_has_xen(current->domain, XEN__PM_OP);
+
+    case XENPF_get_cpu_version:
+    case XENPF_get_cpuinfo:
+        return domain_has_xen(current->domain, XEN__GETCPUINFO);
+
     default:
         printk("flask_platform_op: Unknown op %d\n", op);
         return -EPERM;
@@ -1475,16 +1439,7 @@ static struct xsm_operations flask_ops =
     .set_target = flask_set_target,
     .domctl = flask_domctl,
     .sysctl = flask_sysctl,
-    .tbufcontrol = flask_tbufcontrol,
     .readconsole = flask_readconsole,
-    .sched_id = flask_sched_id,
-    .perfcontrol = flask_perfcontrol,
-    .debug_keys = flask_debug_keys,
-    .getcpuinfo = flask_getcpuinfo,
-    .availheap = flask_availheap,
-    .get_pmstat = flask_get_pmstat,
-    .setpminfo = flask_setpminfo,
-    .pm_op = flask_pm_op,
     .do_mca = flask_do_mca,
 
     .evtchn_unbound = flask_evtchn_unbound,
@@ -1539,9 +1494,6 @@ static struct xsm_operations flask_ops =
     .resource_setup_misc = flask_resource_setup_misc,
 
     .page_offline = flask_page_offline,
-    .lockprof = flask_lockprof,
-    .cpupool_op = flask_cpupool_op,
-    .sched_op = flask_sched_op,
 
     .do_xsm_op = do_flask_op,
 
@@ -1559,7 +1511,6 @@ static struct xsm_operations flask_ops =
     .xen_settime = flask_xen_settime,
     .memtype = flask_memtype,
     .microcode = flask_microcode,
-    .physinfo = flask_physinfo,
     .platform_quirk = flask_platform_quirk,
     .platform_op = flask_platform_op,
     .firmware_info = flask_firmware_info,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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