[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: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 4 Nov 2021 13:17:53 +0100
  • 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=UXBvy/wr+tafUqj75IgbeseJvLJptr9zNkUk78xP2Ys=; b=enbxtGrYbZjiEaSuhbnETCqMvasQAwHn5yHjdfPnZ9qQl0tpjfMQ9xTnFc8TXPJaSr2MVeWVUQn3ZZRyqqFvSJ2AYxUiTHaNhHamgQ/3el+y4T3/KN2MLj+NG5UCrUQKPDaYUj2SVaG5U2kKqhsYYyzbGpV1DdxARQbHDjJ0Q+Dq1oEXlOE0JTZ4JxQ7Q1113mgfBezSAgQ0nQFeSE5MGoKiOQcCSsIAMfJTIlU0kBX/GOgmpvPQk8484B1+h+uQaMEM7BIt7Yc2pPvLmIQLNEuarvCmBrnLvSsyCE2P0WfhvG40phgkcZvjsOvqdRA0kcRDBxUyrVopW1hPL3X7aw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SQ2lUX8JiXnn8c53mXnY6W9cmoShF2nvmP3QPqRmLXpq+uUsgNvo3MWCLJc2rEz/8zp4z3/lSXT5lDUmehc45BZD+o2jIekZV90JcSz+oi4qWOrp67sbBZyR57DajdLShSfabg3Se6n+1l1IsU0QMpgbjfPpP9vw1ON8qEwEJRCQj/Tc6AqXgiEKtNEEcqSRDLgJDNiVQgwEDWbi46LDkvPF7tgvBoASuhZesE0O8h0VHNRHKyC5l/xszVCEf5vq/lRSAygwlO+DsihYq8hv4TkXn/dr2RsHOIEza0RwYEnZYpEyPEyib5xappEzlp4fXEBPWghL/yW19ZKAZr/x+Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 04 Nov 2021 12:18:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04.11.2021 11:48, Andrew Cooper wrote:
> 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,

Which property is that, exactly?

> 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.

As per my earlier reply on the thread, I view the check as a guard
for the subsequent call to hvm_pirq_eoi(), where _this_ pointer
(and not pirq) is assumed to be non-NULL (while pirq gets explicitly
checked).

> 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.

I have yet to understand in which way you deem the current logic to not
be correct. I'm sorry for being dense.

> 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.

Well, thanks for the pointer in any event. I've commented there as well.

Jan




 


Rackspace

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