qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: David Hildenbrand <david@redhat.com>, qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Claudio Fontana" <cfontana@suse.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Igor Mammedov" <imammedo@redhat.com>
Subject: Re: [PATCH resend v2 4/5] softmmu/memory_mapping: factor out adding physical memory ranges
Date: Tue, 20 Jul 2021 09:25:22 -0400	[thread overview]
Message-ID: <2262b1ae-2577-37dd-111f-bc32f8567de0@linux.ibm.com> (raw)
In-Reply-To: <20210720130304.26323-5-david@redhat.com>


On 7/20/21 9:03 AM, David Hildenbrand wrote:
> Let's factor out adding a MemoryRegionSection to the list, to be reused in
> RamDiscardManager context next.
>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Claudio Fontana <cfontana@suse.de>
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: "Alex Bennée" <alex.bennee@linaro.org>
> Cc: Peter Xu <peterx@redhat.com>
> Cc: Laurent Vivier <lvivier@redhat.com>
> Cc: Stefan Berger <stefanb@linux.ibm.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>   softmmu/memory_mapping.c | 41 ++++++++++++++++++++--------------------
>   1 file changed, 20 insertions(+), 21 deletions(-)
>
> diff --git a/softmmu/memory_mapping.c b/softmmu/memory_mapping.c
> index c149bad44a..b7e4f3f788 100644
> --- a/softmmu/memory_mapping.c
> +++ b/softmmu/memory_mapping.c
> @@ -193,29 +193,14 @@ typedef struct GuestPhysListener {
>       MemoryListener listener;
>   } GuestPhysListener;
>   
> -static void guest_phys_blocks_region_add(MemoryListener *listener,
> +static void guest_phys_block_add_section(GuestPhysListener *g,
>                                            MemoryRegionSection *section)
>   {
> -    GuestPhysListener *g;
> -    uint64_t section_size;
> -    hwaddr target_start, target_end;
> -    uint8_t *host_addr;
> -    GuestPhysBlock *predecessor;
> -
> -    /* we only care about RAM */
> -    if (!memory_region_is_ram(section->mr) ||
> -        memory_region_is_ram_device(section->mr) ||
> -        memory_region_is_nonvolatile(section->mr)) {
> -        return;
> -    }
> -
> -    g            = container_of(listener, GuestPhysListener, listener);
> -    section_size = int128_get64(section->size);
> -    target_start = section->offset_within_address_space;
> -    target_end   = target_start + section_size;
> -    host_addr    = memory_region_get_ram_ptr(section->mr) +
> -                   section->offset_within_region;
> -    predecessor  = NULL;
> +    const hwaddr target_start = section->offset_within_address_space;
> +    const hwaddr target_end = target_start + int128_get64(section->size);
> +    uint8_t *host_addr = memory_region_get_ram_ptr(section->mr) +
> +                         section->offset_within_region;
> +    GuestPhysBlock *predecessor = NULL;
>   
>       /* find continuity in guest physical address space */
>       if (!QTAILQ_EMPTY(&g->list->head)) {
> @@ -261,6 +246,20 @@ static void guest_phys_blocks_region_add(MemoryListener *listener,
>   #endif
>   }
>   
> +static void guest_phys_blocks_region_add(MemoryListener *listener,
> +                                         MemoryRegionSection *section)
> +{
> +    GuestPhysListener *g = container_of(listener, GuestPhysListener, listener);
> +
> +    /* we only care about RAM */
> +    if (!memory_region_is_ram(section->mr) ||
> +        memory_region_is_ram_device(section->mr) ||
> +        memory_region_is_nonvolatile(section->mr)) {
> +        return;
> +    }
> +    guest_phys_block_add_section(g, section);
> +}
> +
>   void guest_phys_blocks_append(GuestPhysBlockList *list)
>   {
>       GuestPhysListener g = { 0 };


Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>




  reply	other threads:[~2021-07-20 13:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 13:02 [PATCH resend v2 0/5] softmmu/memory_mapping: optimize dump/tpm for virtio-mem David Hildenbrand
2021-07-20 13:03 ` [PATCH resend v2 1/5] tpm: mark correct memory region range dirty when clearing RAM David Hildenbrand
2021-07-23 14:52   ` Peter Xu
2021-07-23 19:15     ` David Hildenbrand
2021-07-23 22:35       ` Peter Xu
2021-07-26  8:08         ` David Hildenbrand
2021-07-26 14:21           ` Peter Xu
2021-07-20 13:03 ` [PATCH resend v2 2/5] softmmu/memory_mapping: reuse qemu_get_guest_simple_memory_mapping() David Hildenbrand
2021-07-20 13:37   ` Stefan Berger
2021-07-20 13:45     ` David Hildenbrand
2021-07-20 13:03 ` [PATCH resend v2 3/5] softmmu/memory_mapping: never merge ranges accross memory regions David Hildenbrand
2021-07-20 13:26   ` Stefan Berger
2021-07-23 15:09   ` Peter Xu
2021-07-20 13:03 ` [PATCH resend v2 4/5] softmmu/memory_mapping: factor out adding physical memory ranges David Hildenbrand
2021-07-20 13:25   ` Stefan Berger [this message]
2021-07-23 15:09   ` Peter Xu
2021-07-20 13:03 ` [PATCH resend v2 5/5] softmmu/memory_mapping: optimize for RamDiscardManager sections David Hildenbrand
2021-07-23 15:28   ` Peter Xu
2021-07-23 18:56     ` David Hildenbrand
2021-07-23 22:33       ` Peter Xu
2021-07-26  7:51         ` David Hildenbrand
2021-07-26 15:24   ` Peter Xu

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=2262b1ae-2577-37dd-111f-bc32f8567de0@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=alex.bennee@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=cfontana@suse.de \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).