[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/5] exec.c: use refcnt to protect device during
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] exec.c: use refcnt to protect device during dispatching |
Date: |
Wed, 25 Jul 2012 08:43:08 +0100 |
On Wed, Jul 25, 2012 at 4:31 AM, Liu Ping Fan <address@hidden> wrote:
> @@ -3396,13 +3420,25 @@ void cpu_physical_memory_rw(target_phys_addr_t addr,
> uint8_t *buf,
> uint32_t val;
> target_phys_addr_t page;
> MemoryRegionSection *section;
> + Object *bk;
>
> while (len > 0) {
> page = addr & TARGET_PAGE_MASK;
> l = (page + TARGET_PAGE_SIZE) - addr;
> if (l > len)
> l = len;
> +
> + qemu_rwlock_rdlock_devtree();
> section = phys_page_find(page >> TARGET_PAGE_BITS);
> + if (!(memory_region_is_ram(section->mr) ||
> + memory_region_is_romd(section->mr)) && !is_write) {
> + bk = get_backend(section->mr, addr);
> + object_ref(bk);
> + } else if (!memory_region_is_ram(section->mr) && is_write) {
> + bk = get_backend(section->mr, addr);
> + object_ref(bk);
> + }
> + qemu_rwlock_unlock_devtree();
>
> if (is_write) {
> if (!memory_region_is_ram(section->mr)) {
> @@ -3426,6 +3462,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr,
> uint8_t *buf,
> io_mem_write(section->mr, addr1, val, 1);
> l = 1;
> }
> + object_unref(bk);
Currently object_ref()/object_unref() are not atomic. Will you send
another patch to perform atomic increment/decrement or how will
per-device synchronization work?
Stefan
- [Qemu-devel] [PATCH 0/5] prepare unplug out of protection of global lock, Liu Ping Fan, 2012/07/24
- [Qemu-devel] [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it, Liu Ping Fan, 2012/07/24
- Re: [Qemu-devel] [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it, Paolo Bonzini, 2012/07/25
- Re: [Qemu-devel] [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it, liu ping fan, 2012/07/26
- Re: [Qemu-devel] [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it, Avi Kivity, 2012/07/26
- Re: [Qemu-devel] [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it, liu ping fan, 2012/07/26
- Re: [Qemu-devel] [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it, Avi Kivity, 2012/07/26
- Re: [Qemu-devel] [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it, liu ping fan, 2012/07/26
[Qemu-devel] [PATCH 2/5] exec.c: use refcnt to protect device during dispatching, Liu Ping Fan, 2012/07/24
- Re: [Qemu-devel] [PATCH 2/5] exec.c: use refcnt to protect device during dispatching,
Stefan Hajnoczi <=
Re: [Qemu-devel] [PATCH 2/5] exec.c: use refcnt to protect device during dispatching, Avi Kivity, 2012/07/25
[Qemu-devel] [PATCH 3/5] hotplug: introduce qdev_unplug_ack() to remove device from views, Liu Ping Fan, 2012/07/24
[Qemu-devel] [PATCH 4/5] qom: delay DeviceState's reclaim to main-loop, Liu Ping Fan, 2012/07/24