[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86/passthrough: Fix hvm_gsi_eoi() build with GCC 12
- To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Thu, 28 Oct 2021 13:15:13 +0100
- 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4v16CIS+WGRPeYy/jCskGG6tDbOi3oFXX1GfOs71dYM=; b=Qk9NWUudZrLL5h7FT9pRvnJEa4AcTImicP+U0i7xDZ8e9M8OoBcoYRfl9gTqhL7LCUsW8GfkpGpl1RwRvhXbXuNB87h+pT6il4u582ZvvTJWuLntezp5wqsEJJtyd7WgBypVyYeCmDnZcAKX4pulw4393JRv5X1UhgFQhqNRK6LKO+hS2GsRe78OiUNnCHX6V1aHEPVphNmeMqNXIdGsWTsr9KtzN+Z013MbnIGiiDsCl68Nv7uDX3AGvhZozAV/nViqzGR93fgXHd8nxczpCQMGfdVHGVWmV1olY3gCmiJHIuZOzYJdbXyfJ1gA74HpcXzkB/F79Fs2awHTDTSUGQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H/fJ45rur22KrHXaUIVbmesWJBOKha/wpD9rkuGVdmKT8JgEnb3OqvdiunZMmD/hUiptd+SKlg8/fb18hGwiudorKj/sNi4r0+ggGIxqoTmVAkzhhyE8ye0/AwBLB0CMvmNaz1SY6BXNQeJJ1yospViicNLeKvBvvDT/pCfvVu8Isw2p4iwDmmwM6iX6Dcq5Sp/5Jzq4QHhNeqsdBcT2QWGZjJ1WXxUkUXKAfoYu97dkYSRFEiQx2TS7yOeCA+ZKbYMLTADcLZxUY3pHk7LefOJR3VAvpjByF7H+xv+SwSivQAPmceKuIRsQPgKP/QxEvQUwvD+nMgW5H8wDIG2vyw==
- Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
- Delivery-date: Thu, 28 Oct 2021 12:15:36 +0000
- Ironport-data: A9a23:LmO7Fa/wcnLLZzK2ix5gDrUDfXmTJUtcMsCJ2f8bNWPcYEJGY0x3n WQdWzqHM6nfajagf49xaNi+/EMBu8KAxtU3SQNppS48E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si9AttENlFEkvU2ybuOU5NXsZ2YhGmeIdA970Ug6wrZj0tYx6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhoy ecUpbicSD0AJ5/ptvYTcyNcDjFXaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguwKKsXxMZxZkXZn1TzDVt4tQIzZQrWM7thdtNs1rp0QQK2EO 5tAAdZpRBqZODFtJWpOMskVhtzvwXPvVgVS9E3A8MLb5ECMlVcsgdABKuH9WPaHWMFUlUawv X/d8iLyBRRyHMySz3+J/2yhgsfLnDjnQ8QCGbug7PlojVaPgGsJB3U+VES5iem0jFakXNBSI FBS/TAhxYAt8GS7Q9+7WAe3yENopTZFBYAWSbdjrljQlOyEuG51G1ToUBZYae5/pOsa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EYSGIK9/oSgzPIY+rIouP3iZxA7N22pxwGLXAIGtJdBkVCe2Km+yVNNXh77PECZf yhD6R81lidkDgsH7+G7i5vZZm8mzSHruOqXTc2QzocrCWehzKh77D3VzCewxclSjtKhZMv63 LMnQDV7riq96jT8G6S60bjq7Bt3PfxwNpKA8KBzuATNzXXkw6tIKBsQaeLsjwZqPymrHwqjN 7PiRE9ONkb0QKcQkiF5T/WnyXw2jcn7HHvjXeenHvYuMT8AAk3DsJQ7LgpOifx2g4FhpVRwa hL12WWu958FhXbhhnw4NDOSlVDile0iWBKq59Ss1VvFa8lLJNBp40W+01YVL0aGjjh1YwhGO 5ySOnB+fdtd0+AZXyxhBgv/DWVZAVwIv66eDlGhiTMuAIm2EyRjnFoivD3p01wt67UEPJ/lq P52qcBrsAGciZZV9M6OA47e7rDNoX6e2O7DIujGyWUKEg5AQO4l3fW2sR/2Aj4Qu1D8HMN8K 6xJ2+w81RCIn7TNQ==
- Ironport-sdr: 4Fuqpa7iZ9W9k1Q1kd/LsSTcO9O22zglR7w0PNQcxbG5VJSCeULjEer2u4HXwEeKmuUwwHuoBs rExq21cQOdI8rc3GU/egxMlgk0/KxVgUZ+4PMIDQ1xj3D+pgCrWdnqILbyz605oR16qHKmaSeu pOONfDPIk6iejv3kM5cLWKse3yWj1dT5jc6pBwCps+s2QTHyv4JKMHMRz1i5CSv32fgTJGEe3h oOqk/fB7ZNeHBits6bicK0FCYCnRM1/WTPbfmQCaIaCCnPRUkSs76N/ZZo+H4tZerbIMTfrhJ/ Of3/0UYmnDAhMRR0wyMmx258
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 28/10/2021 08:31, Roger Pau Monné wrote:
> On Wed, Oct 27, 2021 at 09:07:13PM +0100, Andrew Cooper wrote:
>> 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 )
> I likely need more coffee, but doesn't this exploit how the macro
> (pirq_dpci) is currently coded?
The way pirq_dpci() is currently coded, this is nonsense, which GCC is
now highlighting.
It would be a very different thing if the logic said:
struct pirq *pirq = pirq_info(d, gsi);
struct hvm_pirq_dpci *dpci = pirq_dpci(pirq);
/* Check if GSI is actually mapped. */
if ( !dpci )
return;
but it doesn't. Getting a non-null pirq pointer from pirq_info(d, gsi)
does identify that the GSI is mapped, and the dpci nested structure is
not used in this function. I would expect this property to remain true
even if we alter the data layout.
~Andrew
|