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

Re: [XEN PATCH 1/6] x86: rename variable 'e820' to address MISRA C:2012 Rule 5.3


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 7 Aug 2023 14:02:15 +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=GrBKQz4pbcL7Gop5ewv1uH0dkcqoCwmO18JiTdgjQXs=; b=G+/oyCwcQFeE/Aw4EGQknIa1ZXefp9zbzazHJjsjBWHAQu9S6wF2PK1ELH2/KYT0FjEEBx0WX5ehxyuHe4z8P6F2pDFFyIx05eYMX5DYSXyNYSa9E9g3V1dw5vmO2sCMIuMcWzfDNCjjS+juPZr6rsl1AQ27c005l6MGV2vMVsn3Ueo6Kq7W5u6SaaD+JZhL6lwUwva/IMYq4t/2KTl51bsTihzZdYiaelVJg5IwJgZdZbdAVwoVY2vL4luuQ+gP2C5xVFDa8keaEeZrz1/lstlt73sCVISkhJIs5mVyUWPI1JJVBKkCDpiemGVvf3gOCt1JuUKJ1sqL/VyeGD9dEg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E/N7n9vBOa0yPJcz6aJbjKIAf3/FC+gHYbtJNralmUR0gKigyefLVlLEqp/mu8vYvS+hrgnqEEgosFANoLrdWVLqhcQE3sE/1uoYnnQqQd49F0CEunIr5HUKyQQG4m8Hwvz9o/ug8HfX5AY8/gv8BPp3p6kwgn0FkhQFNT1jCwlOl0R3CuUaHHVnhxGbAu9oYF2+XAaFEsAHHp4E5BC2xLCuipnwJvFfAR8SHaNJ020gBoX8GLeOV5Gx9DhYpv4fred1JsYOP+BGXkwGpavrRrUqitM+GnfPsIGHAvWase5DnU/wL9K40+RpoSN5HuHJ2XoP/vyrXk5iC5LW2k+3Mg==
  • 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: Mon, 07 Aug 2023 12:02:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.08.2023 13:12, Nicola Vetrini wrote:
> 
>>> Besides the one you listed, there are these other occurrences:
>>> - xen/arch/x86/mm.c:4678 in 'arch_memory_op' as local variable 'struct
>>> e820entry'
>>
>> This probably wants renaming; my suggestion would be just "e" here.
> 
> Ok
> 
>>
>>> - xen/arch/x86/include/asm/guest/hypervisor.h:55 in
>>> 'hypervisor_e820_fixup'
>>> - xen/arch/x86/include/asm/pv/shim.h:88 in 'pv_shim_fixup'
>>
>> These can likely again have their parameters dropped, for it only
>> ever being the "e820" global which is passed. (Really I think in such
>> cases the names being the same should be permitted.)
>>
>>> - xen/arch/x86/setup.c:689 in 'kexec_reserve_area'
>>
>> This surely can quite sensibly have boot_e820 use moved into the
>> function itself.
>>
> 
> Ok, although your suggestion of breaking these renames/deletions in more 
> than one patch may not be applicable,
> as 'kexec_reserve_area' calls 'reserve_e820_ram', which in turn calls 
> 'e820_change_range_type'.
> Similarly, the call stack containing 'e820_add_range' includes other 
> calls to the modified functions, so
> effectively it's best to drop the parameter everywhere all at once to 
> prevent accidental mistakes.

Well, this still allows splitting parameter removal changes from
parameter renaming ones.

>>> We can take the first approach you suggested (which was my original
>>> attempt, but then upon feedback on other
>>> patches I reworked this patch before submitting). My doubt about it 
>>> was
>>> that it would introduce a naming
>>> inconsistency with other e820-related objects/types. Anyway, if 
>>> e820_map
>>> is not a good name, could e820_arr be it?
>>
>> But how does "arr" describe the purpose? I would have suggested a name,
>> but none I can think of (e820_real, e820_final) I'd be really happy 
>> with.
>> Just e820 is pretty likely the best name we can have here.
> 
> Ok, so perhaps the best way is using the strategy above, although I'm 
> curious why in other places this
> was not the preferred alternative (as the global may be dropped or the 
> callers may use a e820map other
> than the global one, but here I recognize my lack of knowledge on the 
> internals of Xen).

Other x86 maintainers may voice a different opinion. My take is that
since we've now lived with the set of functions we have for quite a
long time, problematic changes like ones you outline are not very
likely to appear.

Jan



 


Rackspace

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