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

Re: [PATCH 09/12] x86/boot: add start and size fields to struct boot_module


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Fri, 8 Nov 2024 15:48:03 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=apertussolutions.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=arcselector10001; 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=hOVogaPg211amCTXnanFw5x+1/S67p/VuCo4B1auadI=; b=pN7ldTgv4M88s14OxJ+xPCECtoa65xa9qDf5JCoPhKdZ1Q+eVPL/NH3FX//+4FV+8ZsAodSIryW3WAYoU/xVZ4zn9tt/U4tdOFnjUjK6wm2t4lzcARA1a8lJ6yhA3PL6zIhRjjbIdz3qhqaZnOgmzem8qnQTX0rAc0BRoUW4fUlqQZa7SSouZwqJN8ouU/hhbiHFbbKA1D09zlWrsM91JHCs3NC1gcn6CCjhtCKSAEOHM6HQk40fXG78SEei7gT+GRnVPdvimN6YcZ0MK022gkQIRN1RyTGrV3EkThlJXrPGkjtWQ2uSMUNTdDsyciABYu6jCm7Mmwem0jdhZOYFmA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hkmNC9tdt7stt2I/izD1rlTV9Rjh/2dVC5ir2Pe8lHnkdXC2qiu9pYa09vHJdU2aQSTXkInHNeSJCFrcNXevJzRnnt4fIQmIukhnahyMMEuiBQV2PuED9QZA005jU5Xb17BccBJA+X+jKFzBE0M3XKCygi4NnD4CRNB0GBzPLvqMgMZcYwkbIE9rHgAMy7KGbp57OgmFpEHa/2yHEbvDVZAMnWnVyPUlF1degqm1ce4ddy16oOecyyDSVXeTgNO2TYsVCArysdiXM/pxdZlOyeVdQLcchy9nkq08lwpg8J2xKsNW/4XAp4jQQxRkKjlgKVd9vGjcEJaJt5Creu2ATw==
  • Cc: <christopher.w.clark@xxxxxxxxx>, <stefano.stabellini@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 08 Nov 2024 20:48:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-11-08 14:17, Daniel P. Smith wrote:
On 11/7/24 15:47, Jason Andryuk wrote:
On 2024-11-02 13:25, Daniel P. Smith wrote:
@@ -1745,13 +1733,11 @@ void asmlinkage __init noreturn __start_xen(void)
      for ( i = 0; i < bi->nr_modules; ++i )
      {
-        const struct boot_module *bm = &bi->mods[i];
+        unsigned long s = bi->mods[i].start, l = bi->mods[i].size;
-        set_pdx_range(bm->mod->mod_start,
-                      bm->mod->mod_start + PFN_UP(bm->mod->mod_end));
-        map_pages_to_xen((unsigned long)mfn_to_virt(bm->mod- >mod_start),
-                         _mfn(bm->mod->mod_start),
-                         PFN_UP(bm->mod->mod_end), PAGE_HYPERVISOR);
+        set_pdx_range(paddr_to_pfn(s), paddr_to_pfn(s) + PFN_UP(l));

This is fine today since s (.start) is checked for page alignment. The other option would be `paddr_to_pfn(s + l) + 1`, but I'm not sure that is an improvement.

Out of curiosity, why are you thinking that module start would never be paged aligned?

I think you have an extra negation - the module start is always page aligned as checked elsewhere.

While reviewing, I was just noting that this code starts rounding addresses when it previously operated on pfns. Non page-aligned s + l could then cross a page boundary.

Regards,
Jason



 


Rackspace

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