qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v2 4/4] memory: Add memory_region_set_priori


From: Alexey Kardashevskiy
Subject: Re: [Qemu-devel] [RFC PATCH v2 4/4] memory: Add memory_region_set_priority()
Date: Fri, 6 Apr 2018 15:14:03 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

On 5/4/18 6:44 pm, KONRAD Frederic wrote:
> 
> 
> On 04/05/2018 03:22 AM, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
>> ---
>> Sadly I'm missing something, this does not work.
> 
> Hmmm is that supposed to work dynamically?
> 
> If so I think you might need to call
> memory_region_update_container_subregions(..) because it will
> actually change the map?
> 
> Take a look at how memory_add_subregion works.


Ah, right, I guess it should be:

memory_region_transaction_begin();
mr->priority = priority;
memory_region_update_pending = true;
memory_region_transaction_commit();


as the priority may change the final layout of flatview.


> 
> Thanks,
> Fred
> 
>>
>>   memory.c | 18 +++++++++++++++++-
>>   1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/memory.c b/memory.c
>> index eaa5fa7f23..ae45ea7779 100644
>> --- a/memory.c
>> +++ b/memory.c
>> @@ -1225,6 +1225,22 @@ static void memory_region_get_priority(Object
>> *obj, Visitor *v,
>>       visit_type_int32(v, name, &value, errp);
>>   }
>>   +static void memory_region_set_priority(Object *obj, Visitor *v,
>> +                                       const char *name, void *opaque,
>> +                                       Error **errp)
>> +{
>> +    MemoryRegion *mr = MEMORY_REGION(obj);
>> +    int32_t priority;
>> +    Error *local_err = NULL;
>> +
>> +    visit_type_int32(v, name, &priority, &local_err);
>> +    if (local_err) {
>> +        error_propagate(errp, local_err);
>> +        return;
>> +    }
>> +    mr->priority = priority;
>> +}
>> +
>>   static void memory_region_get_size(Object *obj, Visitor *v, const char
>> *name,
>>                                      void *opaque, Error **errp)
>>   {
>> @@ -1260,7 +1276,7 @@ static void memory_region_initfn(Object *obj)
>>                           NULL, NULL, &error_abort);
>>       object_property_add(OBJECT(mr), "priority", "int32",
>>                           memory_region_get_priority,
>> -                        NULL, /* memory_region_set_priority */
>> +                        memory_region_set_priority,
>>                           NULL, NULL, &error_abort);
>>       object_property_add(OBJECT(mr), "size", "uint64",
>>                           memory_region_get_size,
>>


-- 
Alexey



reply via email to

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