All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: "KONRAD Frederic" <frederic.konrad@adacore.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH v2 4/4] memory: Add memory_region_set_priority()
Date: Fri, 6 Apr 2018 15:14:03 +1000	[thread overview]
Message-ID: <aca2ee26-8b6d-0385-5a90-1ee753fea16a@ozlabs.ru> (raw)
In-Reply-To: <fc68eee3-cd18-016c-a323-3e62250e4ea8@adacore.com>

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é <f4bug@amsat.org>
>> ---
>> 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	other threads:[~2018-04-06  5:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05  1:22 [Qemu-devel] [RFC PATCH v2 0/4] memory: fix access_with_adjusted_size() and misc Philippe Mathieu-Daudé
2018-04-05  1:22 ` [Qemu-devel] [PATCH v2 1/4] memory: Avoid to create tiny RAM regions, handled as subpages Philippe Mathieu-Daudé
2018-04-05  9:27   ` Peter Maydell
2018-04-05 12:53     ` Philippe Mathieu-Daudé
2018-04-05 13:20       ` Peter Maydell
2018-04-05 13:31         ` Philippe Mathieu-Daudé
2018-04-05 13:34           ` KONRAD Frederic
2018-04-05 13:42             ` Peter Maydell
2018-04-05  1:22 ` [Qemu-devel] [NOTFORMERGE PATCH v2 2/4] memory: Fix access_with_adjusted_size() when size < access_size_min Philippe Mathieu-Daudé
2018-04-08 19:21   ` Philippe Mathieu-Daudé
2018-04-05  1:22 ` [Qemu-devel] [PATCH v2 3/4] memory: Fix memory_region 'priority' property sign Philippe Mathieu-Daudé
2021-03-27 13:57   ` Philippe Mathieu-Daudé
2021-03-27 14:30     ` Philippe Mathieu-Daudé
2018-04-05  1:22 ` [Qemu-devel] [RFC PATCH v2 4/4] memory: Add memory_region_set_priority() Philippe Mathieu-Daudé
2018-04-05  3:25   ` Alexey Kardashevskiy
2018-04-05  8:44   ` KONRAD Frederic
2018-04-06  5:14     ` Alexey Kardashevskiy [this message]
2018-04-05  1:30 ` [Qemu-devel] [RFC PATCH v2 0/4] memory: fix access_with_adjusted_size() and misc no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aca2ee26-8b6d-0385-5a90-1ee753fea16a@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=f4bug@amsat.org \
    --cc=frederic.konrad@adacore.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.