xen: do not use __-named variables in mapcache

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
xen: add a lock for the mapcache

Extend the existing dummy mapcache_lock/unlock macros to cover all of
xen-mapcache.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rcu: introduce RCU-enabled QLIST

Add RCU-enabled variants on the existing bsd DQ facility. Each
operation has the same interface as the existing (non-RCU)
version. Also, each operation is implemented as macro.

Using the RCU-enabled QLIST, existing QLIST users will be able to
convert to RCU without using a different list interface.

Signed-off-by: Mike Day <ncmike@ncultra.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec: remove qemu_safe_ram_ptr

This is not needed since the RAM list is not modified anymore by
qemu_get_ram_ptr.  Replace it with qemu_get_ram_block.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec: protect mru_block with RCU

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Convert ram_list to RCU

Allow "unlocked" reads of the ram_list by using an RCU-enabled
DQ. Most readers of the list no longer require holding the list mutex.

The ram_list now uses a QLIST instead of a QTAILQ. The difference is
minimal.

Signed-off-by: Mike Day <ncmike@ncultra.org>
[More cleanup of comments on which functions need "extra" protection
 in the caller.  These are:

   qemu_get_ram_block
   qemu_get_ram_ptr
   qemu_ram_ptr_length
   qemu_ram_addr_from_host
   memory_region_get_ram_ptr - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>