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

[PATCH] x86: deal with gcc12 release build issues


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 14 Jul 2022 09:53:17 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • 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=Vg2++ohbROKGuBuD1u7yvOVgR0jicqwjmakPmvGc0Gg=; b=N/pm0rk5/4wNn+fdlvWDGPI+yeCmmU0LnLaUauIrg+e8wTIOQLpCYoVvEk3M8b/ZTgApoDv4GZZ4YPLH8sdHwQVkMN06AgHQ7EAQzFjTKc1AbySNay6bwIgMotsFaCoQ/Kzl33jvuKsLbspmrVOus6Gcde0CHufvWJpbyHGd9e29FhnfzuKUJE63ebsvG2xcBIR/QhtmBQbsJKxZnoajJflVAus6CSEo2zJJukx5YZF6tOeAFq+ckWBAGFGoGJv/4oWJuzpCYwK4GyYg9KcP0LA8Z1hjAjKWyYXMTBaXlyEG4qZthT5mnZ+HM8pK0SGSwMgmgr9ugYxz1nMIpo9tvQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D1NDioNQRY5uMEDQRD3MH64PseamVUiwIYajTbSBfJOD75UsfWb6wpjU64c99rhKuWVWh23UEdtgzb4bhHzF1vhGcntTBPHxTLqdjP97CF3DeV1KORbqnHqEBU3XkYTZs8sWuVIz79Vm9urZ3VwHgxVvyhpcbzRQOTMN85VRZXkHsE06IvBhRhnnwVQ7N7dUxTp1klWoHJ5DehSFMMvJLdTbWEkQR1lDaGjUxFT3P4Obv5js7flBCE4UqnaC9U9V2G8BaRUh2nWRYqc8TBSqfMNQbYgJIae+31E9xL+895TFncRzypg5c/yGsvkgZzEOj0mdyGay/v5shNgs9J62oA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Charles Arnold <CARNOLD@xxxxxxxx>
  • Delivery-date: Thu, 14 Jul 2022 07:53:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

While a number of issues we previously had with pre-release gcc12 were
fixed in the final release, we continue to have one issue (with multiple
instances) when doing release builds (i.e. at higher optimization
levels): The compiler takes issue with subtracting (always 1 in our
case) from artifical labels (expressed as array) marking the end of
certain regions. This isn't an unreasonable position to take. Simply
hide the "array-ness" by casting to an integer type. To keep things
looking consistently, apply the same cast also on the respective
expressions dealing with the starting addresses. (Note how
efi_arch_memory_setup()'s l2_table_offset() invocations avoid a similar
issue by already having the necessary casts.) In is_xen_fixed_mfn()
further switch from __pa() to virt_to_maddr() to better match the left
sides of the <= operators.

Reported-by: Charles Arnold <carnold@xxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Initially I had considered introducing something like END_MINUS_1(), but
in the end I did consider this uglier than explicitly dealing with the
two instances we have.

--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -677,10 +677,10 @@ static void __init efi_arch_memory_setup
      * appropriate l2 slots to map.
      */
 #define l2_4G_offset(a)                                                 \
-    (((UINTN)(a) >> L2_PAGETABLE_SHIFT) & (4 * L2_PAGETABLE_ENTRIES - 1))
+    (((a) >> L2_PAGETABLE_SHIFT) & (4 * L2_PAGETABLE_ENTRIES - 1))
 
-    for ( i  = l2_4G_offset(_start);
-          i <= l2_4G_offset(_end - 1); ++i )
+    for ( i  = l2_4G_offset((UINTN)_start);
+          i <= l2_4G_offset((UINTN)_end - 1); ++i )
     {
         l2_pgentry_t pte = l2e_from_paddr(i << L2_PAGETABLE_SHIFT,
                                           __PAGE_HYPERVISOR | _PAGE_PSE);
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -309,8 +309,8 @@ struct page_info
 #define is_xen_heap_mfn(mfn) \
     (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))
 #define is_xen_fixed_mfn(mfn)                     \
-    (((mfn_to_maddr(mfn)) >= __pa(_stext)) &&     \
-     ((mfn_to_maddr(mfn)) <= __pa(__2M_rwdata_end - 1)))
+    (((mfn_to_maddr(mfn)) >= virt_to_maddr((unsigned long)_stext)) && \
+     ((mfn_to_maddr(mfn)) <= virt_to_maddr((unsigned long)__2M_rwdata_end - 
1)))
 
 #define PRtype_info "016lx"/* should only be used for printk's */
 



 


Rackspace

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