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

Re: [Xen-devel] [PATCH 1/3] xen/vcpu: Rename the common interfaces for consistency



Hi,

On 09/06/2018 08:25 PM, Andrew Cooper wrote:
The vcpu functions are far less consistent than the domain side of things, and
in particular, has vcpu_destroy() for architecture specific functionality.

Perform the following renames:

   * alloc_vcpu      => vcpu_create
   * vcpu_initialise => arch_vcpu_create
   * vcpu_destroy    => arch_vcpu_destroy

which makes the vcpu hierarchy consistent with the domain hierarchy.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Acked-by: Julien Grall <julien.grall@xxxxxxx>

Cheers,

---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>
---
  xen/arch/arm/domain.c       |  6 +++---
  xen/arch/arm/domain_build.c |  4 ++--
  xen/arch/x86/dom0_build.c   |  2 +-
  xen/arch/x86/domain.c       |  4 ++--
  xen/common/domain.c         |  6 +++---
  xen/common/domctl.c         |  2 +-
  xen/common/schedule.c       |  4 ++--
  xen/include/xen/domain.h    | 10 +++++-----
  8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 4baecc2..feebbf5 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -538,7 +538,7 @@ void free_vcpu_struct(struct vcpu *v)
      free_xenheap_pages(v, get_order_from_bytes(sizeof(*v)));
  }
-int vcpu_initialise(struct vcpu *v)
+int arch_vcpu_create(struct vcpu *v)
  {
      int rc = 0;
@@ -583,11 +583,11 @@ int vcpu_initialise(struct vcpu *v)
      return rc;
fail:
-    vcpu_destroy(v);
+    arch_vcpu_destroy(v);
      return rc;
  }
-void vcpu_destroy(struct vcpu *v)
+void arch_vcpu_destroy(struct vcpu *v)
  {
      vcpu_timer_destroy(v);
      vcpu_vgic_free(v);
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 2a383c8..5057ad8 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -74,7 +74,7 @@ unsigned int __init dom0_max_vcpus(void)
struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0)
  {
-    return alloc_vcpu(dom0, 0, 0);
+    return vcpu_create(dom0, 0, 0);
  }
static unsigned int __init get_11_allocation_size(paddr_t size)
@@ -2232,7 +2232,7 @@ int __init construct_dom0(struct domain *d)
      for ( i = 1, cpu = 0; i < d->max_vcpus; i++ )
      {
          cpu = cpumask_cycle(cpu, &cpu_online_map);
-        if ( alloc_vcpu(d, i, cpu) == NULL )
+        if ( vcpu_create(d, i, cpu) == NULL )
          {
              printk("Failed to allocate dom0 vcpu %d on pcpu %d\n", i, cpu);
              break;
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 423fdec..86eb7db 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -134,7 +134,7 @@ struct vcpu *__init dom0_setup_vcpu(struct domain *d,
                                      unsigned int prev_cpu)
  {
      unsigned int cpu = cpumask_cycle(prev_cpu, &dom0_cpus);
-    struct vcpu *v = alloc_vcpu(d, vcpu_id, cpu);
+    struct vcpu *v = vcpu_create(d, vcpu_id, cpu);
if ( v )
      {
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 313ebb3..d67a047 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -322,7 +322,7 @@ void free_vcpu_struct(struct vcpu *v)
      free_xenheap_page(v);
  }
-int vcpu_initialise(struct vcpu *v)
+int arch_vcpu_create(struct vcpu *v)
  {
      struct domain *d = v->domain;
      int rc;
@@ -382,7 +382,7 @@ int vcpu_initialise(struct vcpu *v)
      return rc;
  }
-void vcpu_destroy(struct vcpu *v)
+void arch_vcpu_destroy(struct vcpu *v)
  {
      xfree(v->arch.vm_event);
      v->arch.vm_event = NULL;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 78c450e..14c8d00 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -123,7 +123,7 @@ static void vcpu_info_reset(struct vcpu *v)
      v->vcpu_info_mfn = INVALID_MFN;
  }
-struct vcpu *alloc_vcpu(
+struct vcpu *vcpu_create(
      struct domain *d, unsigned int vcpu_id, unsigned int cpu_id)
  {
      struct vcpu *v;
@@ -165,7 +165,7 @@ struct vcpu *alloc_vcpu(
      if ( sched_init_vcpu(v, cpu_id) != 0 )
          goto fail_wq;
- if ( vcpu_initialise(v) != 0 )
+    if ( arch_vcpu_create(v) != 0 )
      {
          sched_destroy_vcpu(v);
   fail_wq:
@@ -870,7 +870,7 @@ static void complete_domain_destroy(struct rcu_head *head)
          if ( (v = d->vcpu[i]) == NULL )
              continue;
          tasklet_kill(&v->continue_hypercall_tasklet);
-        vcpu_destroy(v);
+        arch_vcpu_destroy(v);
          sched_destroy_vcpu(v);
          destroy_waitqueue_vcpu(v);
      }
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index ed047b7..2facbdb 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -571,7 +571,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
u_domctl)
                  cpumask_any(online) :
                  cpumask_cycle(d->vcpu[i-1]->processor, online);
- if ( alloc_vcpu(d, i, cpu) == NULL )
+            if ( vcpu_create(d, i, cpu) == NULL )
                  goto maxvcpu_out;
          }
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 05281d6..1ef5be9 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1645,7 +1645,7 @@ static int cpu_schedule_up(unsigned int cpu)
          return 0;
if ( idle_vcpu[cpu] == NULL )
-        alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
+        vcpu_create(idle_vcpu[0]->domain, cpu, cpu);
      else
      {
          struct vcpu *idle = idle_vcpu[cpu];
@@ -1817,7 +1817,7 @@ void __init scheduler_init(void)
      BUG_ON(IS_ERR(idle_domain));
      idle_domain->vcpu = idle_vcpu;
      idle_domain->max_vcpus = nr_cpu_ids;
-    if ( alloc_vcpu(idle_domain, 0, 0) == NULL )
+    if ( vcpu_create(idle_domain, 0, 0) == NULL )
          BUG();
      this_cpu(schedule_data).sched_priv = SCHED_OP(&ops, alloc_pdata, 0);
      BUG_ON(IS_ERR(this_cpu(schedule_data).sched_priv));
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index 5593495..6df6a58 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -13,7 +13,7 @@ typedef union {
      struct compat_vcpu_guest_context *cmp;
  } vcpu_guest_context_u __attribute__((__transparent_union__));
-struct vcpu *alloc_vcpu(
+struct vcpu *vcpu_create(
      struct domain *d, unsigned int vcpu_id, unsigned int cpu_id);
unsigned int dom0_max_vcpus(void);
@@ -47,13 +47,13 @@ void free_pirq_struct(void *);
/*
   * Initialise/destroy arch-specific details of a VCPU.
- *  - vcpu_initialise() is called after the basic generic fields of the
+ *  - arch_vcpu_create() is called after the basic generic fields of the
   *    VCPU structure are initialised. Many operations can be applied to the
   *    VCPU at this point (e.g., vcpu_pause()).
- *  - vcpu_destroy() is called only if vcpu_initialise() previously succeeded.
+ *  - arch_vcpu_destroy() is called only if arch_vcpu_create() previously 
succeeded.
   */
-int  vcpu_initialise(struct vcpu *v);
-void vcpu_destroy(struct vcpu *v);
+int  arch_vcpu_create(struct vcpu *v);
+void arch_vcpu_destroy(struct vcpu *v);
int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset);
  void unmap_vcpu_info(struct vcpu *v);


--
Julien Grall

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

 


Rackspace

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