1. 29 4月, 2019 1 次提交
    • N
      powerpc/pseries: Track LMB nid instead of using device tree · b2d3b5ee
      Nathan Fontenot 提交于
      When removing memory we need to remove the memory from the node
      it was added to instead of looking up the node it should be in
      in the device tree.
      
      During testing we have seen scenarios where the affinity for a
      LMB changes due to a partition migration or PRRN event. In these
      cases the node the LMB exists in may not match the node the device
      tree indicates it belongs in. This can lead to a system crash
      when trying to DLPAR remove the LMB after a migration or PRRN
      event. The current code looks up the node in the device tree to
      remove the LMB from, the crash occurs when we try to offline this
      node and it does not have any data, i.e. node_data[nid] == NULL.
      
      36:mon> e
      cpu 0x36: Vector: 300 (Data Access) at [c0000001828b7810]
          pc: c00000000036d08c: try_offline_node+0x2c/0x1b0
          lr: c0000000003a14ec: remove_memory+0xbc/0x110
          sp: c0000001828b7a90
         msr: 800000000280b033
         dar: 9a28
       dsisr: 40000000
        current = 0xc0000006329c4c80
        paca    = 0xc000000007a55200   softe: 0        irq_happened: 0x01
          pid   = 76926, comm = kworker/u320:3
      
      36:mon> t
      [link register   ] c0000000003a14ec remove_memory+0xbc/0x110
      [c0000001828b7a90] c00000000006a1cc arch_remove_memory+0x9c/0xd0 (unreliable)
      [c0000001828b7ad0] c0000000003a14e0 remove_memory+0xb0/0x110
      [c0000001828b7b20] c0000000000c7db4 dlpar_remove_lmb+0x94/0x160
      [c0000001828b7b60] c0000000000c8ef8 dlpar_memory+0x7e8/0xd10
      [c0000001828b7bf0] c0000000000bf828 handle_dlpar_errorlog+0xf8/0x160
      [c0000001828b7c60] c0000000000bf8cc pseries_hp_work_fn+0x3c/0xa0
      [c0000001828b7c90] c000000000128cd8 process_one_work+0x298/0x5a0
      [c0000001828b7d20] c000000000129068 worker_thread+0x88/0x620
      [c0000001828b7dc0] c00000000013223c kthread+0x1ac/0x1c0
      [c0000001828b7e30] c00000000000b45c ret_from_kernel_thread+0x5c/0x80
      
      To resolve this we need to track the node a LMB belongs to when
      it is added to the system so we can remove it from that node instead
      of the node that the device tree indicates it should belong to.
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      b2d3b5ee
  2. 22 12月, 2018 1 次提交
  3. 21 12月, 2018 1 次提交
    • M
      powerpc/fadump: Do not allow hot-remove memory from fadump reserved area. · 0db6896f
      Mahesh Salgaonkar 提交于
      For fadump to work successfully there should not be any holes in reserved
      memory ranges where kernel has asked firmware to move the content of old
      kernel memory in event of crash. Now that fadump uses CMA for reserved
      area, this memory area is now not protected from hot-remove operations
      unless it is cma allocated. Hence, fadump service can fail to re-register
      after the hot-remove operation, if hot-removed memory belongs to fadump
      reserved region. To avoid this make sure that memory from fadump reserved
      area is not hot-removable if fadump is registered.
      
      However, if user still wants to remove that memory, he can do so by
      manually stopping fadump service before hot-remove operation.
      Signed-off-by: NMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      0db6896f
  4. 26 11月, 2018 1 次提交
  5. 31 10月, 2018 2 次提交
    • D
      mm/memory_hotplug: make add_memory() take the device_hotplug_lock · 8df1d0e4
      David Hildenbrand 提交于
      add_memory() currently does not take the device_hotplug_lock, however
      is aleady called under the lock from
      	arch/powerpc/platforms/pseries/hotplug-memory.c
      	drivers/acpi/acpi_memhotplug.c
      to synchronize against CPU hot-remove and similar.
      
      In general, we should hold the device_hotplug_lock when adding memory to
      synchronize against online/offline request (e.g.  from user space) - which
      already resulted in lock inversions due to device_lock() and
      mem_hotplug_lock - see 30467e0b ("mm, hotplug: fix concurrent memory
      hot-add deadlock").  add_memory()/add_memory_resource() will create memory
      block devices, so this really feels like the right thing to do.
      
      Holding the device_hotplug_lock makes sure that a memory block device
      can really only be accessed (e.g. via .online/.state) from user space,
      once the memory has been fully added to the system.
      
      The lock is not held yet in
      	drivers/xen/balloon.c
      	arch/powerpc/platforms/powernv/memtrace.c
      	drivers/s390/char/sclp_cmd.c
      	drivers/hv/hv_balloon.c
      So, let's either use the locked variants or take the lock.
      
      Don't export add_memory_resource(), as it once was exported to be used by
      XEN, which is never built as a module.  If somebody requires it, we also
      have to export a locked variant (as device_hotplug_lock is never
      exported).
      
      Link: http://lkml.kernel.org/r/20180925091457.28651-3-david@redhat.comSigned-off-by: NDavid Hildenbrand <david@redhat.com>
      Reviewed-by: NPavel Tatashin <pavel.tatashin@microsoft.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NRashmica Gupta <rashmica.g@gmail.com>
      Reviewed-by: NOscar Salvador <osalvador@suse.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
      Cc: John Allen <jallen@linux.vnet.ibm.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Mathieu Malaterre <malat@debian.org>
      Cc: Pavel Tatashin <pavel.tatashin@microsoft.com>
      Cc: YASUAKI ISHIMATSU <yasu.isimatu@gmail.com>
      Cc: Balbir Singh <bsingharora@gmail.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Neuling <mikey@neuling.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8df1d0e4
    • D
      mm/memory_hotplug: make remove_memory() take the device_hotplug_lock · d15e5926
      David Hildenbrand 提交于
      Patch series "mm: online/offline_pages called w.o. mem_hotplug_lock", v3.
      
      Reading through the code and studying how mem_hotplug_lock is to be used,
      I noticed that there are two places where we can end up calling
      device_online()/device_offline() - online_pages()/offline_pages() without
      the mem_hotplug_lock.  And there are other places where we call
      device_online()/device_offline() without the device_hotplug_lock.
      
      While e.g.
      	echo "online" > /sys/devices/system/memory/memory9/state
      is fine, e.g.
      	echo 1 > /sys/devices/system/memory/memory9/online
      Will not take the mem_hotplug_lock. However the device_lock() and
      device_hotplug_lock.
      
      E.g.  via memory_probe_store(), we can end up calling
      add_memory()->online_pages() without the device_hotplug_lock.  So we can
      have concurrent callers in online_pages().  We e.g.  touch in
      online_pages() basically unprotected zone->present_pages then.
      
      Looks like there is a longer history to that (see Patch #2 for details),
      and fixing it to work the way it was intended is not really possible.  We
      would e.g.  have to take the mem_hotplug_lock in device/base/core.c, which
      sounds wrong.
      
      Summary: We had a lock inversion on mem_hotplug_lock and device_lock().
      More details can be found in patch 3 and patch 6.
      
      I propose the general rules (documentation added in patch 6):
      
      1. add_memory/add_memory_resource() must only be called with
         device_hotplug_lock.
      2. remove_memory() must only be called with device_hotplug_lock. This is
         already documented and holds for all callers.
      3. device_online()/device_offline() must only be called with
         device_hotplug_lock. This is already documented and true for now in core
         code. Other callers (related to memory hotplug) have to be fixed up.
      4. mem_hotplug_lock is taken inside of add_memory/remove_memory/
         online_pages/offline_pages.
      
      To me, this looks way cleaner than what we have right now (and easier to
      verify).  And looking at the documentation of remove_memory, using
      lock_device_hotplug also for add_memory() feels natural.
      
      This patch (of 6):
      
      remove_memory() is exported right now but requires the
      device_hotplug_lock, which is not exported.  So let's provide a variant
      that takes the lock and only export that one.
      
      The lock is already held in
      	arch/powerpc/platforms/pseries/hotplug-memory.c
      	drivers/acpi/acpi_memhotplug.c
      	arch/powerpc/platforms/powernv/memtrace.c
      
      Apart from that, there are not other users in the tree.
      
      Link: http://lkml.kernel.org/r/20180925091457.28651-2-david@redhat.comSigned-off-by: NDavid Hildenbrand <david@redhat.com>
      Reviewed-by: NPavel Tatashin <pavel.tatashin@microsoft.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NRashmica Gupta <rashmica.g@gmail.com>
      Reviewed-by: NOscar Salvador <osalvador@suse.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Rashmica Gupta <rashmica.g@gmail.com>
      Cc: Michael Neuling <mikey@neuling.org>
      Cc: Balbir Singh <bsingharora@gmail.com>
      Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
      Cc: John Allen <jallen@linux.vnet.ibm.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: YASUAKI ISHIMATSU <yasu.isimatu@gmail.com>
      Cc: Mathieu Malaterre <malat@debian.org>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d15e5926
  6. 13 10月, 2018 1 次提交
  7. 19 9月, 2018 1 次提交
    • N
      powerpc/pseries/memory-hotplug: Only update DT once per memory DLPAR request · 063b8b12
      Nathan Fontenot 提交于
      The updates to powerpc numa and memory hotplug code now use the
      in-kernel LMB array instead of the device tree. This change allows the
      pseries memory DLPAR code to only update the device tree once after
      successfully handling a DLPAR request.
      
      Prior to the in-kernel LMB array, the numa code looked up the affinity
      for memory being added in the device tree, the code now looks this up
      in the LMB array. This change means the memory hotplug code can just
      update the affinity for an LMB in the LMB array instead of updating
      the device tree.
      
      This also provides a savings in kernel memory. When updating the
      device tree old properties are never free'ed since there is no
      usecount on properties. This behavior leads to a new copy of the
      property being allocated every time a LMB is added or removed (i.e. a
      request to add 100 LMBs creates 100 new copies of the property). With
      this update only a single new property is created when a DLPAR request
      completes successfully.
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      063b8b12
  8. 16 1月, 2018 2 次提交
    • N
      powerpc: Move of_drconf_cell struct to asm/drmem.h · 2c777215
      Nathan Fontenot 提交于
      Now that the powerpc code parses dynamic reconfiguration memory
      LMB information from the LMB array and not the device tree
      directly we can move the of_drconf_cell struct to drmem.h where
      it fits better.
      
      In addition, the struct is renamed to of_drconf_cell_v1 in
      anticipation of upcoming support for version 2 of the dynamic
      reconfiguration property and the members are typed as __be*
      values to reflect how they exist in the device tree.
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      2c777215
    • N
      powerpc/pseries: Update memory hotplug code to use drmem LMB array · 6195a500
      Nathan Fontenot 提交于
      Update the pseries memory hotplug code to use the newly added
      dynamic reconfiguration LMB array. Doing this is required for the
      upcoming support of version 2 of the dynamic reconfiguration
      device tree property.
      
      In addition, making this change cleans up the code that parses the
      LMB information as we no longer need to worry about device tree
      format. This allows us to discard one of the first steps on memory
      hotplug where we make a working copy of the device tree property and
      convert the entire property to cpu format. Instead we just use the
      LMB array directly while holding the memory hotplug lock.
      
      This patch also moves the updating of the device tree property to
      powerpc/mm/drmem.c. This allows to the hotplug code to work without
      needing to know the device tree format and provides a single
      routine for updating the device tree property. This new routine
      will handle determination of the proper device tree format and
      generate a properly formatted device tree property.
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      6195a500
  9. 31 8月, 2017 1 次提交
  10. 10 8月, 2017 1 次提交
    • N
      powerpc/pseries: Check memory device state before onlining/offlining · 1a367063
      Nathan Fontenot 提交于
      When DLPAR adding or removing memory we need to check the device
      offline status before trying to online/offline the memory. This is
      needed because calls to device_online() and device_offline() will
      return non-zero for memory that is already online and offline
      respectively.
      
      This update resolves two scenarios. First, for a kernel built with
      auto-online memory enabled (CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y),
      memory will be onlined as part of calls to add_memory(). After adding
      the memory the pseries DLPAR code tries to online it and fails since
      the memory is already online. The DLPAR code then tries to remove the
      memory which produces the oops message below because the memory is not
      offline.
      
      The second scenario occurs when removing memory that is already
      offline, i.e. marking memory offline (via sysfs) and then trying to
      remove that memory. This doesn't work because offlining the already
      offline memory does not succeed and the DLPAR code then fails the
      DLPAR remove operation.
      
      The fix for both scenarios is to check the device.offline status
      before making the calls to device_online() or device_offline().
      
        kernel BUG at mm/memory_hotplug.c:1936!
        ...
        NIP [c0000000002ca428] .remove_memory+0xb8/0xc0
        LR [c0000000002ca3cc] .remove_memory+0x5c/0xc0
        Call Trace:
          .remove_memory+0x5c/0xc0 (unreliable)
          .dlpar_add_lmb+0x384/0x400
          .dlpar_memory+0x5dc/0xca0
          .handle_dlpar_errorlog+0x74/0xe0
          .pseries_hp_work_fn+0x2c/0x90
          .process_one_work+0x17c/0x460
          .worker_thread+0x88/0x500
          .kthread+0x15c/0x1a0
          .ret_from_kernel_thread+0x58/0xc0
      
      Fixes: 943db62c ("powerpc/pseries: Revert 'Auto-online hotplugged memory'")
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      [mpe: Use bool, add explicit rc=0 case, change log typos & formatting]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      1a367063
  11. 28 6月, 2017 1 次提交
  12. 01 6月, 2017 1 次提交
  13. 21 2月, 2017 1 次提交
    • N
      powerpc/pseries: Revert 'Auto-online hotplugged memory' · 943db62c
      Nathan Fontenot 提交于
      This reverts commit ec999072 ("powerpc/pseries: Auto-online
      hotplugged memory"), and 9dc51281 ("powerpc: Fix unused function
      warning 'lmb_to_memblock'").
      
      Using the auto-online acpability does online added memory but does not
      update the associated device struct to indicate that the memory is
      online. This causes the pseries memory DLPAR code to fail when trying to
      remove a LMB that was previously removed and added back. This happens
      when validating that the LMB is removable.
      
      This patch reverts to the previous behavior of calling device_online()
      to online the LMB when it is DLPAR added and moves the lmb_to_memblock()
      routine out of CONFIG_MEMORY_HOTREMOVE now that we call it for add.
      
      Fixes: ec999072 ("powerpc/pseries: Auto-online hotplugged memory")
      Cc: stable@vger.kernel.org # v4.8+
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      943db62c
  14. 17 2月, 2017 2 次提交
  15. 16 2月, 2017 1 次提交
  16. 02 2月, 2017 2 次提交
  17. 01 12月, 2016 1 次提交
    • N
      powerpc/pseries: Use lmb_is_removable() to check removability · 2db029ef
      Nathan Fontenot 提交于
      We should be using lmb_is_removable() to validate that enough LMBs
      are available to remove when doing a remove by count. This will check
      that the LMB is owned by the system and it is considered removable.
      This patch also adds a pr_info() notification to report the LMB count
      to remove was not satisfied.
      
      What we do now is just check that there are enough LMBs owned by the
      system when validating there are enough LMBs to remove. This can
      lead to situations where there are enough LMBs owned by the system
      but not enough that are considered removable. This results in having
      to bail out of the remove operation instead of just failing the request
      that we should have known wouldn't succeed.
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      2db029ef
  18. 09 8月, 2016 1 次提交
    • A
      powerpc: Fix unused function warning 'lmb_to_memblock' · 9dc51281
      Alastair D'Silva 提交于
      This patch fixes the following warning:
      arch/powerpc/platforms/pseries/hotplug-memory.c:323:29: error: 'lmb_to_memblock' defined but not used [-Werror=unused-function]
      static struct memory_block *lmb_to_memblock(struct of_drconf_cell *lmb)
                                 ^~~~~~~~~~~~~~~
      
      The only consumer of this function is 'dlpar_remove_lmb', which is
      enabled with CONFIG_MEMORY_HOTREMOVE, so move it into the same
      ifdef block.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      9dc51281
  19. 15 7月, 2016 4 次提交
  20. 11 4月, 2016 2 次提交
    • N
      powerpc/pseries: Update LMB associativity index during DLPAR add/remove · bdf5fc63
      Nathan Fontenot 提交于
      The associativity array index specified for a LMB in the device tree,
      /ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory, needs to be updated
      prior to DLPAR adding a LMB and after DLPAR removing a LMB.
      
      Without doing this step in the DLPAR add process a LMB could be configured
      with the incorrect affinity. For a LMB that was not present at boot the
      affinity index is set to 0xffffffff, which defaults to adding the LMB to
      the first online node since the index is not a valid value. Or, the
      affinity index could contain a stale value if the LMB was present at boot
      but later DLPAR removed and is being DLPAR added back to the system.
      
      This patch adds a step in the DLPAR add flow to look up the associativity
      index for a LMB prior to adding a LMB and setting the associativity to
      0xffffffff when a LMB is removed.
      
      This patch also modifies the DLPAR add/remove flow to no longer do a single
      update of the device tree property after all of the requested DLPAR
      operations are complete and now does a property update during the add
      or remove of each LMB.
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      bdf5fc63
    • N
      powerpc/pseries: Refactor dlpar_add_lmb() code · 4a4bdfea
      Nathan Fontenot 提交于
      Re-factor dlpar_lmb_add() routine by moving the validation of the lmb
      flags and the acquireing of the DRC to a wrapper around the work to add
      the memory to the system. This is done to make handling of errors
      during the addition of the memory easier and to facilitate the upcoming
      addition of updating the lmb's affinity prior to adding the memory.
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      4a4bdfea
  21. 18 8月, 2015 1 次提交
  22. 15 4月, 2015 1 次提交
  23. 14 4月, 2015 1 次提交
  24. 17 3月, 2015 3 次提交
    • N
      powerpc/pseries: Implement memory hotplug remove in the kernel · 51925fb3
      Nathan Fontenot 提交于
      This patch adds the ability to do memory hotplug remove in the kernel.
      
      Currently the operation to hotplug remove memory is handled by the drmgr
      command which performs the operation by performing some work in user-space
      and making requests to the kernel to handle other pieces. By moving all
      of the work to the kernel we can do the remove faster, and provide a common
      code path to do memory hotplug for both the PowerVM and PowerKVM environments.
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      51925fb3
    • N
      powerpc/pseries: Implement memory hotplug add in the kernel · 5f97b2a0
      Nathan Fontenot 提交于
      This patch adds the ability to do memory hotplug add in the kernel.
      
      Currently the operation to hotplug add memory is handled by the drmgr
      command which performs the operation by performing some work in user-space
      and making requests to the kernel to handle other pieces. By moving all
      of the work to the kernel we can do the add faster, and provide a common
      code path to do memory hotplug for both the PowerVM and PowerKVM environments.
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      5f97b2a0
    • N
      powerpc/pseries: Create new device hotplug entry point · 999e2dad
      Nathan Fontenot 提交于
      The current hotplug (or dlpar) of devices (the process is generally the
      same for memory, cpu, and pci) on PowerVM systems is initiated
      from the HMC, which communicates the request to the partitions through
      the RSCT framework. The RSCT framework then invokes the drmgr command.
      The drmgr command performs the hotplug operation by doing some pieces,
      such as most of the rtas calls and device tree parsing, in userspace
      and make requests to the kernel to online/offline the device, update the
      device tree and add/remove the device.
      
      For PowerKVM the approach for device hotplug is to follow what is currently
      being done for pci hotplug. A hotplug request is initiated from the host.
      QEMU then generates an EPOW interrupt to the guest which causes the guest
      to make the rtas,check-exception call. In QEMU, the rtas,check-exception call
      returns a rtas hotplug event to the guest.
      
      Please note that the current pci hotplug path for PowerKVM involves the
      kernel receiving the rtas hotplug event, passing it to rtas_errd in
      userspace, and having rtas_errd invoke drmgr. The drmgr command then
      handles the request as described above for PowerVM systems.
      
      There is no need for this circuitous route, we should just handle the entire
      hotplug of devices in the kernel. What I am planning is to enable this
      by moving the code to handle hotplug from drmgr into the kernel to
      provide a single path for handling device hotplug for both PowerVM and
      PowerKVM systems. This patch provides the common iframework and entry point.
      For PowerKVM a future update to the kernel rtas code will recognize rtas
      hotplug events returned from rtas,check-exception calls and use the common
      entry point to handle hotplug of the device.
      
      For PowerVM systems, This patch creates /sys/kernel/dlpar that can be
      used by the drmgr command to initiate hotplug requests. In order to do
      this a string of the format "<resource> <action> <id_type> <id>" is
      written to this file. The string consists of a resource (cpu, memory, pci,
      phb), an action (add or remove), an id_type (count, drc index, drc name),
      and the corresponding id. The kernel will parse the string and create a
      rtas hotplug section that can be passed to the common entry point for
      handling hotplug requests.
      
      It should be noted that there is no chance of updating how we receive
      hotplug (dlpar) requests from the HMC on PowerVM systems.
      Signed-off-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      999e2dad
  25. 25 11月, 2014 1 次提交
    • G
      of/reconfig: Always use the same structure for notifiers · f5242e5a
      Grant Likely 提交于
      The OF_RECONFIG notifier callback uses a different structure depending
      on whether it is a node change or a property change. This is silly, and
      not very safe. Rework the code to use the same data structure regardless
      of the type of notifier.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
      Cc: <linuxppc-dev@lists.ozlabs.org>
      f5242e5a
  26. 05 11月, 2014 1 次提交
  27. 25 9月, 2014 1 次提交
  28. 09 9月, 2014 1 次提交
  29. 26 8月, 2014 1 次提交
  30. 13 8月, 2014 1 次提交
    • G
      powerpc/pseries: Failure on removing device node · f1b3929c
      Gavin Shan 提交于
      While running command "drmgr -c phb -r -s 'PHB 528'", following
      backtrace jumped out because the target device node isn't marked
      with OF_DETACHED by of_detach_node(), which caused by error
      returned from memory hotplug related reconfig notifier when
      disabling CONFIG_MEMORY_HOTREMOVE. The patch fixes it.
      
      ERROR: Bad of_node_put() on /pci@800000020000210/ethernet@0
      CPU: 14 PID: 2252 Comm: drmgr Tainted: G        W     3.16.0+ #427
      Call Trace:
      [c000000012a776a0] [c000000000013d9c] .show_stack+0x88/0x148 (unreliable)
      [c000000012a77750] [c00000000083cd34] .dump_stack+0x7c/0x9c
      [c000000012a777d0] [c0000000006807c4] .of_node_release+0x58/0xe0
      [c000000012a77860] [c00000000038a7d0] .kobject_release+0x174/0x1b8
      [c000000012a77900] [c00000000038a884] .kobject_put+0x70/0x78
      [c000000012a77980] [c000000000681680] .of_node_put+0x28/0x34
      [c000000012a77a00] [c000000000681ea8] .__of_get_next_child+0x64/0x70
      [c000000012a77a90] [c000000000682138] .of_find_node_by_path+0x1b8/0x20c
      [c000000012a77b40] [c000000000051840] .ofdt_write+0x308/0x688
      [c000000012a77c20] [c000000000238430] .proc_reg_write+0xb8/0xd4
      [c000000012a77cd0] [c0000000001cbeac] .vfs_write+0xec/0x1f8
      [c000000012a77d70] [c0000000001cc3b0] .SyS_write+0x58/0xa0
      [c000000012a77e30] [c00000000000a064] syscall_exit+0x0/0x98
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      f1b3929c