Public bug reported:

Description:

> 1) Some p2pdma user calls pci_alloc_p2pmem() to get some memory to DMA
> to taking a reference to the pgmap.
> 2) Another process unbinds the underlying p2pdma driver and the devm
> chain starts to unwind.
> 3) devm_memremap_pages_release() is called and it kills the reference
> and drop's it's last reference.

Oh! Yes, nice find. We need to wait for the percpu-ref to be dead and
all outstanding references dropped before we can proceed to
arch_remove_memory(), and I think this problem has been there since
day one because the final exit was always after devm_memremap_pages()
release which means arch_remove_memory() was always racing any final
put_page(). I'll take a look, it seems the arch_remove_pages() call
needs to be moved out-of-line to its own context and wait for the
final exit of the percpu-ref.

Target Release: 19.10
Target Kernel: 5.3

** Affects: intel
     Importance: Undecided
         Status: New

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: intel-kernel-19.10

** Also affects: linux (Ubuntu)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1835349

Title:
  Fix devm_memremap_pages shutdown handling

Status in intel:
  New
Status in linux package in Ubuntu:
  New

Bug description:
  Description:

  > 1) Some p2pdma user calls pci_alloc_p2pmem() to get some memory to DMA
  > to taking a reference to the pgmap.
  > 2) Another process unbinds the underlying p2pdma driver and the devm
  > chain starts to unwind.
  > 3) devm_memremap_pages_release() is called and it kills the reference
  > and drop's it's last reference.

  Oh! Yes, nice find. We need to wait for the percpu-ref to be dead and
  all outstanding references dropped before we can proceed to
  arch_remove_memory(), and I think this problem has been there since
  day one because the final exit was always after devm_memremap_pages()
  release which means arch_remove_memory() was always racing any final
  put_page(). I'll take a look, it seems the arch_remove_pages() call
  needs to be moved out-of-line to its own context and wait for the
  final exit of the percpu-ref.

  Target Release: 19.10
  Target Kernel: 5.3

To manage notifications about this bug go to:
https://bugs.launchpad.net/intel/+bug/1835349/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to