qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 30/38] ivshmem: Simplify memory regions for BAR


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 30/38] ivshmem: Simplify memory regions for BAR 2 (shared memory)
Date: Wed, 02 Mar 2016 12:06:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

> On 01/03/2016 15:06, Markus Armbruster wrote:
>> Paolo Bonzini <address@hidden> writes:
>> 
>>> On 29/02/2016 19:40, Markus Armbruster wrote:
>>>> -    memory_region_init_ram_ptr(&s->ivshmem, OBJECT(s),
>>>> +    s->ivshmem_bar2 = g_new(MemoryRegion, 1);
>>>> +    memory_region_init_ram_ptr(s->ivshmem_bar2, OBJECT(s),
>>>>                                 "ivshmem.bar2", s->ivshmem_size, ptr);
>>>> -    qemu_set_ram_fd(s->ivshmem.ram_addr, fd);
>>>> -    vmstate_register_ram(&s->ivshmem, DEVICE(s));
>>>> -    memory_region_add_subregion(&s->bar, 0, &s->ivshmem);
>>>> +    qemu_set_ram_fd(s->ivshmem_bar2->ram_addr, fd);
>>>
>>> This is missing an instance_finalize callback to do
>>>
>>>     if (s->ivshmem_bar2) {
>>>         object_unparent(s->ivshmem_bar2);
>>>         g_free(s->ivshmem_bar2);
>>>     }
>> 
>> Since it's allocated within ivshmem_realize(), I guess I could free it
>> in ivshmem_exit().
>
> Unfortunately you can't, because the guest might be using it at the time
> of hot-unplug (e.g. DMAing from disk to it).  Unrealize is the place
> where you hide stuff, and in this case the PCI core does it for you;
> finalize is the place where you free stuff.
>
> This is mentioned (though not really in these terms) in docs/memory.txt.

You mean I'm supposed to have read and understood that?!?  ;-}
Thanks!

[...]



reply via email to

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