All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] memory: memory_region_is_mapped() cleanups
@ 2021-10-26 16:06 David Hildenbrand
  2021-10-26 16:06 ` [PATCH v2 1/3] machine: Use host_memory_backend_is_mapped() in machine_consume_memdev() David Hildenbrand
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: David Hildenbrand @ 2021-10-26 16:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, David Hildenbrand, Richard Henderson, Peter Xu,
	Igor Mammedov, Paolo Bonzini, Philippe Mathieu-Daudé

This is the follow-up of [1].

Playing with memory_region_is_mapped(), I realized that memory regions
mapped via an alias behave a little bit "differently", as they don't have
their ->container set.
* memory_region_is_mapped() will never succeed for memory regions mapped
  via an alias
* memory_region_to_address_space(), memory_region_find(),
  memory_region_find_rcu(), memory_region_present() won't work, which seems
  okay, because we don't expect such memory regions getting passed to these
  functions.
* memory_region_to_absolute_addr() will result in a wrong address. As
  the result is only used for tracing, that is tolerable.

Let's cleanup/fix the code and documentation of memory_region_is_mapped()
and change one user that really should be checking something else.

[1] https://lkml.kernel.org/r/20211011174522.14351-1-david@redhat.com

Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>

David Hildenbrand (3):
  machine: Use host_memory_backend_is_mapped() in
    machine_consume_memdev()
  memory: Make memory_region_is_mapped() succeed when mapped via an
    alias
  memory: Update description of memory_region_is_mapped()

 hw/core/machine.c     |  2 +-
 include/exec/memory.h |  4 +++-
 softmmu/memory.c      | 12 +++++++++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

-- 
2.31.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-10-27 12:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 16:06 [PATCH v2 0/3] memory: memory_region_is_mapped() cleanups David Hildenbrand
2021-10-26 16:06 ` [PATCH v2 1/3] machine: Use host_memory_backend_is_mapped() in machine_consume_memdev() David Hildenbrand
2021-10-26 16:56   ` Philippe Mathieu-Daudé
2021-10-26 16:06 ` [PATCH v2 2/3] memory: Make memory_region_is_mapped() succeed when mapped via an alias David Hildenbrand
2021-10-26 17:00   ` Philippe Mathieu-Daudé
2021-10-27 12:12     ` David Hildenbrand
2021-10-26 16:06 ` [PATCH v2 3/3] memory: Update description of memory_region_is_mapped() David Hildenbrand
2021-10-26 17:01   ` Philippe Mathieu-Daudé
2021-10-27  3:53 ` [PATCH v2 0/3] memory: memory_region_is_mapped() cleanups Peter Xu
2021-10-27  7:12   ` David Hildenbrand
2021-10-27  8:09     ` Peter Xu

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.