qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Joao Martins <joao.m.martins@oracle.com>
To: "Nikunj A. Dadhania" <nikunj@amd.com>,
	Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	f4bug@amsat.org, Abraham.Shaju@amd.com, bharata@amd.com,
	Sean Christopherson <seanjc@google.com>
Subject: Re: [PATCH] x86: cpu: Error out if memory exceeds addressable range
Date: Mon, 18 Jul 2022 14:45:48 +0100	[thread overview]
Message-ID: <91b2ec7d-c159-85ed-dad8-37aac6c505d3@oracle.com> (raw)
In-Reply-To: <e4cd8e81-a8a0-a898-e61b-3e0250dc4995@amd.com>

On 7/18/22 14:10, Nikunj A. Dadhania wrote:
> On 7/18/2022 6:12 PM, Igor Mammedov wrote:
>> On Mon, 18 Jul 2022 13:47:34 +0530
>> Nikunj A Dadhania <nikunj@amd.com> wrote:
>>
>>> Currently it is possible to start a guest with memory that is beyond
>>> the addressable range of CPU and QEMU does not even warn about it.
>>> The default phys_bits is 40 and can address 1TB. However it allows to
>>> start a guest with greater than 1TB memory.
>>>
>>> Prevent this by erroring out in such a scenario.
>>>
>>> Reported-by: Shaju Abraham <Abraham.Shaju@amd.com>
>>> Signed-off-by: Nikunj A Dadhania <nikunj@amd.com>
>>
>>
>> Following shall care of your issue:
>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg900136.html
> 
> Thanks, I tried out the patch series, I could start guest till 978G (not sure 
> why this magic number yet) and after that I start getting errors:

It's expected. The point of the series is meant to avoid attempting at DMA mapping
over the HyperTransport region. Before it would just fail to either hotplug/boot with VFIO
devices on kernels >= 5.4 (even if older kernels or other configs let you go through you
might still see IOMMU errors at some point). So what we essentially do is to have the
region above 4G to instead start at 1T, thus requiring 1 more phys-bit on cases like this
where the max gpa hits the Hyper Transport reserved region.

The cover-letter and this patch
(https://lore.kernel.org/qemu-devel/20220715171628.21437-11-joao.m.martins@oracle.com/)
should clarify on the logic.

The check you're adding here is essentially patch 9 of the series.

> 
> $ ./build/qemu-system-x86_64 -enable-kvm  -machine q35 -m 979G  -kernel bzImage -initrd initramfs.cpio -vga none -nographic -append "console=ttyS0,115200n8 earlyprintk=serial,ttyS0,115200 debug=1 " -nodefaults -serial stdio
> qemu-system-x86_64: Address space limit 0xffffffffff < 0x1fc3fffffff phys-bits too low (40)
> 
> Regards
> Nikunj


  reply	other threads:[~2022-07-18 13:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18  8:17 [PATCH] x86: cpu: Error out if memory exceeds addressable range Nikunj A Dadhania
2022-07-18 12:42 ` Igor Mammedov
2022-07-18 13:10   ` Nikunj A. Dadhania
2022-07-18 13:45     ` Joao Martins [this message]
2022-07-18 13:54       ` Nikunj A. Dadhania

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=91b2ec7d-c159-85ed-dad8-37aac6c505d3@oracle.com \
    --to=joao.m.martins@oracle.com \
    --cc=Abraham.Shaju@amd.com \
    --cc=bharata@amd.com \
    --cc=f4bug@amsat.org \
    --cc=imammedo@redhat.com \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=seanjc@google.com \
    --cc=vkuznets@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).