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

Re: [XEN PATCH v3 1/2] x86/vmsi: rename variables to address MISRA C:2012 Rule 5.3


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 8 Aug 2023 15:52:06 +0200
  • 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=GoCjWo1H3Dimg14cyPXEhhyFcvBL1Snduz8ZBJpjG5U=; b=N39+nOlYKqNRg/XSM0PscQZbhhjNievJEQTHFvdPZDm5b9aNvkOEPIprKbV1HGRvUdukj5+MZ/oyrS4bz+ounmPplNQRclgBd11YW+b1OQshdVKLDcyYcE61mZnh4jkXsNOyFER7R0AJI3lAspqVx2Q5YNdWqCXGiW7vpOBNH8kwUujcYycW+UKvBjOMmeZLDEeq9RkLyJiTTtHMsAP6fGYvmNiNGu3x+/MUJr3R7RgU0wB6BNSsK2RHa2hMaOu0nLYzxHgRTX9kFhKG/Nxnuh2jFfhz9VpU3C6LIRIsG+bwYeE9pVdHJB4uXU7KlgrfEYjGsmOHdFFe/toZpN44vw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DeyeqAqps5nXJzmEDroH6FpDAFEv2s06tmZ4fUbu0wa/TU30chMojI5ubWinO+yOo7vmpPFLFHtZ1K5KicFSes05xdXF/HjBhMrDLzqtIuHFcpdb7doGbfDtZkam3jGGMfUHLkblfO8cTTN03PqxmjlsJi7EClV8BMgGGuZ2uq5fKRxuz5ISlBhSyelGGu/cF6bEIH3EoFgzlfKPIlXPuDb3DVn/ipIkwOXIJWS6gEnpNynCiaav8ZqG13rxFXCrIyD5gVkwtwqQeywWZCEs1oFmuit6X/5hpgzcvhed/buVKVycGXqGYLEnaMfOlJY8Rsawmd7mkc7NuyGSFGnIKQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 08 Aug 2023 13:52:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08.08.2023 15:38, Nicola Vetrini wrote:
> On 08/08/2023 15:22, Jan Beulich wrote:
>> On 08.08.2023 14:22, Nicola Vetrini wrote:
>>> The local variables 'irq_desc' shadow the homonymous global variable,
>>> declared in 'xen/arch/x86/include/asm/irq.h', therefore they are 
>>> renamed
>>> 'irqd' for consistency with ARM code. Other variables of the same type
>>> in the file are also renamed 'irqd' for consistency.
>>
>> I'm pretty sure I pointed out that Arm uses a mix of "desc" and "irqd".
>> So "consistency with ARM code" doesn't ...
>>
>>> --- a/xen/arch/x86/hvm/vmsi.c
>>> +++ b/xen/arch/x86/hvm/vmsi.c
>>> @@ -281,7 +281,7 @@ static int msixtbl_write(struct vcpu *v, unsigned 
>>> long address,
>>>      unsigned int nr_entry, index;
>>>      int r = X86EMUL_UNHANDLEABLE;
>>>      unsigned long flags;
>>> -    struct irq_desc *desc;
>>> +    struct irq_desc *irqd;
>>
>> ... require e.g. this rename. As mentioned before: Let's limit code
>> churn where possible, and where going beyond what's strictly necessary
>> isn't otherwise useful; there's already enough of it with all these not
>> really helpful Misra changes.
>>
>>> @@ -462,7 +462,7 @@ static void del_msixtbl_entry(struct msixtbl_entry 
>>> *entry)
>>>
>>>  int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t 
>>> gtable)
>>>  {
>>> -    struct irq_desc *irq_desc;
>>> +    struct irq_desc *irqd;
>>
>> This one indeed wants renaming, but then - consistent within the file -
>> to "desc". At least that's my view.
> 
> Well, but having
> 
> struct irq_desc *desc;
> struct msi_desc *msi_desc;
> 
> and then using them both within the function doesn't seem that readable, 

You have a point there, yes. Still I'd then probably follow up with a
change to rename msi_desc -> msi (and I say this despite seeing that
farther down in the file "msi" is also used for another pointer type
variables/parameters). But with what you say in mind I'd also be okay
with you renaming to irqd where renaming is needed, but leaving "desc"
alone.

Jan



 


Rackspace

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