[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 5/5] x86/PVH: Support relocatable dom0 kernels


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 26 Mar 2024 11:41:12 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kqz6WtpC2WFvumPUlI5Rith8nY3wEMhcg4UYq9Kao2I=; b=dY/d/IlgeucSsiowhn77f2IWaM7P3eG3DeXXED68U6cWz6P+c+Sm2QZHAI2bHbKSC4OsuAAa3wVpwdpY/SiAw82S/4A9W6KTXBJQt2O0P7eu8IIqsrRPePyWe9IVN66XDZadvPCYZhty3PoKcKEIBJ0zzpdxiWd6XVz8Me1TZTBoSV4mSbev+nljqf+98grlfbNsJnvkDergWZWIdzpHF6r+3FClu+g+9GvFbMwws10ER0U4bmlnV+zeJkDpRMpy7VzzZFb8X7BBWdIyZAEiZaAItDFfTk8efU77QFnZ5XC3SMoZeRtjo7ELL6bNZnOAumL45k3OHEtis+bDLxGGng==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=moWLFd+BjmNxHTYpMw0pY/TjDxQ/H4V//nzShskvaD3In9qiFhkkEStq4BvtvMPMhLBxSszo1bPjRl4GSX9xCKpPCqutQPwi4A7DYoY0tp2LgtCsEv6VGRmFXga4x7wpuQdtNjP5/WBBF3UYM/hsagSKG6cpY3DESy0cUHnmQ1xo4pQXJMm1K5Eqp973dva/bCHwf9lP7T2CRIjdpqPv6KfOwnfLoFFPzirt+Y3hoj8t+lLmMqEziQ2DR8uLlBlklPtwTA1nSSVs0f6Fu5eU8/2Mmyf4sYHCWpufG4SoT1yp7k8+EekXW6OTWGDpbGbJ4vVYnK9fj2YSma9cATOH0g==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 26 Mar 2024 15:41:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-03-26 09:40, Jan Beulich wrote:
On 26.03.2024 14:24, Jason Andryuk wrote:
On 2024-03-26 03:50, Jan Beulich wrote:
On 25.03.2024 21:45, Jason Andryuk wrote:
@@ -227,6 +239,27 @@ elf_errorstatus elf_xen_parse_note(struct elf_binary *elf,

+        }
+        if ( descsz >= 8 )
+        {
+            parms->phys_min = elf_note_numeric_array(elf, note, 4, 1);
+            elf_msg(elf, " min: %#"PRIx32, parms->phys_min);
+        }
+        if ( descsz >= 12 )
+        {
+            parms->phys_align = elf_note_numeric_array(elf, note, 4, 2);
+            elf_msg(elf, " align: %#"PRIx32, parms->phys_align);
+        }

I'd like us to reconsider this ordering: I'm inclined to say that MAX isn't
the most likely one a guest may find a need to use. Instead I'd expect both
MIN and ALIGN wanting to be given higher priority; what I'm less certain
about is the ordering between the two. To keep MIN and MAX adjacent, how
about ALIGN, MIN, MAX?

ALIGN, MIN, MAX works for me.

On the Linux side, I'm expecting them all to be set:
ALIGN = CONFIG_PHYSICAL_ALIGN
MIN = LOAD_PHYSICAL_ADDR
MAX = KERNEL_IMAGE_SIZE

You need enough identity page tables to cover up to MAX.
LOAD_PHYSICAL_ADDR is used as a minimum, so requesting placement above
MIN makes sense to me.

Hmm, setting MIN like this means moving down is precluded. Why would it
not be possible to move a kernel to lower than the default of 16M, when
CONFIG_PHYSICAL_START can be as low as 0? (In fact, I doubt 0 would work
if chosen, but 2M surely does work, as I build some of my Dom0 kernels
that way.)

I successfully booted at a lower address when testing, so it's possible. The bzImage early boot code uses LOAD_PHYSICAL_ADDR as a minimum for extracting vmlinux, so I matched that. It's not clear to me exactly why that is used, though it avoids using the 16MB ISA DMA region.

Kconfig RELOCATABLE has this:
Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
it has been loaded at and the compile time physical address
(CONFIG_PHYSICAL_START) is used as the minimum location.

Which is again why I thought to use it as MIN.

MAX, otoh, I guess really wants setting as you say, for KERNEL_IMAGE_SIZE
actually being commented upon as mis-named. Just that it now really wants
to be KERNEL_IMAGE_SIZE-1.

Yes.

If placement changes to favor higher addresses, then ALIGN, MAX, MIN becomes a little more important since that should be consulted first.

Thanks,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.