From: Igor Mammedov <imammedo@redhat.com>
To: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Cc: peter.maydell@linaro.org, xiaoguangrong.eric@gmail.com,
david@redhat.com, shannon.zhaosl@gmail.com, mst@redhat.com,
qemu-devel@nongnu.org, xuwei5@hisilicon.com, linuxarm@huawei.com,
eric.auger@redhat.com, qemu-arm@nongnu.org, lersek@redhat.com
Subject: Re: [PATCH v3 03/10] exec: Fix for qemu_ram_resize() callback
Date: Mon, 23 Mar 2020 14:03:58 +0100 [thread overview]
Message-ID: <20200323140358.76d534f4@redhat.com> (raw)
In-Reply-To: <20200311172014.33052-4-shameerali.kolothum.thodi@huawei.com>
On Wed, 11 Mar 2020 17:20:07 +0000
Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> wrote:
> From: David Hildenbrand <david@redhat.com>
>
> Summarizing the issue:
> 1. Memory regions contain ram blocks with a different size, if the
> size is not properly aligned. While memory regions can have an
> unaligned size, ram blocks can't. This is true when creating
> resizable memory region with an unaligned size.
> 2. When resizing a ram block/memory region, the size of the memory
> region is set to the aligned size. The callback is called with
> the aligned size. The unaligned piece is lost.
>
> Because of the above, if ACPI blob length modifications happens
> after the initial virt_acpi_build() call, and the changed blob
> length is within the PAGE size boundary, then the revised size
> is not seen by the firmware on Guest reboot.
>
> Hence make sure callback is called if memory region size is changed,
> irrespective of aligned or not.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> [Shameer: added commit log]
> Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> ---
> Please find the discussion here,
> https://patchwork.kernel.org/patch/11339591/
> ---
> exec.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index 0cc500d53a..f8974cd303 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2073,11 +2073,21 @@ static int memory_try_enable_merging(void *addr, size_t len)
> */
> int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp)
> {
> + const ram_addr_t unaligned_size = newsize;
> +
> assert(block);
>
> newsize = HOST_PAGE_ALIGN(newsize);
>
> if (block->used_length == newsize) {
> + /*
> + * We don't have to resize the ram block (which only knows aligned
> + * sizes), however, we have to notify if the unaligned size changed.
> + */
> + if (block->resized && unaligned_size != memory_region_size(block->mr)) {
> + block->resized(block->idstr, unaligned_size, block->host);
> + memory_region_set_size(block->mr, unaligned_size);
> + }
> return 0;
> }
>
> @@ -2101,9 +2111,9 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp)
> block->used_length = newsize;
> cpu_physical_memory_set_dirty_range(block->offset, block->used_length,
> DIRTY_CLIENTS_ALL);
> - memory_region_set_size(block->mr, newsize);
> + memory_region_set_size(block->mr, unaligned_size);
> if (block->resized) {
> - block->resized(block->idstr, newsize, block->host);
> + block->resized(block->idstr, unaligned_size, block->host);
> }
> return 0;
> }
next prev parent reply other threads:[~2020-03-23 13:05 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 17:20 [PATCH v3 00/10] ARM virt: Add NVDIMM support Shameer Kolothum
2020-03-11 17:20 ` [PATCH v3 01/10] acpi: Use macro for table-loader file name Shameer Kolothum
2020-03-23 12:23 ` Igor Mammedov
2020-03-11 17:20 ` [PATCH v3 02/10] fw_cfg: Migrate ACPI table mr sizes separately Shameer Kolothum
2020-03-11 17:48 ` David Hildenbrand
2020-03-11 20:43 ` Michael S. Tsirkin
2020-03-11 21:09 ` Michael S. Tsirkin
2020-03-12 9:27 ` Shameerali Kolothum Thodi
2020-03-19 17:51 ` Michael S. Tsirkin
2020-03-20 11:53 ` Shameerali Kolothum Thodi
2020-03-23 12:34 ` Igor Mammedov
2020-03-23 13:59 ` Shameerali Kolothum Thodi
2020-03-11 17:20 ` [PATCH v3 03/10] exec: Fix for qemu_ram_resize() callback Shameer Kolothum
2020-03-11 17:44 ` David Hildenbrand
2020-03-23 13:03 ` Igor Mammedov [this message]
2020-03-11 17:20 ` [PATCH v3 04/10] hw/acpi/nvdimm: Fix for NVDIMM incorrect DSM output buffer length Shameer Kolothum
2020-03-23 14:59 ` Igor Mammedov
2020-03-11 17:20 ` [PATCH v3 05/10] nvdimm: Use configurable ACPI IO base and size Shameer Kolothum
2020-03-23 15:14 ` Igor Mammedov
2020-03-11 17:20 ` [PATCH v3 06/10] hw/arm/virt: Add nvdimm hot-plug infrastructure Shameer Kolothum
2020-03-23 15:22 ` Igor Mammedov
2020-03-11 17:20 ` [PATCH v3 07/10] hw/arm/virt: Add nvdimm hotplug support Shameer Kolothum
2020-03-24 6:16 ` Shannon Zhao
2020-03-11 17:20 ` [PATCH v3 08/10] tests: Update ACPI tables list for upcoming arm/virt test changes Shameer Kolothum
2020-03-11 17:20 ` [PATCH v3 09/10] tests/bios-tables-test: Update arm/virt memhp test Shameer Kolothum
2020-03-23 15:28 ` Igor Mammedov
2020-03-11 17:20 ` [PATCH v3 10/10] tests/acpi: add expected tables for bios-tables-test Shameer Kolothum
2020-03-11 19:30 ` [PATCH v3 00/10] ARM virt: Add NVDIMM support no-reply
2020-03-11 19:32 ` no-reply
2020-03-29 10:45 ` Michael S. Tsirkin
2020-03-30 8:44 ` Shameerali Kolothum Thodi
2020-03-30 8:46 ` David Hildenbrand
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=20200323140358.76d534f4@redhat.com \
--to=imammedo@redhat.com \
--cc=david@redhat.com \
--cc=eric.auger@redhat.com \
--cc=lersek@redhat.com \
--cc=linuxarm@huawei.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shannon.zhaosl@gmail.com \
--cc=xiaoguangrong.eric@gmail.com \
--cc=xuwei5@hisilicon.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).