[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: |
liu ping fan |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] exec.c: use refcnt to protect device during dispatching |
Date: |
Thu, 26 Jul 2012 21:06:53 +0800 |
On Wed, Jul 25, 2012 at 8:27 PM, Avi Kivity <address@hidden> wrote:
> On 07/25/2012 01:58 PM, Avi Kivity wrote:
>>> 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);
>>
>> Does the devtree lock also protect the data structures accessed by
>> phys_page_find()? Seems wrong.
>
> The right way is to object_ref() in core_region_add() and object_unref()
> in core_region_del(). We're guaranteed that mr->object is alive during
> _add(), and DeviceClass::unmap() ensures that the extra ref doesn't
> block destruction.
>
OK, I see. I will try in this way. But when
memory_region_destroy()->..->core_region_del(), should we reset the
lp.ptr to phys_section_unassigned , otherwise, if using removed
target_phys_addr_t, we will still get the pointer to invalid
MemoryRegion?
Thanx, pingfan
> --
> error compiling committee.c: too many arguments to function
>
>
- Re: [Qemu-devel] [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it, (continued)
[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, 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
Re: [Qemu-devel] [PATCH 4/5] qom: delay DeviceState's reclaim to main-loop, liu ping fan, 2012/07/25
[Qemu-devel] [PATCH 5/5] e1000: using new interface--unmap to unplug, Liu Ping Fan, 2012/07/24