ia64/xen-unstable

changeset 19001:6d96d3c02e94

cpufreq: stats_lock doesn't appear to need to be irq-safe.

Changing this fixes some bugchecks (xmalloc() with irqs disabled).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jan 07 11:21:50 2009 +0000 (2009-01-07)
parents b0beee268543
children b9721b2766c1
files xen/drivers/acpi/pmstat.c xen/drivers/cpufreq/utility.c
line diff
     1.1 --- a/xen/drivers/acpi/pmstat.c	Wed Jan 07 14:28:33 2009 +0900
     1.2 +++ b/xen/drivers/acpi/pmstat.c	Wed Jan 07 11:21:50 2009 +0000
     1.3 @@ -92,11 +92,11 @@ int do_get_pm_info(struct xen_sysctl_get
     1.4          spinlock_t *cpufreq_statistic_lock = 
     1.5                     &per_cpu(cpufreq_statistic_lock, op->cpuid);
     1.6  
     1.7 -        spin_lock_irq(cpufreq_statistic_lock);
     1.8 +        spin_lock(cpufreq_statistic_lock);
     1.9  
    1.10          if ( !pxpt || !pxpt->u.pt || !pxpt->u.trans_pt )
    1.11          {
    1.12 -            spin_unlock_irq(cpufreq_statistic_lock);
    1.13 +            spin_unlock(cpufreq_statistic_lock);
    1.14              return -ENODATA;
    1.15          }
    1.16  
    1.17 @@ -107,14 +107,14 @@ int do_get_pm_info(struct xen_sysctl_get
    1.18          ct = pmpt->perf.state_count;
    1.19          if ( copy_to_guest(op->u.getpx.trans_pt, pxpt->u.trans_pt, ct*ct) )
    1.20          {
    1.21 -            spin_unlock_irq(cpufreq_statistic_lock);
    1.22 +            spin_unlock(cpufreq_statistic_lock);
    1.23              ret = -EFAULT;
    1.24              break;
    1.25          }
    1.26  
    1.27          if ( copy_to_guest(op->u.getpx.pt, pxpt->u.pt, ct) )
    1.28          {
    1.29 -            spin_unlock_irq(cpufreq_statistic_lock);
    1.30 +            spin_unlock(cpufreq_statistic_lock);
    1.31              ret = -EFAULT;
    1.32              break;
    1.33          }
    1.34 @@ -124,7 +124,7 @@ int do_get_pm_info(struct xen_sysctl_get
    1.35          op->u.getpx.last = pxpt->u.last;
    1.36          op->u.getpx.cur = pxpt->u.cur;
    1.37  
    1.38 -        spin_unlock_irq(cpufreq_statistic_lock);
    1.39 +        spin_unlock(cpufreq_statistic_lock);
    1.40  
    1.41          break;
    1.42      }
     2.1 --- a/xen/drivers/cpufreq/utility.c	Wed Jan 07 14:28:33 2009 +0900
     2.2 +++ b/xen/drivers/cpufreq/utility.c	Wed Jan 07 11:21:50 2009 +0000
     2.3 @@ -68,10 +68,10 @@ void cpufreq_statistic_update(unsigned i
     2.4      spinlock_t *cpufreq_statistic_lock = 
     2.5                 &per_cpu(cpufreq_statistic_lock, cpu);
     2.6  
     2.7 -    spin_lock_irq(cpufreq_statistic_lock);
     2.8 +    spin_lock(cpufreq_statistic_lock);
     2.9  
    2.10      if ( !pxpt || !pmpt ) {
    2.11 -        spin_unlock_irq(cpufreq_statistic_lock);
    2.12 +        spin_unlock(cpufreq_statistic_lock);
    2.13          return;
    2.14      }
    2.15  
    2.16 @@ -83,7 +83,7 @@ void cpufreq_statistic_update(unsigned i
    2.17  
    2.18      (*(pxpt->u.trans_pt + from * pmpt->perf.state_count + to))++;
    2.19  
    2.20 -    spin_unlock_irq(cpufreq_statistic_lock);
    2.21 +    spin_unlock(cpufreq_statistic_lock);
    2.22  }
    2.23  
    2.24  int cpufreq_statistic_init(unsigned int cpuid)
    2.25 @@ -97,10 +97,10 @@ int cpufreq_statistic_init(unsigned int 
    2.26      if ( !pmpt )
    2.27          return -EINVAL;
    2.28  
    2.29 -    spin_lock_irq(cpufreq_statistic_lock);
    2.30 +    spin_lock(cpufreq_statistic_lock);
    2.31  
    2.32      if ( pxpt ) {
    2.33 -        spin_unlock_irq(cpufreq_statistic_lock);
    2.34 +        spin_unlock(cpufreq_statistic_lock);
    2.35          return 0;
    2.36      }
    2.37  
    2.38 @@ -108,7 +108,7 @@ int cpufreq_statistic_init(unsigned int 
    2.39  
    2.40      pxpt = xmalloc(struct pm_px);
    2.41      if ( !pxpt ) {
    2.42 -        spin_unlock_irq(cpufreq_statistic_lock);
    2.43 +        spin_unlock(cpufreq_statistic_lock);
    2.44          return -ENOMEM;
    2.45      }
    2.46      memset(pxpt, 0, sizeof(*pxpt));
    2.47 @@ -117,7 +117,7 @@ int cpufreq_statistic_init(unsigned int 
    2.48      pxpt->u.trans_pt = xmalloc_array(uint64_t, count * count);
    2.49      if (!pxpt->u.trans_pt) {
    2.50          xfree(pxpt);
    2.51 -        spin_unlock_irq(cpufreq_statistic_lock);
    2.52 +        spin_unlock(cpufreq_statistic_lock);
    2.53          return -ENOMEM;
    2.54      }
    2.55  
    2.56 @@ -125,7 +125,7 @@ int cpufreq_statistic_init(unsigned int 
    2.57      if (!pxpt->u.pt) {
    2.58          xfree(pxpt->u.trans_pt);
    2.59          xfree(pxpt);
    2.60 -        spin_unlock_irq(cpufreq_statistic_lock);
    2.61 +        spin_unlock(cpufreq_statistic_lock);
    2.62          return -ENOMEM;
    2.63      }
    2.64  
    2.65 @@ -141,7 +141,7 @@ int cpufreq_statistic_init(unsigned int 
    2.66      pxpt->prev_state_wall = NOW();
    2.67      pxpt->prev_idle_wall = get_cpu_idle_time(cpuid);
    2.68  
    2.69 -    spin_unlock_irq(cpufreq_statistic_lock);
    2.70 +    spin_unlock(cpufreq_statistic_lock);
    2.71  
    2.72      return 0;
    2.73  }
    2.74 @@ -152,10 +152,10 @@ void cpufreq_statistic_exit(unsigned int
    2.75      spinlock_t *cpufreq_statistic_lock = 
    2.76                 &per_cpu(cpufreq_statistic_lock, cpuid);
    2.77  
    2.78 -    spin_lock_irq(cpufreq_statistic_lock);
    2.79 +    spin_lock(cpufreq_statistic_lock);
    2.80  
    2.81      if (!pxpt) {
    2.82 -        spin_unlock_irq(cpufreq_statistic_lock);
    2.83 +        spin_unlock(cpufreq_statistic_lock);
    2.84          return;
    2.85      }
    2.86  
    2.87 @@ -164,7 +164,7 @@ void cpufreq_statistic_exit(unsigned int
    2.88      xfree(pxpt);
    2.89      cpufreq_statistic_data[cpuid] = NULL;
    2.90  
    2.91 -    spin_unlock_irq(cpufreq_statistic_lock);
    2.92 +    spin_unlock(cpufreq_statistic_lock);
    2.93  }
    2.94  
    2.95  void cpufreq_statistic_reset(unsigned int cpuid)
    2.96 @@ -175,10 +175,10 @@ void cpufreq_statistic_reset(unsigned in
    2.97      spinlock_t *cpufreq_statistic_lock = 
    2.98                 &per_cpu(cpufreq_statistic_lock, cpuid);
    2.99  
   2.100 -    spin_lock_irq(cpufreq_statistic_lock);
   2.101 +    spin_lock(cpufreq_statistic_lock);
   2.102  
   2.103      if ( !pmpt || !pxpt || !pxpt->u.pt || !pxpt->u.trans_pt ) {
   2.104 -        spin_unlock_irq(cpufreq_statistic_lock);
   2.105 +        spin_unlock(cpufreq_statistic_lock);
   2.106          return;
   2.107      }
   2.108  
   2.109 @@ -195,7 +195,7 @@ void cpufreq_statistic_reset(unsigned in
   2.110      pxpt->prev_state_wall = NOW();
   2.111      pxpt->prev_idle_wall = get_cpu_idle_time(cpuid);
   2.112  
   2.113 -    spin_unlock_irq(cpufreq_statistic_lock);
   2.114 +    spin_unlock(cpufreq_statistic_lock);
   2.115  }
   2.116  
   2.117