David Hildenbrand <da...@redhat.com> writes:

> On 23.04.21 14:10, Markus Armbruster wrote:
>> David Hildenbrand <da...@redhat.com> writes:
>> 
>>>>> diff --git a/backends/hostmem.c b/backends/hostmem.c
>>>>> index c6c1ff5b99..58fdc1b658 100644
>>>>> --- a/backends/hostmem.c
>>>>> +++ b/backends/hostmem.c
>>>>> @@ -217,6 +217,11 @@ static void host_memory_backend_set_prealloc(Object 
>>>>> *obj, bool value,
>>>>>        Error *local_err = NULL;
>>>>>        HostMemoryBackend *backend = MEMORY_BACKEND(obj);
>>>>>    +    if (!backend->reserve && value) {
>>>>> +        error_setg(errp, "'prealloc=on' and 'reserve=off' are 
>>>>> incompatible");
>>>>> +        return;
>>>>> +    }
>>>>
>>>> Aha.  Shouldn't this be documented in qom.json?
>>>
>>> Whoops, skipped that comment. Can add it if that's the place to
>>> document that.
>> 
>> Yes, please.  .json doc comments is where we document the external
>> interface.
>> 
>
> What about something like this:
>
> diff --git a/qapi/qom.json b/qapi/qom.json
> index e9b86893a5..4fa3137aab 100644
> --- a/qapi/qom.json
> +++ b/qapi/qom.json
> @@ -559,6 +559,12 @@
>   #                                        false generally, but true for 
> machine
>   #                                        types <= 4.0)
>   #
> +# Note: prealloc=true and reserve=false cannot be set at the same time. With
> +#       reserve=true, the behavior depends on the operating system: for 
> example,
> +#       Linux will not reserve swap space for shared file mappings --
> +#       "not applicable". In contrast, reserve=false will bail out if it 
> cannot
> +#       be configured accordingly.
> +#
>   # Since: 2.1
>   ##
>   { 'struct': 'MemoryBackendProperties',

Thanks!

Reviewed-by: Markus Armbruster <arm...@redhat.com>


Reply via email to