ia64/xen-unstable

changeset 16814:0ace9a451a25

[IA64] Use rcu where possible.

This is for consistency.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Fri Jan 18 13:55:26 2008 -0700 (2008-01-18)
parents a868bd4236e6
children 759a9fb42645
files xen/arch/ia64/vmx/vmx_hypercall.c xen/arch/ia64/xen/dom0_ops.c xen/arch/ia64/xen/mm.c
line diff
     1.1 --- a/xen/arch/ia64/vmx/vmx_hypercall.c	Fri Jan 18 13:49:48 2008 -0700
     1.2 +++ b/xen/arch/ia64/vmx/vmx_hypercall.c	Fri Jan 18 13:55:26 2008 -0700
     1.3 @@ -53,7 +53,7 @@ static int hvmop_set_isa_irq_level(
     1.4      if ( op.isa_irq > 15 )
     1.5          return -EINVAL;
     1.6  
     1.7 -    d = get_domain_by_id(op.domid);
     1.8 +    d = rcu_lock_domain_by_id(op.domid);
     1.9      if ( d == NULL )
    1.10          return -ESRCH;
    1.11  
    1.12 @@ -65,7 +65,7 @@ static int hvmop_set_isa_irq_level(
    1.13      viosapic_set_irq(d, op.isa_irq, op.level);
    1.14  
    1.15   out:
    1.16 -    put_domain(d);
    1.17 +    rcu_unlock_domain(d);
    1.18      return rc;
    1.19  }
    1.20  
    1.21 @@ -85,7 +85,7 @@ static int hvmop_set_pci_intx_level(
    1.22      if ( (op.domain > 0) || (op.bus > 0) || (op.device > 31) || (op.intx > 3) )
    1.23          return -EINVAL;
    1.24  
    1.25 -    d = get_domain_by_id(op.domid);
    1.26 +    d = rcu_lock_domain_by_id(op.domid);
    1.27      if ( d == NULL )
    1.28          return -ESRCH;
    1.29  
    1.30 @@ -97,7 +97,7 @@ static int hvmop_set_pci_intx_level(
    1.31      viosapic_set_pci_irq(d, op.device, op.intx, op.level);
    1.32  
    1.33   out:
    1.34 -    put_domain(d);
    1.35 +    rcu_unlock_domain(d);
    1.36      return rc;
    1.37  }
    1.38  
    1.39 @@ -122,10 +122,10 @@ do_hvm_op(unsigned long op, XEN_GUEST_HA
    1.40              return -EINVAL;
    1.41  
    1.42          if (a.domid == DOMID_SELF) {
    1.43 -            d = get_current_domain();
    1.44 +            d = rcu_lock_current_domain();
    1.45          }
    1.46          else if (IS_PRIV(current->domain)) {
    1.47 -            d = get_domain_by_id(a.domid);
    1.48 +            d = rcu_lock_domain_by_id(a.domid);
    1.49              if (d == NULL)
    1.50                  return -ESRCH;
    1.51          }
    1.52 @@ -167,7 +167,7 @@ do_hvm_op(unsigned long op, XEN_GUEST_HA
    1.53              rc = copy_to_guest(arg, &a, 1) ? -EFAULT : 0;
    1.54          }
    1.55  
    1.56 -        put_domain(d);
    1.57 +        rcu_unlock_domain(d);
    1.58          break;
    1.59      }
    1.60  
     2.1 --- a/xen/arch/ia64/xen/dom0_ops.c	Fri Jan 18 13:49:48 2008 -0700
     2.2 +++ b/xen/arch/ia64/xen/dom0_ops.c	Fri Jan 18 13:55:26 2008 -0700
     2.3 @@ -44,7 +44,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
     2.4      case XEN_DOMCTL_getmemlist:
     2.5      {
     2.6          unsigned long i;
     2.7 -        struct domain *d = get_domain_by_id(op->domain);
     2.8 +        struct domain *d = rcu_lock_domain_by_id(op->domain);
     2.9          unsigned long start_page = op->u.getmemlist.start_pfn;
    2.10          unsigned long nr_pages = op->u.getmemlist.max_pfns;
    2.11          uint64_t mfn;
    2.12 @@ -72,15 +72,14 @@ long arch_do_domctl(xen_domctl_t *op, XE
    2.13          op->u.getmemlist.num_pfns = i;
    2.14          if (copy_to_guest(u_domctl, op, 1))
    2.15              ret = -EFAULT;
    2.16 -
    2.17 -        put_domain(d);
    2.18 +        rcu_unlock_domain(d);
    2.19      }
    2.20      break;
    2.21  
    2.22      case XEN_DOMCTL_arch_setup:
    2.23      {
    2.24          xen_domctl_arch_setup_t *ds = &op->u.arch_setup;
    2.25 -        struct domain *d = get_domain_by_id(op->domain);
    2.26 +        struct domain *d = rcu_lock_domain_by_id(op->domain);
    2.27  
    2.28          if ( d == NULL) {
    2.29              ret = -EINVAL;
    2.30 @@ -155,7 +154,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
    2.31              }
    2.32          }
    2.33  
    2.34 -        put_domain(d);
    2.35 +        rcu_unlock_domain(d);
    2.36      }
    2.37      break;
    2.38  
    2.39 @@ -163,11 +162,11 @@ long arch_do_domctl(xen_domctl_t *op, XE
    2.40      {
    2.41          struct domain *d; 
    2.42          ret = -ESRCH;
    2.43 -        d = get_domain_by_id(op->domain);
    2.44 +        d = rcu_lock_domain_by_id(op->domain);
    2.45          if ( d != NULL )
    2.46          {
    2.47              ret = shadow_mode_control(d, &op->u.shadow_op);
    2.48 -            put_domain(d);
    2.49 +            rcu_unlock_domain(d);
    2.50              if (copy_to_guest(u_domctl, op, 1))
    2.51                  ret = -EFAULT;
    2.52          } 
    2.53 @@ -182,7 +181,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
    2.54          unsigned int lp = fp + np - 1;
    2.55  
    2.56          ret = -ESRCH;
    2.57 -        d = get_domain_by_id(op->domain);
    2.58 +        d = rcu_lock_domain_by_id(op->domain);
    2.59          if (unlikely(d == NULL))
    2.60              break;
    2.61  
    2.62 @@ -195,7 +194,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
    2.63                  ret = ioports_deny_access(d, fp, lp);
    2.64          }
    2.65  
    2.66 -        put_domain(d);
    2.67 +        rcu_unlock_domain(d);
    2.68      }
    2.69      break;
    2.70  
    2.71 @@ -205,7 +204,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
    2.72          struct vcpu *v;
    2.73  
    2.74          ret = -ESRCH;
    2.75 -        d = get_domain_by_id(op->domain);
    2.76 +        d = rcu_lock_domain_by_id(op->domain);
    2.77          if ( d == NULL )
    2.78              break;
    2.79  
    2.80 @@ -234,7 +233,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
    2.81          }
    2.82  
    2.83      sendtrigger_out:
    2.84 -        put_domain(d);
    2.85 +        rcu_unlock_domain(d);
    2.86      }
    2.87      break;
    2.88  
    2.89 @@ -347,7 +346,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
    2.90      case XEN_DOMCTL_set_opt_feature:
    2.91      {
    2.92          struct xen_ia64_opt_feature *optf = &op->u.set_opt_feature.optf;
    2.93 -        struct domain *d = get_domain_by_id(op->domain);
    2.94 +        struct domain *d = rcu_lock_domain_by_id(op->domain);
    2.95  
    2.96          if (d == NULL) {
    2.97              ret = -EINVAL;
    2.98 @@ -355,7 +354,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
    2.99          }
   2.100  
   2.101          ret = domain_opt_feature(d, optf);
   2.102 -        put_domain(d);
   2.103 +        rcu_unlock_domain(d);
   2.104      }
   2.105      break;
   2.106  
     3.1 --- a/xen/arch/ia64/xen/mm.c	Fri Jan 18 13:49:48 2008 -0700
     3.2 +++ b/xen/arch/ia64/xen/mm.c	Fri Jan 18 13:55:26 2008 -0700
     3.3 @@ -1473,7 +1473,7 @@ static unsigned long
     3.4      if (flags & (ASSIGN_nocache | ASSIGN_pgc_allocated))
     3.5          return -EINVAL;
     3.6  
     3.7 -    rd = get_domain_by_id(domid);
     3.8 +    rd = rcu_lock_domain_by_id(domid);
     3.9      if (unlikely(rd == NULL)) {
    3.10          switch (domid) {
    3.11          case DOMID_XEN:
    3.12 @@ -1489,7 +1489,7 @@ static unsigned long
    3.13              return -ESRCH;
    3.14          }
    3.15          BUG_ON(rd == NULL);
    3.16 -        get_knownalive_domain(rd);
    3.17 +        rcu_lock_domain(rd);
    3.18      }
    3.19  
    3.20      if (unlikely(rd == d))
    3.21 @@ -1512,7 +1512,7 @@ static unsigned long
    3.22      //don't update p2m table because this page belongs to rd, not d.
    3.23      perfc_incr(dom0vp_add_physmap);
    3.24  out1:
    3.25 -    put_domain(rd);
    3.26 +    rcu_unlock_domain(rd);
    3.27      return error;
    3.28  }
    3.29  
    3.30 @@ -2785,17 +2785,16 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
    3.31          if (copy_from_guest(&xatp, arg, 1))
    3.32              return -EFAULT;
    3.33  
    3.34 -        if (xatp.domid == DOMID_SELF) {
    3.35 -            d = get_current_domain();
    3.36 -        }
    3.37 +        if (xatp.domid == DOMID_SELF)
    3.38 +            d = rcu_lock_current_domain();
    3.39          else if (!IS_PRIV(current->domain))
    3.40              return -EPERM;
    3.41 -        else if ((d = get_domain_by_id(xatp.domid)) == NULL)
    3.42 +        else if ((d = rcu_lock_domain_by_id(xatp.domid)) == NULL)
    3.43              return -ESRCH;
    3.44  
    3.45          /* This hypercall is used for VT-i domain only */
    3.46          if (!VMX_DOMAIN(d->vcpu[0])) {
    3.47 -            put_domain(d);
    3.48 +            rcu_unlock_domain(d);
    3.49              return -ENOSYS;
    3.50          }
    3.51  
    3.52 @@ -2821,7 +2820,7 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
    3.53          }
    3.54  
    3.55          if (mfn == 0) {
    3.56 -            put_domain(d);
    3.57 +            rcu_unlock_domain(d);
    3.58              return -EINVAL;
    3.59          }
    3.60  
    3.61 @@ -2853,7 +2852,7 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
    3.62      out:
    3.63          UNLOCK_BIGLOCK(d);
    3.64          
    3.65 -        put_domain(d);
    3.66 +        rcu_unlock_domain(d);
    3.67  
    3.68          break;
    3.69      }