]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'x86-ras-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 14 Dec 2012 17:59:59 +0000 (09:59 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 14 Dec 2012 17:59:59 +0000 (09:59 -0800)
Pull x86 RAS update from Ingo Molnar:
 "Rework all config variables used throughout the MCA code and collect
  them together into a mca_config struct.  This keeps them tightly and
  neatly packed together instead of spilled all over the place.

  Then, convert those which are used as booleans into real booleans and
  save some space.  These bits are exposed via
     /sys/devices/system/machinecheck/machinecheck*/"

* 'x86-ras-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, MCA: Finish mca_config conversion
  x86, MCA: Convert the next three variables batch
  x86, MCA: Convert rip_msr, mce_bootlog, monarch_timeout
  x86, MCA: Convert dont_log_ce, banks and tolerant
  drivers/base: Add a DEVICE_BOOL_ATTR macro

1  2 
arch/x86/kernel/cpu/mcheck/mce_intel.c
drivers/base/core.c
include/linux/device.h

index 4f9a3cbfc4a33fb801ab1bf2c822a83e76122897,79b2b6b6e613ae2b377ea2c42ea67c46e2c770f0..402c454fbff0992423ec5346a30dd7a26667e983
@@@ -53,7 -53,7 +53,7 @@@ static int cmci_supported(int *banks
  {
        u64 cap;
  
-       if (mce_cmci_disabled || mce_ignore_ce)
+       if (mca_cfg.cmci_disabled || mca_cfg.ignore_ce)
                return 0;
  
        /*
@@@ -200,7 -200,7 +200,7 @@@ static void cmci_discover(int banks
                        continue;
                }
  
-               if (!mce_bios_cmci_threshold) {
+               if (!mca_cfg.bios_cmci_threshold) {
                        val &= ~MCI_CTL2_CMCI_THRESHOLD_MASK;
                        val |= CMCI_THRESHOLD;
                } else if (!(val & MCI_CTL2_CMCI_THRESHOLD_MASK)) {
                         * set the thresholds properly or does not work with
                         * this boot option. Note down now and report later.
                         */
-                       if (mce_bios_cmci_threshold && bios_zero_thresh &&
+                       if (mca_cfg.bios_cmci_threshold && bios_zero_thresh &&
                                        (val & MCI_CTL2_CMCI_THRESHOLD_MASK))
                                bios_wrong_thresh = 1;
                } else {
                }
        }
        raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
-       if (mce_bios_cmci_threshold && bios_wrong_thresh) {
+       if (mca_cfg.bios_cmci_threshold && bios_wrong_thresh) {
                pr_info_once(
                        "bios_cmci_threshold: Some banks do not have valid thresholds set\n");
                pr_info_once(
@@@ -285,39 -285,34 +285,39 @@@ void cmci_clear(void
        raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
  }
  
 +static long cmci_rediscover_work_func(void *arg)
 +{
 +      int banks;
 +
 +      /* Recheck banks in case CPUs don't all have the same */
 +      if (cmci_supported(&banks))
 +              cmci_discover(banks);
 +
 +      return 0;
 +}
 +
  /*
   * After a CPU went down cycle through all the others and rediscover
   * Must run in process context.
   */
  void cmci_rediscover(int dying)
  {
 -      int banks;
 -      int cpu;
 -      cpumask_var_t old;
 +      int cpu, banks;
  
        if (!cmci_supported(&banks))
                return;
 -      if (!alloc_cpumask_var(&old, GFP_KERNEL))
 -              return;
 -      cpumask_copy(old, &current->cpus_allowed);
  
        for_each_online_cpu(cpu) {
                if (cpu == dying)
                        continue;
 -              if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))
 +
 +              if (cpu == smp_processor_id()) {
 +                      cmci_rediscover_work_func(NULL);
                        continue;
 -              /* Recheck banks in case CPUs don't all have the same */
 -              if (cmci_supported(&banks))
 -                      cmci_discover(banks);
 -      }
 +              }
  
 -      set_cpus_allowed_ptr(current, old);
 -      free_cpumask_var(old);
 +              work_on_cpu(cpu, cmci_rediscover_work_func, NULL);
 +      }
  }
  
  /*
diff --combined drivers/base/core.c
index 417913974df813f814208e697de28ffc63130756,c8ae1f6b01b93434bf878c1622d0d47bd20110a5..a235085e343c47ca2b643f876c31ab70032359b5
@@@ -171,6 -171,27 +171,27 @@@ ssize_t device_show_int(struct device *
  }
  EXPORT_SYMBOL_GPL(device_show_int);
  
+ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
+                         const char *buf, size_t size)
+ {
+       struct dev_ext_attribute *ea = to_ext_attr(attr);
+       if (strtobool(buf, ea->var) < 0)
+               return -EINVAL;
+       return size;
+ }
+ EXPORT_SYMBOL_GPL(device_store_bool);
+ ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
+                        char *buf)
+ {
+       struct dev_ext_attribute *ea = to_ext_attr(attr);
+       return snprintf(buf, PAGE_SIZE, "%d\n", *(bool *)(ea->var));
+ }
+ EXPORT_SYMBOL_GPL(device_show_bool);
  /**
   *    device_release - free device structure.
   *    @kobj:  device's kobject.
@@@ -1180,6 -1201,7 +1201,6 @@@ void device_del(struct device *dev
        if (dev->bus)
                blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
                                             BUS_NOTIFY_DEL_DEVICE, dev);
 -      device_pm_remove(dev);
        dpm_sysfs_remove(dev);
        if (parent)
                klist_del(&dev->p->knode_parent);
        device_remove_file(dev, &uevent_attr);
        device_remove_attrs(dev);
        bus_remove_device(dev);
 +      device_pm_remove(dev);
        driver_deferred_probe_del(dev);
  
        /* Notify the platform of the removal, in case they
@@@ -1399,7 -1420,7 +1420,7 @@@ struct root_device 
        struct module *owner;
  };
  
 -inline struct root_device *to_root_device(struct device *d)
 +static inline struct root_device *to_root_device(struct device *d)
  {
        return container_of(d, struct root_device, dev);
  }
@@@ -1840,12 -1861,10 +1861,12 @@@ void device_shutdown(void
                pm_runtime_barrier(dev);
  
                if (dev->bus && dev->bus->shutdown) {
 -                      dev_dbg(dev, "shutdown\n");
 +                      if (initcall_debug)
 +                              dev_info(dev, "shutdown\n");
                        dev->bus->shutdown(dev);
                } else if (dev->driver && dev->driver->shutdown) {
 -                      dev_dbg(dev, "shutdown\n");
 +                      if (initcall_debug)
 +                              dev_info(dev, "shutdown\n");
                        dev->driver->shutdown(dev);
                }
  
diff --combined include/linux/device.h
index 05292e488346697a40614b356eef82e2425f423b,50c85a26b0034f33a64a8a997564e32a14f638c8..43dcda937ddf82fcb8661372a68899953209e3f2
@@@ -190,7 -190,6 +190,7 @@@ extern struct klist *bus_get_device_kli
   * @mod_name: Used for built-in modules.
   * @suppress_bind_attrs: Disables bind/unbind via sysfs.
   * @of_match_table: The open firmware table.
 + * @acpi_match_table: The ACPI match table.
   * @probe:    Called to query the existence of a specific device,
   *            whether this driver can work with it, and bind the driver
   *            to a specific device.
@@@ -224,7 -223,6 +224,7 @@@ struct device_driver 
        bool suppress_bind_attrs;       /* disables bind/unbind via sysfs */
  
        const struct of_device_id       *of_match_table;
 +      const struct acpi_device_id     *acpi_match_table;
  
        int (*probe) (struct device *dev);
        int (*remove) (struct device *dev);
@@@ -498,6 -496,10 +498,10 @@@ ssize_t device_show_int(struct device *
                        char *buf);
  ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
                         const char *buf, size_t count);
+ ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
+                       char *buf);
+ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
+                        const char *buf, size_t count);
  
  #define DEVICE_ATTR(_name, _mode, _show, _store) \
        struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
  #define DEVICE_INT_ATTR(_name, _mode, _var) \
        struct dev_ext_attribute dev_attr_##_name = \
                { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
+ #define DEVICE_BOOL_ATTR(_name, _mode, _var) \
+       struct dev_ext_attribute dev_attr_##_name = \
+               { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
  #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
        struct device_attribute dev_attr_##_name =              \
                __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
@@@ -578,12 -583,6 +585,12 @@@ struct device_dma_parameters 
        unsigned long segment_boundary_mask;
  };
  
 +struct acpi_dev_node {
 +#ifdef CONFIG_ACPI
 +      void    *handle;
 +#endif
 +};
 +
  /**
   * struct device - The basic device structure
   * @parent:   The device's "parent" device, the device to which it is attached.
   * @dma_mem:  Internal for coherent mem override.
   * @archdata: For arch-specific additions.
   * @of_node:  Associated device tree node.
 + * @acpi_node:        Associated ACPI device node.
   * @devt:     For creating the sysfs "dev".
   * @id:               device instance
   * @devres_lock: Spinlock to protect the resource of the device.
@@@ -689,7 -687,6 +696,7 @@@ struct device 
        struct dev_archdata     archdata;
  
        struct device_node      *of_node; /* associated device tree node */
 +      struct acpi_dev_node    acpi_node; /* associated ACPI device node */
  
        dev_t                   devt;   /* dev_t, creates the sysfs "dev" */
        u32                     id;     /* device instance */
@@@ -710,14 -707,6 +717,14 @@@ static inline struct device *kobj_to_de
        return container_of(kobj, struct device, kobj);
  }
  
 +#ifdef CONFIG_ACPI
 +#define ACPI_HANDLE(dev)      ((dev)->acpi_node.handle)
 +#define ACPI_HANDLE_SET(dev, _handle_)        (dev)->acpi_node.handle = (_handle_)
 +#else
 +#define ACPI_HANDLE(dev)      (NULL)
 +#define ACPI_HANDLE_SET(dev, _handle_)        do { } while (0)
 +#endif
 +
  /* Get the wakeup routines, which depend on struct device */
  #include <linux/pm_wakeup.h>