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

Re: [PATCH v4 3/5] xen/riscv: introduce an implementation of macros from <asm/bug.h>


  • To: Oleksii <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 1 Mar 2023 13:42:08 +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=CStBhd9bS7lIXJO3ROS0qxmbvDkgJOl69tY2BEYVb5o=; b=KffpaTLBSf8H4UrM0re0GNeSdLh1ZBxROF43JSEC1GJ62J1TD11JIpO+UcPe1g5A2kBFVgMrjvXM2MshWpjTdwAvvveI/boTgA0GUYsL/ceKweZl0L9Am7o7Nysk9OJ3dSYKTTSFBaxJw7vH74tvHs0CWNr8rVWnIwd993t1Mpo1Dctu1Hvn7c0Pvhp1hFR06cz3izlYtpn1FdUUcoOYNXb74h7B64//iDKgt+bW/q5SymcM//N8IOzt2f34VQxXJoHOlqLa4PWqM7Ew/3gVBAej6LwG0V55anxwFvPupBSk0mLtSfGegN6cHuRu8JryNR4Vq6HWoi9DXoCBvOVYPg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G0bd9Fku6r97plSGD0rTKUGHP4dfjyTSjJz0J9ikW3EzeLhXAg51Uh6rbNFCyQuKj222NsIE02iF414C2zrM/bo3cAqW0pjtn4WYllm6syDOi7B1R/985VBT8SOvq/+Pd9m1BYMD1pi6Yk7kYgkcPs11t5bcAmvA3Z2dY0mm3bt0Us6lyyRHOTWDnHVw8G+WG1iXzgD6QGqZEsTBOz77ugcYWnMZ9ZiR3e60gpV0JwhGUdt5mLsQoeYIF8qegSMMPUL7JyuJ/+sSzrgo80N/UWRRPuWusxfyZjtTcJEf7DaXzh5u39mxFm1YIqV+3PWxtwV4K97OWV+7B5CqY4AC3w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Gianluca Guida <gianluca@xxxxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 01 Mar 2023 12:42:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 01.03.2023 12:51, Oleksii wrote:
> On Mon, 2023-02-27 at 13:59 +0100, Jan Beulich wrote:
>> On 24.02.2023 12:35, Oleksii Kurochko wrote:
>>> +{
>>> +    if ( (insn & INSN_LENGTH_MASK) == INSN_LENGTH_32 )
>>> +        return ( insn == BUG_INSN_32 );
>>> +    else
>>> +        return ( (insn & COMPRESSED_INSN_MASK) == BUG_INSN_16 );
>>
>> Nit (style): The kind-of-operand to return is an expression. Hence
>> you have stray blanks there immediately inside the parentheses.
>> (This is unlike e.g. if(), where you've formatted things correctly.)
> To be 100% sure, should it be: 
>   return ( ( insn & COMPRESSED_INSN_MASK ) == BUG_INSN_16 );

No, that's yet more spaces instead of fewer ones.

    if ( (insn & INSN_LENGTH_MASK) == INSN_LENGTH_32 )
        return insn == BUG_INSN_32;
    else
        return (insn & COMPRESSED_INSN_MASK) == BUG_INSN_16;

or, if you really want the extra parentheses:

    if ( (insn & INSN_LENGTH_MASK) == INSN_LENGTH_32 )
        return (insn == BUG_INSN_32);
    else
        return ((insn & COMPRESSED_INSN_MASK) == BUG_INSN_16);

(Personally I'd also omit the "else":

    if ( (insn & INSN_LENGTH_MASK) == INSN_LENGTH_32 )
        return insn == BUG_INSN_32;

    return (insn & COMPRESSED_INSN_MASK) == BUG_INSN_16;

. Plus I don't think you really need to mask as much, i.e.

    return insn == BUG_INSN_32 ||
           (insn & COMPRESSED_INSN_MASK) == BUG_INSN_16;

would do as well afaict.)

Jan



 


Rackspace

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