qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
	Wei Yang <richardw.yang@linux.intel.com>,
	Qemu Developers <qemu-devel@nongnu.org>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v1 3/5] memory-device: Support big alignment requirements
Date: Fri, 25 Sep 2020 16:18:48 +0200	[thread overview]
Message-ID: <CAM9Jb+i4PWgp7oK6PEse-ja8a51O9L5G7un-FCJ3SfpgB62H6Q@mail.gmail.com> (raw)
In-Reply-To: <20200923113900.72718-4-david@redhat.com>

> Let's warn instead of bailing out - the worst thing that can happen is
> that we'll fail hot/coldplug later. The user got warned, and this should
> be rare.
>
> This will be necessary for memory devices with rather big (user-defined)
> alignment requirements - say a virtio-mem device with a 2G block size -
> which will become important, for example, when supporting vfio in the
> future.
>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Wei Yang <richardw.yang@linux.intel.com>
> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  hw/mem/memory-device.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c
> index 4bc9cf0917..8a736f1a26 100644
> --- a/hw/mem/memory-device.c
> +++ b/hw/mem/memory-device.c
> @@ -119,9 +119,10 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
>
>      /* start of address space indicates the maximum alignment we expect */
>      if (!QEMU_IS_ALIGNED(range_lob(&as), align)) {
> -        error_setg(errp, "the alignment (0x%" PRIx64 ") is not supported",
> -                   align);
> -        return 0;
> +        warn_report("the alignment (0x%" PRIx64 ") exceeds the expected"
> +                    " maximum alignment, memory will get fragmented and not"
> +                    " all 'maxmem' might be usable for memory devices.",
> +                    align);
>      }
>
>      memory_device_check_addable(ms, size, &err);
> @@ -151,7 +152,7 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
>              return 0;
>          }
>      } else {
> -        if (range_init(&new, range_lob(&as), size)) {
> +        if (range_init(&new, QEMU_ALIGN_UP(range_lob(&as), align), size)) {
>              error_setg(errp, "can't add memory device, device too big");
>              return 0;
>          }

Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>


  reply	other threads:[~2020-09-25 14:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 11:38 [PATCH v1 0/5] virtio-mem: block size and address-assignment optimizations David Hildenbrand
2020-09-23 11:38 ` [PATCH v1 1/5] virtio-mem: Probe THP size to determine default block size David Hildenbrand
2020-09-25 13:46   ` Pankaj Gupta
2020-09-28  8:58     ` David Hildenbrand
2020-09-28  9:31       ` Pankaj Gupta
2020-09-28  9:36         ` David Hildenbrand
2020-09-23 11:38 ` [PATCH v1 2/5] virtio-mem: Check that "memaddr" is multiples of the " David Hildenbrand
2020-09-25 13:57   ` Pankaj Gupta
2020-09-23 11:38 ` [PATCH v1 3/5] memory-device: Support big alignment requirements David Hildenbrand
2020-09-25 14:18   ` Pankaj Gupta [this message]
2020-09-23 11:38 ` [PATCH v1 4/5] memory-device: Add get_min_alignment() callback David Hildenbrand
2020-09-26 21:07   ` Pankaj Gupta
2020-09-23 11:39 ` [PATCH v1 5/5] virito-mem: Implement get_min_alignment() David Hildenbrand
2020-09-26 21:23   ` Pankaj Gupta
2020-09-25 10:16 ` [PATCH v1 0/5] virtio-mem: block size and address-assignment optimizations 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=CAM9Jb+i4PWgp7oK6PEse-ja8a51O9L5G7un-FCJ3SfpgB62H6Q@mail.gmail.com \
    --to=pankaj.gupta.linux@gmail.com \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richardw.yang@linux.intel.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).