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

[PATCH 2/2] x86/pv: fix clang build without CONFIG_PV32


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Fri, 23 Apr 2021 11:43:43 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-SenderADCheck; bh=lTwYXU5O3V5OqqnU/mlpo7hQAAvN0IpnHHnFd6kULLw=; b=XFsKiOIG+nUq9TSB54nLXvSttZnAyyxdHCauyQo7c6v3ibjsZvIEfuF61eded3tsVwxZDjcr4fxb6sABMwAYvGyrRF6ACbmFlqqmcl9n1Pk9pj4TlNYvxwkl8b86a6qENITauvZkHeYgtSnxrdQNQh8aJ/PGw8zRKI5ufwuzgwDu+bAt8LRGcQFVv/dFr2vF4DbozZZCVLDJHSTY3jaUYpLh2X6/erxnwRW6fTyHirHbyGYNMcIk/zs5FLMjf7Pzox+3CL/9EKcsR6lz8ye3qjsl7VmHNMa5mAaMrY9+8wzqJIHBbBU7dotQK8x9p4CAN+F91fRDCwwbEfBIZOXu/g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SXOCZfLq4krO+JQ8KWdLiyaJB22F4Pn4xLdFw2xXKOmQ14mPe77fM8Nf2MbKu/RH3rP8IlB8HPEYl3IapuifWyD2mLKlTw9MTGmQFk9wzb8/XeoH4wR7xdw5+Rik3WuAffBfxq0AgFr2vfy52t6fyFVrGH1UOumBA0HSyB1RWJ9BsEHDut73+hA4VTJj7Y3KGXi1lcS0Cqm+/TbuwIUkazoVIuOF0O8YcUet7zzQxgcqny90a+9Z1W5gh3AbKdGqz2ORpyTJ/2ILNKbeSSwvM+7vokO6frLXlqqB9XjSXwuRkiM2n3Ba4mIzBYY5ivMY8Yuud85tV2YojjSQmS9F2g==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 23 Apr 2021 09:44:21 +0000
  • Ironport-hdrordr: A9a23:pE5baq5JcXsw4cT+JwPXwU2EI+orLtY04lQ7vn1ZYSd+NuSFis Gjm+ka3xfoiDAXHEotg8yEJbPoexzh3LZPy800Ma25VAfr/FGpIoZr8Jf4z1TbdxHW3tV2kZ 1te60WMrDNJHBnkMf35xS5Gd48wN+BtJuln/va0m0Fd2BXQotLhj0JbjqzOEtwWQVAGN4FD5 Ka/MVKvH6Nfn4QY8S9CBA+LpT+jvfMk4/rZgNDOg4/5GC1/E6VwZPZMzzd5BcRVDtT3awvmF KqryXV7riu2svLrCP0+HTU6/1t6bnc4/tFQPeBk80Ebgjr4zzYH7hJf52nkHQLrPq06FAs+e O80ysIG8ho8XveciWUjHLWqnDd+Q0j4XPj1lOU6EGLyaeSJENYerh8rLlUfRfD500rsMsU6t Mw40uju4dKFhSFpSzh5rHzJmBXv3Cpqnkvm/N7tQ05baIibtZq3Oki1XIQOpIBECXm0ZsgAe ljAerNjcwmD2+yXjT3uHJiz8erWWl2NhCaQlIassjQ6DROmmtlpnFoiPA3rzMlztYQWpNE7+ PLPuBBk6xPdNYfaeZYCP0aScW6J2TRSXv3QS2vCGWiMJtCF2PGqpbx7rlwzvqtYoY0wJw7n4 mEeE9EtEYpEnieSfGm7dluyFTgUW+9VTPixoV1/J5ioIDxQ7LtLGmqVE0uqc29uP8Sa/erGs qbCdZzObvOPGHuEYFG00nVQJ9JM0QTV8UTp5IVQFSL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UJT+LgcghziuLdJXVyNDLwLcI8CGKFefYyqRLyeVER CO/n0xJaaRXDGAv7Zg75+MT7jKiZmRYQq4LvcG6KYrb3Sse2OBrd/I3QZPC7XNKcro0lrEhq7R hTeAeAKEv8aU7CnRhW1166q+Ku0ofCHhgoj+RckGDI95PSv+Lvzur7v6E034fmFr2aWnUWQdg7 pJg=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Clang reports the following build error without CONFIG_PV:

hypercall.c:253:10: error: variable 'op' is used uninitialized whenever 'if' 
condition is false [-Werror,-Wsometimes-uninitialized]
    if ( !is_pv_32bit_vcpu(curr) )
         ^~~~~~~~~~~~~~~~~~~~~~~
hypercall.c:282:21: note: uninitialized use occurs here
    return unlikely(op == __HYPERVISOR_iret)
                    ^~
/root/src/xen/xen/include/xen/compiler.h:21:43: note: expanded from macro 
'unlikely'
#define unlikely(x)   __builtin_expect(!!(x),0)
                                          ^
hypercall.c:253:5: note: remove the 'if' if its condition is always true
    if ( !is_pv_32bit_vcpu(curr) )
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hypercall.c:251:21: note: initialize the variable 'op' to silence this warning
    unsigned long op;
                    ^
                     = 0

Rearrange the code in arch_do_multicall_call so that the if guards the
32bit branch and when CONFIG_PV32 is not set there's no conditional at
all.

Fixes: 527922008bc ('x86: slim down hypercall handling when !PV32')
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Should the is_pv_32bit_vcpu be wrapped in an unlikely hint?
---
 xen/arch/x86/pv/hypercall.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index e30c59b6286..d573f74aa1e 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -250,34 +250,34 @@ enum mc_disposition arch_do_multicall_call(struct 
mc_state *state)
     struct vcpu *curr = current;
     unsigned long op;
 
-    if ( !is_pv_32bit_vcpu(curr) )
+#ifdef CONFIG_PV32
+    if ( is_pv_32bit_vcpu(curr) )
     {
-        struct multicall_entry *call = &state->call;
+        struct compat_multicall_entry *call = &state->compat_call;
 
         op = call->op;
         if ( (op < ARRAY_SIZE(pv_hypercall_table)) &&
-             pv_hypercall_table[op].native )
-            call->result = pv_hypercall_table[op].native(
+             pv_hypercall_table[op].compat )
+            call->result = pv_hypercall_table[op].compat(
                 call->args[0], call->args[1], call->args[2],
                 call->args[3], call->args[4], call->args[5]);
         else
             call->result = -ENOSYS;
     }
-#ifdef CONFIG_PV32
     else
+#endif
     {
-        struct compat_multicall_entry *call = &state->compat_call;
+        struct multicall_entry *call = &state->call;
 
         op = call->op;
         if ( (op < ARRAY_SIZE(pv_hypercall_table)) &&
-             pv_hypercall_table[op].compat )
-            call->result = pv_hypercall_table[op].compat(
+             pv_hypercall_table[op].native )
+            call->result = pv_hypercall_table[op].native(
                 call->args[0], call->args[1], call->args[2],
                 call->args[3], call->args[4], call->args[5]);
         else
             call->result = -ENOSYS;
     }
-#endif
 
     return unlikely(op == __HYPERVISOR_iret)
            ? mc_exit
-- 
2.30.1




 


Rackspace

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