1. 11 1月, 2013 1 次提交
    • B
      Merge branch 'acpi-scan' of... · 295a7f62
      Bjorn Helgaas 提交于
      Merge branch 'acpi-scan' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm into pci/yinghai-survey-resources+acpi-scan
      
      * 'acpi-scan' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI / scan: Treat power resources in a special way
        ACPI: Remove unused struct acpi_pci_root.id member
        ACPI: Drop ACPI device .bind() and .unbind() callbacks
        ACPI / PCI: Move the _PRT setup and cleanup code to pci-acpi.c
        ACPI / PCI: Rework the setup and cleanup of device wakeup
        ACPI: Add .setup() and .cleanup() callbacks to struct acpi_bus_type
        ACPI: Make acpi_bus_scan() and acpi_bus_add() take only one argument
        ACPI: Replace ACPI device add_type field with a match_driver flag
        ACPI: Drop the second argument of acpi_bus_scan()
        ACPI: Remove the arguments of acpi_bus_add() that are not used
        ACPI: Remove acpi_start_single_object() and acpi_bus_start()
        ACPI / PCI: Fold acpi_pci_root_start() into acpi_pci_root_add()
        ACPI: Change the ordering of acpi_bus_check_add()
        ACPI: Replace struct acpi_bus_ops with enum type
        ACPI: Reduce the usage of struct acpi_bus_ops
        ACPI: Make acpi_bus_add() and acpi_bus_start() visibly different
        ACPI: Change the ordering of PCI root bridge driver registrarion
        ACPI: Separate adding ACPI device objects from probing ACPI drivers
      
      Conflicts:
      	drivers/acpi/pci_root.c
      295a7f62
  2. 08 1月, 2013 9 次提交
  3. 03 1月, 2013 30 次提交
    • B
      ACPI: Remove unused struct acpi_pci_root.id member · e0ebda2e
      Bjorn Helgaas 提交于
      This member is never initialized and never referenced, so remove it.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e0ebda2e
    • R
      ACPI: Drop ACPI device .bind() and .unbind() callbacks · 3eec5f7a
      Rafael J. Wysocki 提交于
      Drop the .bind() and .unbind() that have no more users from
      struct acpi_device_ops and remove all of the code referring to
      them from drivers/acpi/scan.c.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      3eec5f7a
    • R
      ACPI / PCI: Move the _PRT setup and cleanup code to pci-acpi.c · 38a9a67a
      Rafael J. Wysocki 提交于
      Move the code related to _PRT setup and removal and to power
      resources from acpi_pci_bind() and acpi_pci_unbind() to the .setup()
      and .cleanup() callbacks in acpi_pci_bus and remove acpi_pci_bind()
      and acpi_pci_unbind() that have no purpose any more.  Accordingly,
      remove the code related to device .bind() and .unbind() operations
      from the ACPI PCI root bridge driver.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      38a9a67a
    • R
      ACPI / PCI: Rework the setup and cleanup of device wakeup · d2e5f0c1
      Rafael J. Wysocki 提交于
      Currently, the ACPI wakeup capability of PCI devices is set up
      in two different places, partially in acpi_pci_bind() where
      runtime wakeup is initialized and partially in
      platform_pci_wakeup_init(), where system wakeup is initialized.
      The cleanup is only done in acpi_pci_unbind() and it only covers
      runtime wakeup.
      
      Use the new .setup() and .cleanup() callbacks in struct acpi_bus_type
      to consolidate that code and do the setup and the cleanup each in one
      place.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      d2e5f0c1
    • R
      ACPI: Add .setup() and .cleanup() callbacks to struct acpi_bus_type · 11909ca1
      Rafael J. Wysocki 提交于
      Add two new callbacks,.setup() and .cleanup(), struct acpi_bus_type
      and modify acpi_platform_notify() to call .setup() after executing
      acpi_bind_one() successfully and acpi_platform_notify_remove() to
      call .cleanup() before running acpi_unbind_one().  This will allow
      the users of struct acpi_bus_type, PCI in particular, to specify
      operations to be executed right after the given device has been
      associated with a companion struct acpi_device and right before
      it's going to be detached from that companion, respectively.
      
      The main motivation is to be able to get rid of acpi_pci_bind()
      and acpi_pci_unbind(), which are horrible horrible stuff.  [In short,
      there are three problems with them: The way they populate the .bind()
      and .unbind() callbacks of ACPI devices is rather less than
      straightforward, they require special hotplug-specific paths to be
      present in the ACPI namespace scanning code and by the time
      acpi_pci_unbind() is called the PCI device object in question may
      not exist any more.]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      11909ca1
    • R
      ACPI: Make acpi_bus_scan() and acpi_bus_add() take only one argument · 0cd6ac52
      Rafael J. Wysocki 提交于
      The callers of acpi_bus_add() usually assume that if it has
      succeeded, then a struct acpi_device object has been attached to
      the handle passed as the first argument.  Unfortunately, however,
      this assumption is wrong, because acpi_bus_scan(), and acpi_bus_add()
      too as a result, may return a pointer to a different struct
      acpi_device object on success (it may be an object corresponding to
      one of the descendant ACPI nodes in the namespace scope below that
      handle).
      
      For this reason, the callers of acpi_bus_add() who care about
      whether or not a struct acpi_device object has been created for
      its first argument need to check that using acpi_bus_get_device()
      anyway, so the second argument of acpi_bus_add() is not really
      useful for them.  The same observation applies to acpi_bus_scan()
      executed directly from acpi_scan_init().
      
      Therefore modify the relevant callers of acpi_bus_add() to check the
      existence of the struct acpi_device in question with the help of
      acpi_bus_get_device() and drop the no longer necessary second
      argument of acpi_bus_add().  Accordingly, modify acpi_scan_init() to
      use acpi_bus_get_device() to get acpi_root and drop the no longer
      needed second argument of acpi_bus_scan().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      0cd6ac52
    • R
      ACPI: Replace ACPI device add_type field with a match_driver flag · 209d3b17
      Rafael J. Wysocki 提交于
      After the removal of the second argument of acpi_bus_scan() there is
      no difference between the ACPI_BUS_ADD_MATCH and ACPI_BUS_ADD_START
      add types, so the add_type field in struct acpi_device may be
      replaced with a single flag.  Do that calling the flag match_driver.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      209d3b17
    • R
      ACPI: Drop the second argument of acpi_bus_scan() · e3863094
      Rafael J. Wysocki 提交于
      After the removal of acpi_start_single_object() and acpi_bus_start()
      the second argument of acpi_bus_scan() is not necessary any more,
      so drop it and update acpi_bus_check_add() accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      e3863094
    • R
      ACPI: Remove the arguments of acpi_bus_add() that are not used · 636458de
      Rafael J. Wysocki 提交于
      Notice that acpi_bus_add() uses only 2 of its 4 arguments and
      redefine its header to match the body.  Update all of its callers as
      necessary and observe that this leads to quite a number of removed
      lines of code (Linus will like that).
      
      Add a kerneldoc comment documenting acpi_bus_add() and wonder how
      its callers make wrong assumptions about the second argument (make
      note to self to take care of that later).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      636458de
    • R
      ACPI: Remove acpi_start_single_object() and acpi_bus_start() · 02f57c67
      Rafael J. Wysocki 提交于
      The ACPI PCI root bridge driver was the only ACPI driver implementing
      the .start() callback, which isn't used by any ACPI drivers any more
      now.
      
      For this reason, acpi_start_single_object() has no purpose any more,
      so remove it and all references to it.  Also remove
      acpi_bus_start_device(), whose only purpose was to call
      acpi_start_single_object().
      
      Moreover, since after the removal of acpi_bus_start_device() the
      only purpose of acpi_bus_start() remains to call
      acpi_update_all_gpes(), move that into acpi_bus_add() and drop
      acpi_bus_start() too, remove its header from acpi_bus.h and
      update all of its former users accordingly.
      
      This change was previously proposed in a different from by
      Yinghai Lu.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      02f57c67
    • R
      ACPI / PCI: Fold acpi_pci_root_start() into acpi_pci_root_add() · 47525cda
      Rafael J. Wysocki 提交于
      Move the code from the ACPI PCI root bridge's .start() callback
      routine, acpi_pci_root_start(), directly into acpi_pci_root_add()
      and drop acpi_pci_root_start().
      
      It is safe to do that, because it is now always guaranteed that
      when struct pci_dev objects are created, their companion struct
      acpi_device objects are already present, so it is not necessary to
      wait for them to be created before calling pci_bus_add_devices().
      
      This change was previously proposed in a different form by
      Yinghai Lu.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      47525cda
    • R
      ACPI: Change the ordering of acpi_bus_check_add() · 4002bf38
      Rafael J. Wysocki 提交于
      If acpi_bus_check_add() is called for a handle already having an
      existing struct acpi_device object attached, it is not necessary to
      check the type and status of the device correspondig to it, so
      change the ordering of acpi_bus_check_add() to avoid that.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      4002bf38
    • R
      ACPI: Replace struct acpi_bus_ops with enum type · a2d06a1a
      Rafael J. Wysocki 提交于
      Notice that one member of struct acpi_bus_ops, acpi_op_add, is not
      used anywhere any more and the relationship between its remaining
      members, acpi_op_match and acpi_op_start, is such that it doesn't
      make sense to set the latter without setting the former at the same
      time.  Therefore, replace struct acpi_bus_ops with new a enum type,
      enum acpi_bus_add_type, with three values, ACPI_BUS_ADD_BASIC,
      ACPI_BUS_ADD_MATCH, ACPI_BUS_ADD_START, corresponding to
      both acpi_op_match and acpi_op_start unset, acpi_op_match set and
      acpi_op_start unset, and both acpi_op_match and acpi_op_start set,
      respectively.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      a2d06a1a
    • R
      ACPI: Reduce the usage of struct acpi_bus_ops · ca7b3c4f
      Rafael J. Wysocki 提交于
      Objects of type struct acpi_bus_ops are currently used to pass
      information between different parts of the ACPI namespace scanning
      code, sometimes in quite convoluted ways.  It turns out that that
      is not necessary in some cases, so simplify the code by reducing
      the utilization of struct acpi_bus_ops objects where clearly
      possible.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      ca7b3c4f
    • R
      ACPI: Make acpi_bus_add() and acpi_bus_start() visibly different · 0fc300b0
      Rafael J. Wysocki 提交于
      The current ACPI namespace scanning code suggests that acpi_bus_add()
      and acpi_bus_start() share some code.  In fact, however, they are
      completely different code paths (except for the initial checks), so
      refactor the code to make that distinction visibly clear.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      0fc300b0
    • R
      ACPI: Change the ordering of PCI root bridge driver registrarion · 92ef2a25
      Rafael J. Wysocki 提交于
      Instead of running acpi_pci_root_init() from a separate subsys
      initcall, call it directly from acpi_scan_init() before scanning the
      ACPI namespace for the first time, so that the PCI root bridge
      driver's .add() routine, acpi_pci_root_start(), is always run
      before binding ACPI drivers or attaching "companion" device objects
      to struct acpi_device objects below the root bridge's device node in
      the ACPI namespace.
      
      The first, simpler reason for doing this is that it makes the
      situation during boot more similar to the situation during hotplug,
      in which the ACPI PCI root bridge driver is always present.
      
      The second reason is that acpi_pci_root_init() causes struct pci_dev
      objects to be created for all PCI devices below the bridge and
      these objects may be necessary for whatever is done with the other
      ACPI device nodes in that namespace scope.  For example, devices
      created by acpi_create_platform_device() sometimes may need to be
      added to the device hierarchy as children of PCI bridges.  For this
      purpose, however, the struct pci_dev objects representing those
      bridges need to exist before the platform devices in question are
      registered.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      92ef2a25
    • R
      ACPI: Separate adding ACPI device objects from probing ACPI drivers · 805d410f
      Rafael J. Wysocki 提交于
      Split the ACPI namespace scanning for devices into two passes, such
      that struct acpi_device objects are registerd in the first pass
      without probing ACPI drivers and the drivers are probed against them
      directly in the second pass.
      
      There are two main reasons for doing that.
      
      First, the ACPI PCI root bridge driver's .add() routine,
      acpi_pci_root_add(), causes struct pci_dev objects to be created for
      all PCI devices under the given root bridge.  Usually, there are
      corresponding ACPI device nodes in the ACPI namespace for some of
      those devices and therefore there should be "companion" struct
      acpi_device objects to attach those struct pci_dev objects to.  These
      struct acpi_device objects should exist when the corresponding
      struct pci_dev objects are created, but that is only guaranteed
      during boot and not during hotplug.  This leads to a number of
      functional differences between the boot and the hotplug cases which
      are not strictly necessary and make the code more complicated.
      
      For example, this forces the ACPI PCI root bridge driver to defer the
      registration of the just created struct pci_dev objects and to use a
      special .start() callback routine, acpi_pci_root_start(), to make
      sure that all of the "companion" struct acpi_device objects will be
      present at PCI devices registration time during hotplug.
      
      If those differences can be eliminated, we will be able to
      consolidate the boot and hotplug code paths for the enumeration and
      registration of PCI devices and to reduce the complexity of that
      code quite a bit.
      
      The second reason is that, in general, it should be possible to
      resolve conflicts of resources assigned by the BIOS to different
      devices represented by ACPI namespace nodes before any drivers bind
      to them and before they are attached to "companion" objects
      representing physical devices (such as struct pci_dev).  However, for
      this purpose we first need to enumerate all ACPI device nodes in the
      given namespace scope.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      805d410f
    • L
      Linux 3.8-rc2 · d1c3ed66
      Linus Torvalds 提交于
      d1c3ed66
    • L
      Merge branch 'fixes-for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds · d50403dc
      Linus Torvalds 提交于
      Pull LED fix from Bryan Wu.
      
      * 'fixes-for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds:
        leds: leds-gpio: set devm_gpio_request_one() flags param correctly
      d50403dc
    • J
      leds: leds-gpio: set devm_gpio_request_one() flags param correctly · 2d7c22f6
      Javier Martinez Canillas 提交于
      commit a99d76f9 leds: leds-gpio: use gpio_request_one
      
      changed the leds-gpio driver to use gpio_request_one() instead
      of gpio_request() + gpio_direction_output()
      
      Unfortunately, it also made a semantic change that breaks the
      leds-gpio driver.
      
      The gpio_request_one() flags parameter was set to:
      
      GPIOF_DIR_OUT | (led_dat->active_low ^ state)
      
      Since GPIOF_DIR_OUT is 0, the final flags value will just be the
      XOR'ed value of led_dat->active_low and state.
      
      This value were used to distinguish between HIGH/LOW output initial
      level and call gpio_direction_output() accordingly.
      
      With this new semantic gpio_request_one() will take the flags value
      of 1 as a configuration of input direction (GPIOF_DIR_IN) and will
      call gpio_direction_input() instead of gpio_direction_output().
      
      int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
      {
      ..
      	if (flags & GPIOF_DIR_IN)
      		err = gpio_direction_input(gpio);
      	else
      		err = gpio_direction_output(gpio,
      				(flags & GPIOF_INIT_HIGH) ? 1 : 0);
      ..
      }
      
      The right semantic is to evaluate led_dat->active_low ^ state and
      set the output initial level explicitly.
      Signed-off-by: NJavier Martinez Canillas <javier.martinez@collabora.co.uk>
      Reported-by: NArnaud Patard <arnaud.patard@rtp-net.org>
      Tested-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      2d7c22f6
    • L
      Merge git://www.linux-watchdog.org/linux-watchdog · ef05e9b9
      Linus Torvalds 提交于
      Pull watchdog fixes from Wim Van Sebroeck:
       "This fixes some small errors in the new da9055 driver, eliminates a
        compiler warning and adds DT support for the twl4030_wdt driver (so
        that we can have multiple watchdogs with DT on the omap platforms)."
      
      * git://www.linux-watchdog.org/linux-watchdog:
        watchdog: twl4030_wdt: add DT support
        watchdog: omap_wdt: eliminate unused variable and a compiler warning
        watchdog: da9055: Don't update wdt_dev->timeout in da9055_wdt_set_timeout error path
        watchdog: da9055: Fix invalid free of devm_ allocated data
      ef05e9b9
    • L
      Merge tag '3.8-pci-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · 080a62e2
      Linus Torvalds 提交于
      Pull PCI updates from Bjorn Helgaas:
       "Some fixes for v3.8.  They include a fix for the new SR-IOV sysfs
        management support, an expanded quirk for Ricoh SD card readers, a
        Stratus DMI quirk fix, and a PME polling fix."
      
      * tag '3.8-pci-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        PCI: Reduce Ricoh 0xe822 SD card reader base clock frequency to 50MHz
        PCI/PM: Do not suspend port if any subordinate device needs PME polling
        PCI: Add PCIe Link Capability link speed and width names
        PCI: Work around Stratus ftServer broken PCIe hierarchy (fix DMI check)
        PCI: Remove spurious error for sriov_numvfs store and simplify flow
      080a62e2
    • D
      UAPI: Strip _UAPI prefix on header install no matter the whitespace · 8a7eab2b
      David Howells 提交于
      Commit 56c176c9 ("UAPI: strip the _UAPI prefix from header guards
      during header installation") strips the _UAPI prefix from header guards,
      but only if there's a single space between the cpp directive and the
      label.
      
      Make it more flexible and able to handle tabs and multiple white space
      characters.
      Signed-off-by: NDavid Howells <dhowell@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8a7eab2b
    • D
      UAPI: Remove empty Kbuild files · 3d33fcc1
      David Howells 提交于
      Empty files can get deleted by the patch program, so remove empty Kbuild
      files and their links from the parent Kbuilds.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3d33fcc1
    • L
      Merge tag 'ecryptfs-3.8-rc2-fixes' of... · 007f6c3a
      Linus Torvalds 提交于
      Merge tag 'ecryptfs-3.8-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs
      
      Pull ecryptfs fixes from Tyler Hicks:
       "Two self-explanatory fixes and a third patch which improves
        performance: when overwriting a full page in the eCryptfs page cache,
        skip reading in and decrypting the corresponding lower page."
      
      * tag 'ecryptfs-3.8-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs:
        fs/ecryptfs/crypto.c: make ecryptfs_encode_for_filename() static
        eCryptfs: fix to use list_for_each_entry_safe() when delete items
        eCryptfs: Avoid unnecessary disk read and data decryption during writing
      007f6c3a
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client · 58890c06
      Linus Torvalds 提交于
      Pull Ceph fixes from Sage Weil:
       "Two of Alex's patches deal with a race when reseting server
        connections for open RBD images, one demotes some non-fatal BUGs to
        WARNs, and my patch fixes a protocol feature bit failure path."
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
        libceph: fix protocol feature mismatch failure path
        libceph: WARN, don't BUG on unexpected connection states
        libceph: always reset osds when kicking
        libceph: move linger requests sooner in kick_requests()
      58890c06
    • M
      mm: mempolicy: Convert shared_policy mutex to spinlock · 42288fe3
      Mel Gorman 提交于
      Sasha was fuzzing with trinity and reported the following problem:
      
        BUG: sleeping function called from invalid context at kernel/mutex.c:269
        in_atomic(): 1, irqs_disabled(): 0, pid: 6361, name: trinity-main
        2 locks held by trinity-main/6361:
         #0:  (&mm->mmap_sem){++++++}, at: [<ffffffff810aa314>] __do_page_fault+0x1e4/0x4f0
         #1:  (&(&mm->page_table_lock)->rlock){+.+...}, at: [<ffffffff8122f017>] handle_pte_fault+0x3f7/0x6a0
        Pid: 6361, comm: trinity-main Tainted: G        W
        3.7.0-rc2-next-20121024-sasha-00001-gd95ef01-dirty #74
        Call Trace:
          __might_sleep+0x1c3/0x1e0
          mutex_lock_nested+0x29/0x50
          mpol_shared_policy_lookup+0x2e/0x90
          shmem_get_policy+0x2e/0x30
          get_vma_policy+0x5a/0xa0
          mpol_misplaced+0x41/0x1d0
          handle_pte_fault+0x465/0x6a0
      
      This was triggered by a different version of automatic NUMA balancing
      but in theory the current version is vunerable to the same problem.
      
      do_numa_page
        -> numa_migrate_prep
          -> mpol_misplaced
            -> get_vma_policy
              -> shmem_get_policy
      
      It's very unlikely this will happen as shared pages are not marked
      pte_numa -- see the page_mapcount() check in change_pte_range() -- but
      it is possible.
      
      To address this, this patch restores sp->lock as originally implemented
      by Kosaki Motohiro.  In the path where get_vma_policy() is called, it
      should not be calling sp_alloc() so it is not necessary to treat the PTL
      specially.
      Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Tested-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: NMel Gorman <mgorman@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      42288fe3
    • L
      Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 5439ca6b
      Linus Torvalds 提交于
      Pull ext4 bug fixes from Ted Ts'o:
       "Various bug fixes for ext4.  Perhaps the most serious bug fixed is one
        which could cause file system corruptions when performing file punch
        operations."
      
      * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: avoid hang when mounting non-journal filesystems with orphan list
        ext4: lock i_mutex when truncating orphan inodes
        ext4: do not try to write superblock on ro remount w/o journal
        ext4: include journal blocks in df overhead calcs
        ext4: remove unaligned AIO warning printk
        ext4: fix an incorrect comment about i_mutex
        ext4: fix deadlock in journal_unmap_buffer()
        ext4: split off ext4_journalled_invalidatepage()
        jbd2: fix assertion failure in jbd2_journal_flush()
        ext4: check dioread_nolock on remount
        ext4: fix extent tree corruption caused by hole punch
      5439ca6b
    • H
      mempolicy: remove arg from mpol_parse_str, mpol_to_str · a7a88b23
      Hugh Dickins 提交于
      Remove the unused argument (formerly no_context) from mpol_parse_str()
      and from mpol_to_str().
      Signed-off-by: NHugh Dickins <hughd@google.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a7a88b23
    • H
      tmpfs mempolicy: fix /proc/mounts corrupting memory · f2a07f40
      Hugh Dickins 提交于
      Recently I suggested using "mount -o remount,mpol=local /tmp" in NUMA
      mempolicy testing.  Very nasty.  Reading /proc/mounts, /proc/pid/mounts
      or /proc/pid/mountinfo may then corrupt one bit of kernel memory, often
      in a page table (causing "Bad swap" or "Bad page map" warning or "Bad
      pagetable" oops), sometimes in a vm_area_struct or rbnode or somewhere
      worse.  "mpol=prefer" and "mpol=prefer:Node" are equally toxic.
      
      Recent NUMA enhancements are not to blame: this dates back to 2.6.35,
      when commit e17f74af "mempolicy: don't call mpol_set_nodemask() when
      no_context" skipped mpol_parse_str()'s call to mpol_set_nodemask(),
      which used to initialize v.preferred_node, or set MPOL_F_LOCAL in flags.
      With slab poisoning, you can then rely on mpol_to_str() to set the bit
      for node 0x6b6b, probably in the next page above the caller's stack.
      
      mpol_parse_str() is only called from shmem_parse_options(): no_context
      is always true, so call it unused for now, and remove !no_context code.
      Set v.nodes or v.preferred_node or MPOL_F_LOCAL as mpol_to_str() might
      expect.  Then mpol_to_str() can ignore its no_context argument also,
      the mpol being appropriately initialized whether contextualized or not.
      Rename its no_context unused too, and let subsequent patch remove them
      (that's not needed for stable backporting, which would involve rejects).
      
      I don't understand why MPOL_LOCAL is described as a pseudo-policy:
      it's a reasonable policy which suffers from a confusing implementation
      in terms of MPOL_PREFERRED with MPOL_F_LOCAL.  I believe this would be
      much more robust if MPOL_LOCAL were recognized in switch statements
      throughout, MPOL_F_LOCAL deleted, and MPOL_PREFERRED use the (possibly
      empty) nodes mask like everyone else, instead of its preferred_node
      variant (I presume an optimization from the days before MPOL_LOCAL).
      But that would take me too long to get right and fully tested.
      Signed-off-by: NHugh Dickins <hughd@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f2a07f40