qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 6e48e8: memory: unregister AddressSpace Memor


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 6e48e8: memory: unregister AddressSpace MemoryListener wit...
Date: Tue, 10 Feb 2015 22:30:08 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 6e48e8f9e0f5b6b15c41f6f8a68c9bf330147d45
      
https://github.com/qemu/qemu/commit/6e48e8f9e0f5b6b15c41f6f8a68c9bf330147d45
  Author: Paolo Bonzini <address@hidden>
  Date:   2015-02-10 (Tue, 10 Feb 2015)

  Changed paths:
    M exec.c
    M include/exec/memory-internal.h
    M memory.c

  Log Message:
  -----------
  memory: unregister AddressSpace MemoryListener within BQL

address_space_destroy_dispatch is called from an RCU callback and hence
outside the iothread mutex (BQL).  However, after address_space_destroy
no new accesses can hit the destroyed AddressSpace so it is not necessary
to observe changes to the memory map.  Move the memory_listener_unregister
call earlier, to make it thread-safe again.

Reported-by: Alex Williamson <address@hidden>
Fixes: 374f2981d1f10bc4307f250f24b2a7ddb9b14be0
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>


  Commit: 217e9fdcadb1dc7462f4d92866314f626426fa82
      
https://github.com/qemu/qemu/commit/217e9fdcadb1dc7462f4d92866314f626426fa82
  Author: Paolo Bonzini <address@hidden>
  Date:   2015-02-10 (Tue, 10 Feb 2015)

  Changed paths:
    M hw/vfio/common.c
    M hw/vfio/pci.c
    M include/hw/vfio/vfio-common.h

  Log Message:
  -----------
  vfio: cleanup vfio_get_device error path, remove vfio_populate_device callback

Now that vfio_put_base_device is called unconditionally at instance_finalize
time, it can be called twice if vfio_populate_device fails.  This works
but it is slightly harder to follow.

Change vfio_get_device to not touch the vbasedev struct until it will
definitely succeed, moving the vfio_populate_device call back to vfio-pci.
This way, vfio_put_base_device will only be called once.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>


  Commit: 77a10d04d033484a913a5ee76eed31a9acc57bae
      
https://github.com/qemu/qemu/commit/77a10d04d033484a913a5ee76eed31a9acc57bae
  Author: Paolo Bonzini <address@hidden>
  Date:   2015-02-10 (Tue, 10 Feb 2015)

  Changed paths:
    M hw/vfio/common.c
    M hw/vfio/pci.c

  Log Message:
  -----------
  vfio: free dynamically-allocated data in instance_finalize

In order to enable out-of-BQL address space lookup, destruction of
devices needs to be split in two phases.

Unrealize is the first phase; once it complete no new accesses will
be started, but there may still be pending memory accesses can still
be completed.

The second part is freeing the device, which only happens once all memory
accesses are complete.  At this point the reference count has dropped to
zero, an RCU grace period must have completed (because the RCU-protected
FlatViews hold a reference to the device via memory_region_ref).  This is
when instance_finalize is called.

Freeing data belongs in an instance_finalize callback, because the
dynamically allocated memory can still be used after unrealize by the
pending memory accesses.

This starts the process by creating an instance_finalize callback and
freeing most of the dynamically-allocated data in instance_finalize.
Because instance_finalize is also called on error paths or also when
the device is actually not realized, the common code needs some changes
to be ready for this.  The error path in vfio_initfn can be simplified too.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>


  Commit: ba5e6bfa1aee29a8f72c5538c565dfb9889cf273
      
https://github.com/qemu/qemu/commit/ba5e6bfa1aee29a8f72c5538c565dfb9889cf273
  Author: Paolo Bonzini <address@hidden>
  Date:   2015-02-10 (Tue, 10 Feb 2015)

  Changed paths:
    M hw/vfio/pci.c

  Log Message:
  -----------
  vfio: unmap and free BAR data in instance_finalize

In the case of VFIO, the unrealize callback is too early to munmap the
BARs.  The munmap must be delayed until memory accesses are complete.
To do this, split vfio_unmap_bars in two.  The removal step, now called
vfio_unregister_bars, remains in vfio_exitfn.  The reclamation step
is vfio_unmap_bars and is moved to the instance_finalize callback.

Similarly, quirk MemoryRegions have to be removed during
vfio_unregister_bars, but freeing the data structure must be delayed
to vfio_unmap_bars.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>


  Commit: 2e6e697e166568fdd09ceaa8c7c8c8c53a5e345b
      
https://github.com/qemu/qemu/commit/2e6e697e166568fdd09ceaa8c7c8c8c53a5e345b
  Author: Alex Williamson <address@hidden>
  Date:   2015-02-10 (Tue, 10 Feb 2015)

  Changed paths:
    M hw/vfio/common.c

  Log Message:
  -----------
  vfio: Use vfio type1 v2 IOMMU interface

The difference between v1 and v2 is fairly subtle, simply more
deterministic behavior for unmaps.  The v1 interface allows the user
to attempt to unmap sub-regions of previous mappings, returning
success with zero size if unable to comply.  This was a reflection of
the underlying IOMMU API.  The v2 interface requires that the user
may only unmap fully contained mappings, ie. an unmap cannot intersect
or bisect a previous mapping, but may cover multiple mappings.  QEMU
never made use of the sub-region v1 support anyway, so we can support
either v1 or v2.  We'll favor v2 since it's newer.

Signed-off-by: Alex Williamson <address@hidden>


  Commit: bc5baffa3554e4c0d20c1dbe879aec931866bd69
      
https://github.com/qemu/qemu/commit/bc5baffa3554e4c0d20c1dbe879aec931866bd69
  Author: Alexey Kardashevskiy <address@hidden>
  Date:   2015-02-10 (Tue, 10 Feb 2015)

  Changed paths:
    M hw/vfio/pci.c

  Log Message:
  -----------
  vfio: Fix debug message compile error

This fixes a compiler error which occurs if DEBUG_VFIO is defined.

Signed-off-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>


  Commit: 449008f86418583a1f0fb946cf91ee7b4797317d
      
https://github.com/qemu/qemu/commit/449008f86418583a1f0fb946cf91ee7b4797317d
  Author: Peter Maydell <address@hidden>
  Date:   2015-02-11 (Wed, 11 Feb 2015)

  Changed paths:
    M exec.c
    M hw/vfio/common.c
    M hw/vfio/pci.c
    M include/exec/memory-internal.h
    M include/hw/vfio/vfio-common.h
    M memory.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20150210.0' 
into staging

RCU fixes and cleanup (Paolo Bonzini)
Switch to v2 IOMMU interface (Alex Williamson)
DEBUG build fix (Alexey Kardashevskiy)

# gpg: Signature made Tue 10 Feb 2015 17:37:06 GMT using RSA key ID 3BB08B22
# gpg: Good signature from "Alex Williamson <address@hidden>"
# gpg:                 aka "Alex Williamson <address@hidden>"
# gpg:                 aka "Alex Williamson <address@hidden>"
# gpg:                 aka "Alex Williamson <address@hidden>"

* remotes/awilliam/tags/vfio-update-20150210.0:
  vfio: Fix debug message compile error
  vfio: Use vfio type1 v2 IOMMU interface
  vfio: unmap and free BAR data in instance_finalize
  vfio: free dynamically-allocated data in instance_finalize
  vfio: cleanup vfio_get_device error path, remove vfio_populate_device callback
  memory: unregister AddressSpace MemoryListener within BQL

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/5c697ae74170...449008f86418

reply via email to

[Prev in Thread] Current Thread [Next in Thread]