From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "aik@ozlabs.ru" <aik@ozlabs.ru>,
"qemulist@gmail.com" <qemulist@gmail.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"stefanha@redhat.com" <stefanha@redhat.com>,
"david@gibson.dropbear.id.au" <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH 40/40] memory: add reference counting to FlatView
Date: Tue, 07 May 2013 21:44:21 +0200 [thread overview]
Message-ID: <51895995.20905@redhat.com> (raw)
In-Reply-To: <5189415B.5070108@siemens.com>
Il 07/05/2013 20:00, Jan Kiszka ha scritto:
> On 2013-05-07 16:17, Paolo Bonzini wrote:
>> With this change, a FlatView can be used even after a concurrent
>> update has replaced it. Because we do not have RCU, we use a
>> mutex to protect the small critical sections that read/write the
>> as->current_map pointer. Accesses to the FlatView can be done
>> outside the mutex.
>>
>> If a MemoryRegion will be used after the FlatView is unref-ed (or after
>> a MemoryListener callback is returned), a reference has to be added to
>> that MemoryRegion. For example, memory_region_find adds a reference to
>> the MemoryRegion that it returns.
>
> For my understanding: Every lookup, e.g. triggered by address_space_rw,
> will briefly reference the FlatView of that address space and drop that
> reference again after referencing the target memory region.
>
> Provided that is true: If we run that lookup on an address space that
> happens to be modified in parallel, the lookup may actually cause the
> final deref and, thus, release of the FlatView - even if the target
> memory region was totally unrelated to the ongoing change. That could
> make a hot-path pay the price of an action a slow path caused. Not
> really a beautiful concept. Even if the FlatView finalization is a
> simple free() (that is the minimum), we would pull the memory allocator
> into code paths that might try hard to keep a safe distance for the sake
> of predictability.
All this is correct. But I hope to get RCU in 1.6, otherwise we can use
a bottom half. In any case, this is obviously no worse than current
code that requires the BQL (hence the lookup would serialize against the
free).
Paolo
next prev parent reply other threads:[~2013-05-07 19:44 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-07 14:16 [Qemu-devel] [PATCH 00/40] Memory-related changes sneak peek for 1.6 Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 01/40] memory: assert that PhysPageEntry's ptr does not overflow Paolo Bonzini
2013-05-07 15:44 ` Peter Maydell
2013-05-07 16:08 ` Paolo Bonzini
2013-05-07 16:17 ` Peter Maydell
2013-05-09 3:41 ` liu ping fan
2013-05-09 16:46 ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 02/40] memory: allow memory_region_find() to run on non-root memory regions Paolo Bonzini
2013-05-07 15:35 ` Peter Maydell
2013-05-09 0:46 ` liu ping fan
2013-05-07 14:16 ` [Qemu-devel] [PATCH 03/40] memory: Replace open-coded memory_region_is_romd Paolo Bonzini
2013-05-07 15:59 ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 04/40] memory: Rename readable flag to romd_mode Paolo Bonzini
2013-05-07 16:10 ` Peter Maydell
2013-05-07 17:04 ` [Qemu-devel] [PATCH v2] " Jan Kiszka
2013-05-07 17:07 ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 05/40] memory: do not duplicate memory_region_destructor_none Paolo Bonzini
2013-05-07 14:36 ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 06/40] memory: make memory_global_sync_dirty_bitmap take an AddressSpace Paolo Bonzini
2013-05-07 14:59 ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 07/40] memory: fix address space initialization/destruction Paolo Bonzini
2013-05-07 15:46 ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 08/40] memory: limit sections in the radix tree to the actual address space size Paolo Bonzini
2013-05-07 17:13 ` Peter Maydell
2013-05-07 17:24 ` Paolo Bonzini
2013-05-07 17:37 ` Alexander Graf
2013-05-07 14:16 ` [Qemu-devel] [PATCH 09/40] memory: create FlatView for new address spaces Paolo Bonzini
2013-05-07 17:25 ` Peter Maydell
2013-05-08 8:41 ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 10/40] exec: remove obsolete comment Paolo Bonzini
2013-05-07 14:25 ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 11/40] memory: add address_space_valid Paolo Bonzini
2013-05-07 17:40 ` Peter Maydell
2013-05-13 14:03 ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 12/40] memory: add address_space_translate Paolo Bonzini
2013-05-07 18:08 ` Peter Maydell
2013-05-20 10:41 ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 13/40] memory: Introduce address_space_lookup_region Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 14/40] memory: iommu support Paolo Bonzini
2013-05-07 18:15 ` Peter Maydell
2013-05-07 14:16 ` [Qemu-devel] [PATCH 15/40] vfio: abort if an emulated iommu is used Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 16/40] spapr: convert TCE API to use an opaque type Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 17/40] spapr: make IOMMU translation go through IOMMUTLBEntry Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 18/40] spapr: use memory core for iommu support Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 19/40] dma: eliminate old-style IOMMU support Paolo Bonzini
2013-05-07 18:20 ` Peter Maydell
2013-05-13 14:04 ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 20/40] pci: use memory core for iommu support Paolo Bonzini
2013-05-07 18:30 ` Peter Maydell
2013-05-11 5:09 ` liu ping fan
2013-05-11 8:07 ` Peter Maydell
2013-05-10 13:07 ` Alexey Kardashevskiy
2013-05-10 13:55 ` Paolo Bonzini
2013-05-07 14:16 ` [Qemu-devel] [PATCH 21/40] spapr_vio: take care of creating our own AddressSpace/DMAContext Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 22/40] dma: eliminate DMAContext Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 23/40] memory: give name to every AddressSpace Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 24/40] memory: add getter/setter for owner Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 25/40] memory: add ref/unref Paolo Bonzini
2013-05-08 9:05 ` Stefan Hajnoczi
2013-05-07 14:17 ` [Qemu-devel] [PATCH 26/40] memory: add ref/unref calls Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 27/40] pci: set owner for BARs Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 28/40] sysbus: set owner for MMIO regions Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 29/40] acpi: add memory_region_set_owner calls Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 30/40] misc: " Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 31/40] isa/portio: allow setting an owner Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 32/40] vga: add memory_region_set_owner calls Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 33/40] pci-assign: " Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 34/40] vfio: " Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 35/40] exec: check MRU in qemu_ram_addr_from_host Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 36/40] memory: return MemoryRegion from qemu_ram_addr_from_host Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 37/40] memory: ref/unref memory across address_space_map/unmap Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 38/40] memory: access FlatView from a local variable Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 39/40] memory: use a new FlatView pointer on every topology update Paolo Bonzini
2013-05-07 14:17 ` [Qemu-devel] [PATCH 40/40] memory: add reference counting to FlatView Paolo Bonzini
2013-05-07 18:00 ` Jan Kiszka
2013-05-07 18:10 ` Jan Kiszka
2013-05-07 19:44 ` Paolo Bonzini [this message]
2013-05-08 7:57 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51895995.20905@redhat.com \
--to=pbonzini@redhat.com \
--cc=aik@ozlabs.ru \
--cc=david@gibson.dropbear.id.au \
--cc=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
--cc=qemulist@gmail.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).