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

Re: [PATCH 1/3] x86/boot: Explain how moving mod[0] works


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 29 Apr 2024 14:49:37 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=citrix.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=n2Ie8bgsodaj1YRMsYjLwls9ChRMocqeI/d5B+nJdm4=; b=f1lZG7GZAdeg6VaCEu2Pi3g5hZ59rIpzwe2PDvlmQKaaC51dQD5SF8u6u0fSwSBbWpQ7Pewqk57JfqpTYUT2f8DtKPjhqssuUf/i1U/731XADkPHO+34W1h0/ZfXosA3rnODylNbrl3GUOximwvTb0G+4h2lt4tgv0JRH5SXXkMAZWIYlNqGLMZFsdj2niTCCRDxhkaK3HaKvjgjnipsCfb9/et7x5IEC2W6WP5u8MX/Py1bTFjseepZYj8Wj4EZhM1q2yDve0PCKEs7DDNQoKBve7DRwza9Bzc0ynpaaiSy2lJOQrHtXlEkXaJySlVOGZLdX4GnP35Zbq4GtqO5tw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XYrmeaJi/twdKfJSGarc8k9r5mmuN4YRrYuBoQoLalxBt2nAthjEKhTIsR4YbbTIPmgBE+wZ8XqPwXLtg3GDS1GvfPOMh6OQS5/D8wymXCzwxFr6vzLrnFNB4MO8lKzfHQqrsJevIjuBktXlNPP9deOYUmzFu9j2wb2CKE55uQGPFIO1Kv5weN1hHR2tFuMCt3sXLVN3/MeTdHdMWRTazoRim96hc1Ngy2U7I+96VnDNEvrtmR0vZgev5TmGl3o5BaeHf0GqyM8x9acF4ISfKyQgcTyBICoiCaGEPxFvAw1Fm+BQGgqwHmMlKYmczM2/y4ZaxeLbEznAdwRXc0LDVQ==
  • Cc: Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Daniel Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Christopher Clark <christopher.w.clark@xxxxxxxxx>
  • Delivery-date: Mon, 29 Apr 2024 18:49:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-04-26 10:01, Andrew Cooper wrote:
modules_headroom is a misleading name as it applies strictly to mod[0] only,
and the movement loop is deeply unintuitive and completely undocumented.

Provide help to whomever needs to look at this code next.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Daniel Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
CC: Christopher Clark <christopher.w.clark@xxxxxxxxx>
---
  xen/arch/x86/setup.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index caf235c6286d..59907fae095f 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1432,6 +1432,11 @@ void asmlinkage __init noreturn __start_xen(unsigned 
long mbi_p)
          /* Is the region suitable for relocating the multiboot modules? */
          for ( j = mbi->mods_count - 1; j >= 0; j-- )
          {
+            /*
+             * 'headroom' is a guess for the decompressed size and
+             * decompressor overheads of mod[0] (the dom0 kernel).  When we
+             * move mod[0], we incorperate this as extra space at the start.

                                  incorporate

With that:
Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxxxx>

Thanks,
Jason

+             */
              unsigned long headroom = j ? 0 : modules_headroom;
              unsigned long size = PAGE_ALIGN(headroom + mod[j].mod_end);



 


Rackspace

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