1. 13 2月, 2013 10 次提交
    • R
      ACPI / hotplug: Fix concurrency issues and memory leaks · 3757b948
      Rafael J. Wysocki 提交于
      This changeset is aimed at fixing a few different but related
      problems in the ACPI hotplug infrastructure.
      
      First of all, since notify handlers may be run in parallel with
      acpi_bus_scan(), acpi_bus_trim() and acpi_bus_hot_remove_device()
      and some of them are installed for ACPI handles that have no struct
      acpi_device objects attached (i.e. before those objects are created),
      those notify handlers have to take acpi_scan_lock to prevent races
      from taking place (e.g. a struct acpi_device is found to be present
      for the given ACPI handle, but right after that it is removed by
      acpi_bus_trim() running in parallel to the given notify handler).
      Moreover, since some of them call acpi_bus_scan() and
      acpi_bus_trim(), this leads to the conclusion that acpi_scan_lock
      should be acquired by the callers of these two funtions rather by
      these functions themselves.
      
      For these reasons, make all notify handlers that can handle device
      addition and eject events take acpi_scan_lock and remove the
      acpi_scan_lock locking from acpi_bus_scan() and acpi_bus_trim().
      Accordingly, update all of their users to make sure that they
      are always called under acpi_scan_lock.
      
      Furthermore, since eject operations are carried out asynchronously
      with respect to the notify events that trigger them, with the help
      of acpi_bus_hot_remove_device(), even if notify handlers take the
      ACPI scan lock, it still is possible that, for example,
      acpi_bus_trim() will run between acpi_bus_hot_remove_device() and
      the notify handler that scheduled its execution and that
      acpi_bus_trim() will remove the device node passed to
      acpi_bus_hot_remove_device() for ejection.  In that case, the struct
      acpi_device object obtained by acpi_bus_hot_remove_device() will be
      invalid and not-so-funny things will ensue.  To protect agaist that,
      make the users of acpi_bus_hot_remove_device() run get_device() on
      ACPI device node objects that are about to be passed to it and make
      acpi_bus_hot_remove_device() run put_device() on them and check if
      their ACPI handles are not NULL (make acpi_device_unregister() clear
      the device nodes' ACPI handles for that check to work).
      
      Finally, observe that acpi_os_hotplug_execute() actually can fail,
      in which case its caller ought to free memory allocated for the
      context object to prevent leaks from happening.  It also needs to
      run put_device() on the device node that it ran get_device() on
      previously in that case.  Modify the code accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      3757b948
    • R
      ACPI / scan: Full transition to D3cold in acpi_device_unregister() · 0aa120a0
      Rafael J. Wysocki 提交于
      In order to drop reference counts of all power resources used by an
      ACPI device node being removed, acpi_device_unregister() calls
      acpi_power_transition(device, ACPI_STATE_D3_COLD), which effectively
      transitions the device node into D3cold if it uses any power
      resources.  However, for some device nodes it may not be appropriate
      to remove power from them entirely before putting them into D3hot
      before.  On the other hand, executing _PS3 for devices that don't
      use power resources before removing them shouldn't really hurt.
      In fact, that is done by acpi_bus_hot_remove_device(), but this is
      not the right place to do it, because the bus trimming may have
      caused power to be removed from the device node in question already
      before.
      
      For these reasons, make acpi_device_unregister() carry out full
      power-off transition for all device nodes supporting that and remove
      the direct evaluation of _PS3 from acpi_bus_hot_remove_device().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0aa120a0
    • R
      ACPI / scan: Make acpi_bus_hot_remove_device() acquire the scan lock · f058cdf4
      Rafael J. Wysocki 提交于
      The ACPI scan lock has been introduced to prevent acpi_bus_scan()
      and acpi_bus_trim() from running in parallel with each other for
      overlapping ACPI namespace scopes.  However, it is not sufficient
      to do that, because if acpi_bus_scan() is run (for an overlapping
      namespace scope) right after the acpi_bus_trim() in
      acpi_bus_hot_remove_device(), the subsequent eject will remove
      devices without removing the corresponding struct acpi_device
      objects (and possibly companion "physical" device objects).
      Therefore acpi_bus_hot_remove_device() has to acquire the scan
      lock before carrying out the bus trimming and hold it through
      the evaluation of _EJ0, so make that happen.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      f058cdf4
    • R
      ACPI: Drop the container.h header file · 87d4a4da
      Rafael J. Wysocki 提交于
      The include/acpi/container.h only contains a definition of a
      structure that is not used any more, so drop it entirely.
      
      Similar change was proposed earlier by Toshi Kani.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      87d4a4da
    • R
      ACPI / scan: Make container driver use struct acpi_scan_handler · 737f1a9f
      Rafael J. Wysocki 提交于
      Make the ACPI container driver use struct acpi_scan_handler for
      representing the object used to initialize ACPI containers and remove
      the ACPI driver structure used previously and the data structures
      created by it, since in fact they were not used for any purpose.
      
      This simplifies the code and reduces the kernel's memory footprint by
      avoiding the registration of a struct device_driver object with the
      driver core and creation of its sysfs directory which is unnecessary.
      
      In addition to that, make the namespace walk callback used for
      installing the notify handlers for ACPI containers more
      straightforward.
      
      This change includes fixes from Toshi Kani.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Tested-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      737f1a9f
    • R
      ACPI / scan: Remove useless #ifndef from acpi_eject_store() · 38475b3b
      Rafael J. Wysocki 提交于
      Since the FORCE_EJECT symbol is never defined, the
      #ifndef FORCE_EJECT in acpi_eject_store() is always true, so drop it.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Tested-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      38475b3b
    • T
      ACPI: Unbind ACPI drv when probe failed · 5f27ee8e
      Toshi Kani 提交于
      When acpi_device_install_notify_handler() failed in acpi_device_probe(),
      it calls acpi_drv->ops.remove() and fails the probe.  However, the ACPI
      driver is left bound to the acpi_device.  Fix it by clearing the driver
      and driver_data fields.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5f27ee8e
    • T
      ACPI: sysfs eject support for ACPI scan handlers · ce7685ad
      Toshi Kani 提交于
      Changed sysfs eject, acpi_eject_store(), so that it doesn't return
      error codes for devices nodes with ACPI scan handlers attached and
      no ACPI drivers.
      
      [rjw: Changelog]
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ce7685ad
    • R
      ACPI / scan: Follow priorities of IDs when matching scan handlers · 87b85b3c
      Rafael J. Wysocki 提交于
      The IDs of ACPI device nodes stored in their pnp.ids member arrays
      are sorted by decreasing priority (i.e. the highest-priority ID is
      the first entry).  This means that when matching scan handlers to
      device nodes, the namespace scanning code should walk the list of
      scan handlers for each device node ID instead of walking the list
      of device node IDs for each handler (the latter causes the first
      handler matching any of the device node IDs to be chosen, although
      there may be another handler matching an ID of a higher priority
      which should be preferred).  Make the code follow this observation.
      
      This change has been suggested and justified by Toshi Kani.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      87b85b3c
    • J
      ACPI / PCI: pci_slot: replace printk(KERN_xxx) with pr_xxx() · 73ce873a
      Jiang Liu 提交于
      Trivial changes to replace printk(KERN_xxx) with pr_xxx().
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      73ce873a
  2. 10 2月, 2013 2 次提交
    • L
      x86 idle: remove mwait_idle() and "idle=mwait" cmdline param · 69fb3676
      Len Brown 提交于
      mwait_idle() is a C1-only idle loop intended to be more efficient
      than HLT, starting on Pentium-4 HT-enabled processors.
      
      But mwait_idle() has been replaced by the more general
      mwait_idle_with_hints(), which handles both C1 and deeper C-states.
      ACPI processor_idle and intel_idle use only mwait_idle_with_hints(),
      and no longer use mwait_idle().
      
      Here we simplify the x86 native idle code by removing mwait_idle(),
      and the "idle=mwait" bootparam used to invoke it.
      
      Since Linux 3.0 there has been a boot-time warning when "idle=mwait"
      was invoked saying it would be removed in 2012.  This removal
      was also noted in the (now removed:-) feature-removal-schedule.txt.
      
      After this change, kernels configured with
      (CONFIG_ACPI=n && CONFIG_INTEL_IDLE=n) when run on hardware
      that supports MWAIT will simply use HLT.  If MWAIT is desired
      on those systems, cpuidle and the cpuidle drivers above
      can be enabled.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      Cc: x86@kernel.org
      69fb3676
    • Z
      ACPI: enable ACPI SCI during suspend · 89a22dad
      Zhang Rui 提交于
      Enable ACPI SCI during suspend so that SCI can be used
      as wake events for PM_SUSPEND_FREEZE.
      
      For S3/S4 transition,
      We disable all GPEs in suspend_ops->prepare_late() to
      fix a problem that GPEs may trigger SCI  before
      arch_suspend_disable_irqs() is run.
      So it is safe to leave the SCI enabled until
      arch_suspend_irq_disable() is run.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      89a22dad
  3. 09 2月, 2013 4 次提交
  4. 06 2月, 2013 1 次提交
  5. 03 2月, 2013 2 次提交
  6. 02 2月, 2013 1 次提交
    • R
      ACPI / PM: Do not power manage devices in unknown initial states · b3785492
      Rafael J. Wysocki 提交于
      In general, for ACPI device power management to work, the initial
      power states of devices must be known (otherwise, we wouldn't be able
      to keep track of power resources, for example).  Hence, if it is
      impossible to determine the initial ACPI power states of some
      devices, they can't be regarded as power-manageable using ACPI.
      
      For this reason, modify acpi_bus_get_power_flags() to clear the
      power_manageable flag if acpi_bus_init_power() fails and add some
      extra fallback code to acpi_bus_init_power() to cover broken
      BIOSes that provide _PS0/_PS3 without _PSC for some devices.
      
      Verified to work on my HP nx6325 that has this problem.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NPeter Wu <lekensteyn@gmail.com>
      b3785492
  7. 01 2月, 2013 3 次提交
  8. 31 1月, 2013 1 次提交
    • M
      efi: Make 'efi_enabled' a function to query EFI facilities · 83e68189
      Matt Fleming 提交于
      Originally 'efi_enabled' indicated whether a kernel was booted from
      EFI firmware. Over time its semantics have changed, and it now
      indicates whether or not we are booted on an EFI machine with
      bit-native firmware, e.g. 64-bit kernel with 64-bit firmware.
      
      The immediate motivation for this patch is the bug report at,
      
          https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557
      
      which details how running a platform driver on an EFI machine that is
      designed to run under BIOS can cause the machine to become
      bricked. Also, the following report,
      
          https://bugzilla.kernel.org/show_bug.cgi?id=47121
      
      details how running said driver can also cause Machine Check
      Exceptions. Drivers need a new means of detecting whether they're
      running on an EFI machine, as sadly the expression,
      
          if (!efi_enabled)
      
      hasn't been a sufficient condition for quite some time.
      
      Users actually want to query 'efi_enabled' for different reasons -
      what they really want access to is the list of available EFI
      facilities.
      
      For instance, the x86 reboot code needs to know whether it can invoke
      the ResetSystem() function provided by the EFI runtime services, while
      the ACPI OSL code wants to know whether the EFI config tables were
      mapped successfully. There are also checks in some of the platform
      driver code to simply see if they're running on an EFI machine (which
      would make it a bad idea to do BIOS-y things).
      
      This patch is a prereq for the samsung-laptop fix patch.
      
      Cc: David Airlie <airlied@linux.ie>
      Cc: Corentin Chary <corentincj@iksaif.net>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Colin Ian King <colin.king@canonical.com>
      Cc: Steve Langasek <steve.langasek@canonical.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      83e68189
  9. 30 1月, 2013 4 次提交
  10. 29 1月, 2013 1 次提交
  11. 28 1月, 2013 2 次提交
  12. 26 1月, 2013 9 次提交