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

[PATCH] x86/passthrough: Fix hvm_gsi_eoi() build with GCC 12


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 27 Oct 2021 21:07:13 +0100
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Wed, 27 Oct 2021 20:08:02 +0000
  • Ironport-data: A9a23:1nTlQ68AZdzE8JI8GSZ+DrUDZHmTJUtcMsCJ2f8bNWPcYEJGY0x3n 2seWTvUOPqJM2Gjet1wOY3go0wGscCDyNdlQAtl+S48E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si9AttENlFEkvU2ybuOU5NXsZ2YhGmeIdA970Ug6wrZj3dYy6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPgp7 dpvs7/gWT1yI7Hnkb8/aUhcMAhhaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguwKKsXxMZxZkXZn1TzDVt4tQIzZQrWM7thdtNs1rp0QTamOP 5BEAdZpRBXqTRRtYkwcMZlgk+H4v3XOXRhRo13A8MLb5ECMlVcsgdABKuH9ZdiiVchT2EGCq Qru/nv7KgEXMsSFzjiI+W7qgfXA9QvrVYRXGLCm+/pChFyI2ndVGBAQTUG8o/Sylgi5Qd03A 24+9zcqrKMy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ggLBR+sOgbcKqweQYhEWndQ86U 4PScZD4aXLfD1Hsfo=
  • Ironport-sdr: BbQZr1aRdwIkuFaquRS7cSViqFtnf+JMrqL/1ynUsz42973fNPxg/r+H4Pwjs8itO3LMt2kCPF /nHD07j70Ue0yXmnvdK6cipIA7y8c2q0dpzCAv1qu+1/l0rMqEdezpT5B4V50oIx7A8G54p6hm TxyCtMUMUMEpLxy3t7fHas7oHFy5lAxylikD1yFDRnUKFw2fl+fAotJfSF1uRBtNCoxvk4Qxcg s5mVzYsXRNHg7xO7yWLBOwalOIVdyh2ZgYEjuyOy65L+h/7csxLbOjRS9aGaSWFxLNYIUIMBqG pKAjOvt7dZ1wtCs+EOShxPko
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

GCC master (nearly version 12) complains:

  hvm.c: In function 'hvm_gsi_eoi':
  hvm.c:905:10: error: the comparison will always evaluate as 'true' for the
  address of 'dpci' will never be NULL [-Werror=address]
    905 |     if ( !pirq_dpci(pirq) )
        |          ^
  In file included from /local/xen.git/xen/include/xen/irq.h:73,
                   from /local/xen.git/xen/include/xen/pci.h:13,
                   from /local/xen.git/xen/include/asm/hvm/io.h:22,
                   from /local/xen.git/xen/include/asm/hvm/domain.h:27,
                   from /local/xen.git/xen/include/asm/domain.h:7,
                   from /local/xen.git/xen/include/xen/domain.h:8,
                   from /local/xen.git/xen/include/xen/sched.h:11,
                   from /local/xen.git/xen/include/xen/event.h:12,
                   from hvm.c:20:
  /local/xen.git/xen/include/asm/irq.h:140:34: note: 'dpci' declared here
    140 |             struct hvm_pirq_dpci dpci;
        |                                  ^~~~

The location marker is unhelpfully positioned and upstream may get around to
fixing it.  The complaint is intended to be:

  if ( !((pirq) ? &(pirq)->arch.hvm.dpci : NULL) )
                  ^~~~~~~~~~~~~~~~~~~~~~

which is a hint that the code is should be simplified to just:

  if ( !pirq )

Do so.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Ian Jackson <iwj@xxxxxxxxxxxxxx>

Request for 4.16, as being very low risk.

This is a build problem with a soon-to-be-released compiler, but the issue it
highlights is real and the fix is a clear improvement in code quality.  There
is no difference in the compiled binary as a result of this change.

  $ diff -u dis-before dis-after
  --- dis-before       2021-10-27 21:00:07.512530321 +0100
  +++ dis-after        2021-10-27 21:00:25.996752544 +0100
  @@ -1,5 +1,5 @@

  -xen-syms-before:     file format elf64-x86-64
  +xen-syms-after:     file format elf64-x86-64

   Disassembly of section .text:

If this does not get taken at this point, it will need backporting after the
release, when GCC 12 is released.
---
 xen/drivers/passthrough/x86/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c 
b/xen/drivers/passthrough/x86/hvm.c
index 351daafdc9bf..22bf84639f22 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -902,7 +902,7 @@ static void hvm_gsi_eoi(struct domain *d, unsigned int gsi)
     struct pirq *pirq = pirq_info(d, gsi);
 
     /* Check if GSI is actually mapped. */
-    if ( !pirq_dpci(pirq) )
+    if ( !pirq )
         return;
 
     hvm_gsi_deassert(d, gsi);
-- 
2.11.0




 


Rackspace

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