[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v1 08/22] memory: provide defaults for MemoryListe
From: |
Avi Kivity |
Subject: |
Re: [Qemu-devel] [RFC v1 08/22] memory: provide defaults for MemoryListener operations |
Date: |
Tue, 09 Oct 2012 17:28:59 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 |
On 10/09/2012 05:14 PM, Anthony Liguori wrote:
>>>
>>> I think it'd be nicer to check for NULL when invoking the functions in
>>> the memory core.
>>>
>>> Then you avoid the exported stub functions entirely.
>>
>> Yes, that's the common style, but I happen not to like the extra check,
>> both from a performance point of view (doesn't apply here of course) and
>> from a readability point of view.
>
> The trouble with your approach is that it introduced a subtle behavior
> based on ordering. IOW:
>
> MemoryListenerOps foo = {
> MEMORY_LISTENER_DEFAULT_OPS,
> .log_sync = ...,
> };
>
> vs.
>
> MemoryListenerOps foo = {
> .log_sync = ...,
> MEMORY_LISTENER_DEFAULT_OPS,
> };
>
> Both compile fine but have potentially difficult to debug differences.
> Relying on zero-initialization eliminates the possibility of this problem.
>
I don't think this is likely (esp. as the bad behaviour would be the
code not working at all) but i will update this for the next version.
--
error compiling committee.c: too many arguments to function
- [Qemu-devel] [RFC v1 06/22] memory: export AddressSpace, (continued)
[Qemu-devel] [RFC v1 13/22] xen: use new MEMORY_LISTENER_DEFAULT_OPS, Avi Kivity, 2012/10/03
[Qemu-devel] [RFC v1 10/22] vfio: use new MEMORY_LISTENER_DEFAULT_OPS, Avi Kivity, 2012/10/03
[Qemu-devel] [RFC v1 11/22] xen_pt: use new MEMORY_LISTENER_DEFAULT_OPS, Avi Kivity, 2012/10/03
[Qemu-devel] [RFC v1 12/22] kvm: use new MEMORY_LISTENER_DEFAULT_OPS, Avi Kivity, 2012/10/03
[Qemu-devel] [RFC v1 15/22] memory: move address_space_memory and address_space_io out of memory core, Avi Kivity, 2012/10/03
[Qemu-devel] [RFC v1 14/22] memory: manage coalesced mmio via a MemoryListener, Avi Kivity, 2012/10/03