All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simone Ballarin <simone.ballarin@bugseng.com>
To: xen-devel@lists.xenproject.org
Cc: consulting@bugseng.com, sstabellini@kernel.org,
	"Simone Ballarin" <simone.ballarin@bugseng.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Julien Grall" <julien@xen.org>, "Wei Liu" <wl@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Doug Goldstein" <cardoe@cardoe.com>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>
Subject: [XEN PATCH v3 00/16] xen: address violation of MISRA C:2012 Directive 4.10
Date: Mon, 11 Mar 2024 09:59:09 +0100	[thread overview]
Message-ID: <cover.1710145041.git.simone.ballarin@bugseng.com> (raw)

The Xen sources contain violations of MISRA C:2012 Directive 4.10 whose headline states:
"Precautions shall be taken in order to prevent the contents of a header file
being included more than once".

As stated in v2, the following naming convention has been estabilished:
- arch/.../include/asm/ headers -> ASM_<filename>_H
- private headers -> <dir>_<filename>_H
- asm-generic headers -> ASM_GENERIC_<filename>_H

Since there would have been conflicting guards between architectures (which is a violation
of the directive), there has been a need for ASM headers to specify  if the inclusion guard
referred to ARM or X86. Hence it has been decided to adopt instead:
- arch/<architecture>/include/asm/<subdir>/<filename>.h -> ASM_<architecture>_<subdir>_<filename>_H

The subdir used is the smallest possible to avoid collisions. For example, it has been
observed that in "xen/arch/arm/include/asm/arm32" and "xen/arch/arm/include/asm/arm64" there
are plenty of header files with the same name, hence  _ARMxx_ was added as subdirectory.

There has been a need to define a standard for generated headers too:
 - include/generated/<subdir>/<filename>.h-> GENERATED_<subdir>_<filename>_H
 - arch/<architecture>/include/generated/asm/<filename>.h-> <arch>_GENERATED_ASM_<name>_H

To summarize, here are all the rules that have been applied:
- private headers -> <dir>_<filename>_H
- asm-generic headers -> ASM_GENERIC_<filename>_H
- arch/<architecture>/include/asm/<subdir>/<filename>.h -> ASM_<architecture>_<subdir>_<filename>_H
- include/generated/<subdir>/<filename>.h-> GENERATED_<subdir>_<filename>_H
- arch/<architecture>/include/generated/asm/<filename>.h-> <arch>_GENERATED_ASM_<name>_H

Links to the discussions:
https://lists.xenproject.org/archives/html/xen-devel/2023-09/msg01928.html
https://lists.xenproject.org/archives/html/xen-devel/2023-10/msg01784.html
https://lists.xenproject.org/archives/html/xen-devel/2023-10/msg02073.html

Changes in v3:
Add/amend inclusion guards to address violations of the Directive and the new naming convention.
Remove trailing underscores.
Modify creation rule for asm-offsets.h to conform to the new standard and to not generate conflicting
guards between architectures (which is a violation of the Directive).

Maria Celeste Cesario (6):
  xen/arm: address violations of MISRA C:2012 Directive 4.10
  xen: address violations of MISRA C:2012 Directive 4.10
  xen: add deviations for MISRA C.2012 Directive 4.10
  xen/x86: address violations of MISRA C:2012 Directive 4.10
  x86/mtrr: address violations of MISRA C:2012 Directive 4.10
  xen/lz4: address violations of MISRA C:2012 Directive 4.10

Simone Ballarin (10):
  misra: add deviation for headers that explicitly avoid guards
  misra: modify deviations for empty and generated headers
  misra: add deviations for direct inclusion guards
  xen/arm: address violations of MISRA C:2012 Directive 4.10
  xen/x86: address violations of MISRA C:2012 Directive 4.10
  x86/EFI: address violations of MISRA C:2012 Directive 4.10
  xen/common: address violations of MISRA C:2012 Directive 4.10
  xen/efi: address violations of MISRA C:2012 Directive 4.10
  xen: address violations of MISRA C:2012 Directive 4.10
  x86/asm: address violations of MISRA C:2012 Directive 4.10

 .../eclair_analysis/ECLAIR/deviations.ecl     | 12 +++---
 docs/misra/deviations.rst                     |  7 ++++
 docs/misra/safe.json                          | 40 +++++++++++++++++++
 xen/arch/arm/efi/efi-boot.h                   |  6 +++
 xen/arch/arm/efi/runtime.h                    |  1 +
 xen/arch/arm/include/asm/domain.h             |  6 +--
 xen/arch/arm/include/asm/efibind.h            |  5 +++
 xen/arch/arm/include/asm/event.h              |  6 +--
 xen/arch/arm/include/asm/grant_table.h        |  6 +--
 xen/arch/arm/include/asm/hypercall.h          |  1 +
 xen/arch/arm/include/asm/io.h                 |  6 +--
 xen/arch/arm/include/asm/irq.h                |  6 +--
 xen/arch/arm/include/asm/smp.h                |  6 +--
 xen/arch/arm/include/asm/spinlock.h           |  6 +--
 xen/arch/arm/include/asm/system.h             |  6 +--
 xen/arch/x86/Makefile                         | 10 +++--
 xen/arch/x86/cpu/cpu.h                        |  5 +++
 xen/arch/x86/cpu/mtrr/mtrr.h                  |  4 ++
 xen/arch/x86/efi/efi-boot.h                   |  7 ++++
 xen/arch/x86/efi/runtime.h                    |  5 +++
 xen/arch/x86/include/asm/compat.h             |  5 +++
 xen/arch/x86/include/asm/cpufeatures.h        |  5 +--
 xen/arch/x86/include/asm/domain.h             |  6 +--
 xen/arch/x86/include/asm/efibind.h            |  5 +++
 xen/arch/x86/include/asm/event.h              |  6 +--
 xen/arch/x86/include/asm/grant_table.h        |  6 +--
 xen/arch/x86/include/asm/hypercall.h          |  1 +
 xen/arch/x86/include/asm/io.h                 |  6 +--
 xen/arch/x86/include/asm/irq.h                |  6 +--
 xen/arch/x86/include/asm/smp.h                |  6 +--
 xen/arch/x86/include/asm/spinlock.h           |  6 +--
 xen/arch/x86/include/asm/system.h             |  6 +--
 xen/arch/x86/x86_64/mmconfig.h                |  5 +++
 xen/arch/x86/x86_emulate/private.h            |  5 +++
 xen/build.mk                                  |  6 ++-
 xen/common/decompress.h                       |  5 +++
 xen/common/efi/efi.h                          |  5 +++
 xen/common/event_channel.h                    |  5 +++
 xen/common/lz4/defs.h                         |  5 +++
 xen/include/Makefile                          | 12 ++++--
 xen/include/public/arch-x86/cpufeatureset.h   |  1 +
 xen/include/public/arch-x86/xen.h             |  1 +
 xen/include/public/errno.h                    |  1 +
 xen/include/xen/err.h                         |  8 ++--
 xen/include/xen/pci_ids.h                     |  5 +++
 xen/include/xen/softirq.h                     |  8 ++--
 xen/include/xen/vmap.h                        |  8 ++--
 xen/scripts/Makefile.asm-generic              | 16 +++++++-
 48 files changed, 233 insertions(+), 78 deletions(-)

-- 
2.34.1



             reply	other threads:[~2024-03-11  9:00 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11  8:59 Simone Ballarin [this message]
2024-03-11  8:59 ` [XEN PATCH v3 01/16] misra: add deviation for headers that explicitly avoid guards Simone Ballarin
2024-03-11 10:02   ` Jan Beulich
2024-03-14 22:55     ` Stefano Stabellini
2024-03-15  6:59       ` Jan Beulich
2024-03-16  0:34         ` Stefano Stabellini
2024-03-11  8:59 ` [XEN PATCH v3 02/16] misra: modify deviations for empty and generated headers Simone Ballarin
2024-03-14 22:57   ` Stefano Stabellini
2024-03-11  8:59 ` [XEN PATCH v3 03/16] misra: add deviations for direct inclusion guards Simone Ballarin
2024-03-11 10:08   ` Jan Beulich
2024-03-11 12:00     ` Simone Ballarin
2024-03-11 13:56       ` Jan Beulich
2024-03-11 14:14         ` Simone Ballarin
2024-03-14 22:59           ` Stefano Stabellini
2024-03-15  9:19             ` Jan Beulich
2024-03-16  0:43               ` Stefano Stabellini
2024-03-18  8:06                 ` Jan Beulich
2024-03-19  3:34                   ` Stefano Stabellini
2024-03-19  7:45                     ` Jan Beulich
2024-06-25 19:17                       ` Nicola Vetrini
2024-03-11  8:59 ` [XEN PATCH v3 04/16] xen/arm: address violations of MISRA C:2012 Directive 4.10 Simone Ballarin
2024-03-11 10:10   ` Jan Beulich
2024-03-11 12:07     ` Simone Ballarin
2024-03-11 14:00       ` Jan Beulich
2024-03-11  8:59 ` [XEN PATCH v3 05/16] xen/x86: " Simone Ballarin
2024-03-12  8:16   ` Jan Beulich
2024-06-25 19:31     ` Nicola Vetrini
2024-06-26  8:20       ` Jan Beulich
2024-06-26  8:31         ` Nicola Vetrini
2024-06-26  9:06       ` Jan Beulich
2024-06-26  9:20         ` Nicola Vetrini
2024-06-26  9:26           ` Jan Beulich
2024-06-26 10:25             ` Nicola Vetrini
2024-06-26 10:31               ` Jan Beulich
2024-06-26 13:38                 ` Anthony PERARD
2024-06-26 14:24                   ` Nicola Vetrini
2024-03-11  8:59 ` [XEN PATCH v3 06/16] x86/EFI: " Simone Ballarin
2024-03-14 23:02   ` Stefano Stabellini
2024-03-11  8:59 ` [XEN PATCH v3 07/16] xen/common: " Simone Ballarin
2024-03-14 23:03   ` Stefano Stabellini
2024-03-11  8:59 ` [XEN PATCH v3 08/16] xen/efi: " Simone Ballarin
2024-03-14 23:04   ` Stefano Stabellini
2024-03-11  8:59 ` [XEN PATCH v3 09/16] xen: " Simone Ballarin
2024-03-12  8:21   ` Jan Beulich
2024-03-12 10:22   ` Julien Grall
2024-03-14 23:07   ` Stefano Stabellini
2024-03-11  8:59 ` [XEN PATCH v3 10/16] x86/asm: " Simone Ballarin
2024-03-12  8:32   ` Jan Beulich
2024-03-11  8:59 ` [XEN PATCH v3 11/16] xen/arm: " Simone Ballarin
2024-03-14 23:12   ` Stefano Stabellini
2024-03-11  8:59 ` [XEN PATCH v3 12/16] xen: " Simone Ballarin
2024-03-12 14:44   ` Jan Beulich
2024-03-11  8:59 ` [XEN PATCH v3 13/16] xen: add deviations for MISRA C.2012 " Simone Ballarin
2024-03-12 14:58   ` Jan Beulich
2024-03-11  8:59 ` [XEN PATCH v3 14/16] xen/x86: address violations of MISRA C:2012 " Simone Ballarin
2024-03-12 15:54   ` Jan Beulich
2024-03-14 23:19     ` Stefano Stabellini
2024-03-11  8:59 ` [XEN PATCH v3 15/16] x86/mtrr: " Simone Ballarin
2024-03-12 15:55   ` Jan Beulich
2024-03-14 13:00   ` Jan Beulich
2024-03-11  8:59 ` [XEN PATCH v3 16/16] xen/lz4: " Simone Ballarin
2024-03-12 15:56   ` Jan Beulich
2024-03-11  9:59 ` [XEN PATCH v3 00/16] xen: address violation " Jan Beulich
2024-03-11 11:41   ` Simone Ballarin
2024-03-11 13:27     ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1710145041.git.simone.ballarin@bugseng.com \
    --to=simone.ballarin@bugseng.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=cardoe@cardoe.com \
    --cc=consulting@bugseng.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.