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

Re: [PATCH for-4.16] x86/passthrough: Fix hvm_gsi_eoi() build with GCC 12


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 4 Nov 2021 10:48:02 +0000
  • 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=jZL74gpMZNhOsIucIIbBcK1/5VYlyzbYulIQ/CkgVEU=; b=fRJb/3K46SrQyNk/treIHWKPRhPjyW8wyVrX1RSPHvRT6Gw2CvfXZVtYf0v0/0AIDt6QytBCdvezyLlp4BzZkrOZlOGfiJvhs+CPph+h2BSk0EwqicwKo0/HpZq213EhB5wWoGwEoEYExLVeSLGUZNzK79mJhkil0eb7gYMcN+MWsYA4OEl3RK1orIbK/es0uHkR4YgEn9JGpMg8iF3K3mRfPtkpvqUHHPPN4MA3cSDAyAzcbenBJeQeaS3PkT4SKwM+/E26INs36O+vJA8cbJ3boMpiWQ8JX0WvC8hqwCXG3205URrK1bi0SI/iIgW/W/lWjESKheyci0kJpKouPw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kt+/kymELTzoe40lXNAn7eQUuZIceVWIzmKtMa95+/+CBfThsRhJS8Te4g5azvaSgk/F09Vgshs9QlvWrXF2wOP08/Bj5gOABcpjxQzVpJcF4gValv87wtg5LJV5xqje3OGrD/2zeAQCKnswSVZkCNm+t3CoJ3oapKnY5oyX+USIxBgu5ImysTwsunjLKj6r4Ql6knUJFPt7U/VRA3TGbUkdFhuZlqUh3f+vNuLEA8amRH3AISNDaaEPkMyKpa2YiyNPvCTxxjWDjU87nYOzDBFidnejjcG81l9yzXQivZKAdahTWS1ZN/SlvX4UWPl7QSkTHwa+kmZBk9+PdNHplw==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 04 Nov 2021 10:48:39 +0000
  • Ironport-data: A9a23:nH4G6quqzGdj1jLBEdvfGVXeF+fnVKdZMUV32f8akzHdYApBsoF/q tZmKWqBbq3YNmPxetggOt+/o0sE65bTyIVqTgM5qCBgRClG+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZQP0VOZigHtIQMsadUsxKbVIiGHhJZS5LwbZj29cx2YThWmthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ Nplmr6XaTkJY/LwtMsTVhtoLA15J4drweqSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 aVGcnZXNEnF3r/ohuLgIgVvrp1LwM3DFYUToHx/ixreCu4rW8vrSKTW/95Imjw3g6iiGN6DN 5tIOGc+NXwsZTVhYgsKU6M6u96tuV/2XzhlqH2St64etj27IAtZj+G2bYu9lsaxbcRKnG6Iq 2Te5WP7DxoGctuFxlKt8Hihm+vOliPTQ58JGfuz8fsCqE2ewCkfBQMbUXO/oOKlkQiuVtRHM UsW9yEy668o+ySDUd3VTxC+5nmesXYht8F4SrNgrlvXk+yNvljfVjNsoiN9hMIOm+0RZQIK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 0QCZSWa+eAfWSS7/yKmTVQeuxIqLLskNHK9JTjJjVWPGVXgslbnnZE422gYytLrWd9dPgE/d anl7F6T23KQwVoUi33PAhJY8Hz4/nw0L72ax8PABAqrCGIkDOT8bb/VzyVxA0XXT9jyaortT GtqX232oyT99WAjjPM3W7a6Jpb3PPn19t4HcSJzuwYMC/lhAqEbJloH5eCoDc2iuey70tCqq iBnz4Qe+BIr1/BdGC8phXgnyHmzTYV8nfnjWSVhHPyyPaJDA4SOo5kv8Z0YxHZ400vsJVXy6 RQxV+UsJJREFfpgDn9z8KgbWArqmOE5V4Z1cIDhX1WVoUTLJVLq5YEwU9TGJAcWArn9YEcFv V0Bs203ocWTbqjVQGagoBT+q3oYpxqdS32BnTq+/blnQS+pUoJjHfxn6ck7zA9HJFUcegM2w 2LCNUvqFh0dL5iUUtKPpZ2fSKGMB2+ffvyChPnHb3GLtBNB5ufke+83F0KjNvaD6DgiqFCwa j8bA==
  • Ironport-sdr: dUCJrT+QWLdxsxTW9yJB5kv6U3Kb8I4TuZq3DzDeu4Vr8bnn5qNAEpIlVetRiK5Lj+wDlKo5i+ WoxOghHb1E3mMtEExA6EsuHiDk8cAYwkJXbJVcqpwHIE3gIEH18jHp00W7OY7DGZmUp4fZ+x2h UHK8OlRyaAsfBoxu2EXYaRa7nr5oXh5ZNwmDceEskouQT9ET+0WMVGwDReA8EAFP21mQqcUc2g pp8LgGFmD1MOxan/rghd7r4K/4iwtHTvtVNFbIi7s5SqClCXuoTH6Iq+OIENYqz2P3u4h5ev2F WToRPJdKSqmP+/NtuR6z+ANq
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04/11/2021 08:07, Jan Beulich wrote:
> On 03.11.2021 17:13, Ian Jackson wrote:
>> Jan Beulich writes ("Re: [PATCH] x86/passthrough: Fix hvm_gsi_eoi() build 
>> with GCC 12"):
>>> On 27.10.2021 22:07, Andrew Cooper wrote:
>>>>   if ( !((pirq) ? &(pirq)->arch.hvm.dpci : NULL) )
>>> I disagree with the compiler's analysis: While &(pirq)->arch.hvm.dpci
>>> indeed can't be NULL, that's not the operand of !. The operand of !
>>> can very well be NULL, when pirq is.
>>>
>>>> which is a hint that the code is should be simplified to just:
>>>>
>>>>   if ( !pirq )
>>>>
>>>> Do so.
>>> And I further agree with Roger's original reply (despite you
>>> apparently having managed to convince him): You shouldn't be open-
>>> coding pirq_dpci(). Your observation that the construct's result
>>> isn't otherwise used in the function is only one half of it. The
>>> other half is that hvm_pirq_eoi() gets called from here, and that
>>> one does require the result to be non-NULL.
>> Can you (collectively) please come to some agreement here ?
>> I think this is mostly a question of taste or style.
> Personally I don't think open-coding of constructs is merely a style /
> taste issue. The supposed construct changing and the open-coded
> instance then being forgotten (likely not even noticed) can lead to
> actual bugs. I guess the issue should at least be raised as one against
> gcc12, such that the compiler folks can provide their view on whether
> the warning is actually appropriate in that case (and if so, what their
> take is on a general approach towards silencing such warnings when
> they're identified as false positives).

This isn't opencoding anything.

The compiler has pointed out that the logic, as currently expressed, is
junk and doesn't do what you think it does.

And based on the, IMO dubious, argument that both you and Roger have
used to try and defend the current code, I agree with the compiler.

pirq_dpci() does not have the property that you seem expect of it, and
its use in this case does not do what the source code comment says
either.  A GSI is mapped when a pirq object exists, not a dpci object.


If your answer is "well actually, we didn't mean to say 'if a GSI is
mapped' in the comment, and here's a different predicate which actually
inspects the state of a dpci object for validity", then fine -  that
will shut the compiler up because you're no longer checking for the
NULLness of a pointer to a sub-object of a non-NULL pointer, but that's
a bugfix which needs backporting several releases too.

The current logic is not correct, and does not become correct by trying
pass blame to the compiler.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102967 is the GCC bug, but
the result of it was them persuading me that the diagnostic was
legitimate, even if currently expressed badly.  They've agreed to fix
how it is expressed, but I doubt you'll persuade them that the trigger
for the diagnostic in the first place was wrong.

~Andrew




 


Rackspace

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