Re: [PATCH] ioreq: don't wrongly claim "success" in ioreq_send_buffered()

2024-09-23 Thread Nicola Vetrini
should be an ASSERT()? That might be an option, yet with the general movement towards also providing safety on release builds that would likely end up being if ( dir != IOREQ_WRITE ) { ASSERT_UNREACHABLE(): return 0; } i.e. still an extra check. Jan -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [PATCH v2] misra: increase identifiers length to 63

2024-11-19 Thread Nicola Vetrini
violations, getting us one step closer to marking Rules 5.2 and 5.4 as clean. The ECLAIR configuration is already using 63, so this change matches the rules.rst documentation with the ECLAIR behavior. Signed-off-by: Stefano Stabellini Reviewed-by: Nicola Vetrini --- Changes in v2: - use 63 instead of

Re: x86: Declarations for compat_set_{cx,px}_pminfo()

2024-11-18 Thread Nicola Vetrini
ased on an older tree). A last resort may be to special-case those declarations, but that's undesirable. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)commit caffa89a06275b6b50ace99170b99b500b7b32f7 Author: Nicola Vetrini Date: Wed Nov 29 12:23:25 2023 +0100

Re: [PATCH] misra: increase identifiers length to 64

2024-11-18 Thread Nicola Vetrini
r. It is also possibile to do it the other way around (align the rst with the ECLAIR configuration), which spares the need for additional deviations. In that case, I agree that 63 is better than 64. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [PATCH v2 1/2] x86/uaccess: rework user access speculative harden guards

2024-11-27 Thread Nicola Vetrini
he GNU extension, and where hence __VA_ARGS__ would - by extrapolation of the Misra rule - need parenthesizing, when it isn't and can't be. Isn't it rather the case that variable argument macros need a more general deviation, if not an adjustment to the Misra rule? Extending the Cc list some ... Jan -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [XEN PATCH v3 05/16] xen/x86: address violations of MISRA C:2012 Directive 4.10

2024-06-26 Thread Nicola Vetrini
On 2024-06-26 10:20, Jan Beulich wrote: On 25.06.2024 21:31, Nicola Vetrini wrote: On 2024-03-12 09:16, Jan Beulich wrote: On 11.03.2024 09:59, Simone Ballarin wrote: --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -258,18 +258,20 @@ $(obj)/asm-macros.i: CFLAGS-y += -P $(objtree

Re: [XEN PATCH v3 05/16] xen/x86: address violations of MISRA C:2012 Directive 4.10

2024-06-26 Thread Nicola Vetrini
On 2024-06-26 11:06, Jan Beulich wrote: On 25.06.2024 21:31, Nicola Vetrini wrote: On 2024-03-12 09:16, Jan Beulich wrote: On 11.03.2024 09:59, Simone Ballarin wrote: --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -258,18 +258,20 @@ $(obj)/asm-macros.i: CFLAGS-y += -P $(objtree

Re: [XEN PATCH v3 05/16] xen/x86: address violations of MISRA C:2012 Directive 4.10

2024-06-26 Thread Nicola Vetrini
On 2024-06-26 11:26, Jan Beulich wrote: On 26.06.2024 11:20, Nicola Vetrini wrote: On 2024-06-26 11:06, Jan Beulich wrote: On 25.06.2024 21:31, Nicola Vetrini wrote: On 2024-03-12 09:16, Jan Beulich wrote: On 11.03.2024 09:59, Simone Ballarin wrote: --- a/xen/arch/x86/Makefile +++ b/xen

[XEN PATCH v2] x86/mctelem: address violations of MISRA C: 2012 Rule 5.3

2024-06-26 Thread Nicola Vetrini
file, therefore the local variables are renamed to avoid this. No functional change. Signed-off-by: Alessandro Zucchelli Signed-off-by: Nicola Vetrini --- Changes in v2: - s/mctctl_cpu/ctl/ and amended file comment and commit message --- xen/arch/x86/cpu/mcheck/mctelem.c | 26

[XEN PATCH v2 for-4.20 1/7] automation/eclair: address violations of MISRA C Rule 20.7

2024-06-26 Thread Nicola Vetrini
he risk of misuse due developer confusion is deemed not substantial enough to warrant a more involved refactor, thus the macro is deviated for this rule. No functional change. Signed-off-by: Nicola Vetrini --- Changes in v2: - Switched to a comment-based deviation to allow other tools to pick this de

[XEN PATCH v2 for-4.20 6/7] automation/eclair_analysis: clean ECLAIR configuration scripts

2024-06-26 Thread Nicola Vetrini
Remove from the ECLAIR integration scripts an unused option, which was already ignored, and make the help texts consistent with the rest of the scripts. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- automation/eclair_analysis/ECLAIR/analyze.sh | 3

[XEN PATCH v2 for-4.20 3/7] xen/guest_access: address violations of MISRA rule 20.7

2024-06-26 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/include/xen/guest_access.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/xen/guest_access.h b/xen/include/xen/gues

[XEN PATCH v2 for-4.20 5/7] x86/irq: address violations of MISRA C Rule 20.7

2024-06-26 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- Note that the rule does not apply to f because that parameter is not used as an expression in the macro, but rather as an identifier. --- xen/include/xen

[XEN PATCH v2 for-4.20 4/7] automation/eclair_analysis: address violations of MISRA C Rule 20.7

2024-06-26 Thread Nicola Vetrini
ause it is very unlikely to induce developer confusion and result in the wrong control flow being carried out. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- Changes in v2: - Introduce a deviation instead of adding parentheses --- automation/eclair_analy

[XEN PATCH v2 for-4.20 2/7] xen/self-tests: address violations of MISRA rule 20.7

2024-06-26 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Jan Beulich --- In this case the use of parentheses can detect misuses of the COMPILE_CHECK macro for the fn argument that happen to pass the compile-time check (see

[XEN PATCH v2 for-4.20 7/7] x86/traps: address violations of MISRA C Rule 20.7

2024-06-26 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- xen/arch/x86/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 9906e874d593..ee91fc56b125 100644 ---

[XEN PATCH v2 for-4.20 0/7] address several violations of MISRA Rule 20.7

2024-06-26 Thread Nicola Vetrini
here. [1] https://lore.kernel.org/xen-devel/2f2c865f20d0296e623f1d65bed25c083f5dd497.1711700095.git.nicola.vetr...@bugseng.com/ Changes in v2: - Patch 7 is new to this series Nicola Vetrini (7): automation/eclair: address violations of MISRA C Rule 20.7 xen/self-tests: address violations of

Re: [XEN PATCH v2 for-4.20 0/7] address several violations of MISRA Rule 20.7

2024-06-26 Thread Nicola Vetrini
On 2024-06-26 15:28, Nicola Vetrini wrote: Hi all, this series addresses several violations of Rule 20.7, as well as a small fix to the ECLAIR integration scripts that do not influence the current behaviour, but were mistakenly part of the upstream configuration. Note that by applying this

Re: [XEN PATCH v3 05/16] xen/x86: address violations of MISRA C:2012 Directive 4.10

2024-06-26 Thread Nicola Vetrini
On 2024-06-26 15:38, Anthony PERARD wrote: On Wed, Jun 26, 2024 at 12:31:42PM +0200, Jan Beulich wrote: On 26.06.2024 12:25, Nicola Vetrini wrote: > On 2024-06-26 11:26, Jan Beulich wrote: >> On 26.06.2024 11:20, Nicola Vetrini wrote: >>> On 2024-06-26 11:06, Jan Beul

[XEN PATCH] x86: p2m-pod: address violation of MISRA C Rule 2.1

2024-06-27 Thread Nicola Vetrini
s a defensive coding measure to have a safe fallback that is reachable in non-debug builds, and can thus be deviated with a comment-based deviation. No functional change. Signed-off-by: Nicola Vetrini --- docs/misra/safe.json | 8 xen/arch/x86/mm/p2m-pod.c | 1 + 2 files changed, 9

Re: xen | Failed pipeline for staging | 402e4732

2024-06-27 Thread Nicola Vetrini
/-/commit/402e473249cf62dd4c6b3b137aa845db0fe1453a ) Commit Message: x86/traps: address violations of MISRA C Rule 2... Commit Author: Nicola Vetrini Committed by: Jan Beulich ( https://gitlab.com/jbeulich ) Pipeline #1350627221 ( https://gitlab.com/xen-project/xen/-/pipelines/1350627221

[XEN PATCH v2] x86: p2m-pod: address violation of MISRA C Rule 2.1

2024-06-27 Thread Nicola Vetrini
s a defensive coding measure to have a safe fallback that is reachable in non-debug builds, and can thus be deviated with a comment-based deviation. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- Changes in v2: - rebased against current staging --- docs/misr

Re: [XEN PATCH] x86: p2m-pod: address violation of MISRA C Rule 2.1

2024-06-27 Thread Nicola Vetrini
On 2024-06-28 01:18, Stefano Stabellini wrote: On Thu, 27 Jun 2024, Nicola Vetrini wrote: The label 'out_unmap' is only reachable after ASSERT_UNREACHABLE, so the code below is only executed upon erroneously reaching that program point and calling domain_crash, thus resulting in th

Re: [XEN PATCH v2] x86/mctelem: address violations of MISRA C: 2012 Rule 5.3

2024-07-01 Thread Nicola Vetrini
On 2024-07-01 10:27, Jan Beulich wrote: On 27.06.2024 02:57, Stefano Stabellini wrote: On Wed, 26 Jun 2024, Nicola Vetrini wrote: From: Alessandro Zucchelli This addresses violations of MISRA C:2012 Rule 5.3 which states as following: An identifier declared in an inner scope shall not hide

[XEN PATCH for-4.19] xen/bitmap: amend MISRA C deviation for Rule 20.7

2024-07-09 Thread Nicola Vetrini
ned-off-by: Nicola Vetrini --- An alternative approach would be to use an ecl configuration, but that would be tool-specific. As this is purely an improvement to the CI, I'd like to ask for a release ack. --- xen/include/xen/bitmap.h | 15 --- 1 file changed, 12 insertions(+), 3 del

Re: [XEN PATCH for-4.19] xen/bitmap: amend MISRA C deviation for Rule 20.7

2024-07-09 Thread Nicola Vetrini
On 2024-07-09 11:40, Jan Beulich wrote: On 09.07.2024 11:34, Nicola Vetrini wrote: As noticed in the gitlab analyses, deviating bitmap_switch for Rule 20.7 in this way does not work for ECLAIR. Instead, the deviation should be put in the macro invocation. Why is this? I ask in particular

Re: [RFC PATCH] automation: add linker symbol name script

2024-07-23 Thread Nicola Vetrini
+_edevice +_asdevice +_aedevice +_steemediator +_eteemediator +__init_begin +_sinittext +_einittext +__setup_start +__setup_end +__initcall_start +__presmp_initcall_end +__initcall_end +__alt_instructions +__alt_instructions_end +__ctors_start +__ctors_end +__init_end_efi +__init_end +__bss_start +__per_cpu_start +__per_cpu_data_end +__bss_end +_end -- 2.37.6 -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [RFC PATCH v3] automation: add linker symbol name script

2024-07-25 Thread Nicola Vetrini
will carry out that's not a particular concern, as each symbol will be used to construct a single regex, but for readability that might be appreciated by the maintainers. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [RFC PATCH v3] automation: add linker symbol name script

2024-07-25 Thread Nicola Vetrini
ild (and hence the analysis), but the configuration must be generated before the analysis, the only way this could work in my opinion is this: - a build without analysis is performed, just enough to build xen.lds (maybe there is a specific Makefile target to do this) - generate the configuration,

Re: [RFC PATCH v3] automation: add linker symbol name script

2024-07-25 Thread Nicola Vetrini
On 2024-07-26 00:43, Stefano Stabellini wrote: On Thu, 25 Jul 2024, Nicola Vetrini wrote: On 2024-07-25 21:01, victorm.l...@amd.com wrote: > From: Victor Lira > > Requested-by: Jan Beulich > Signed-off-by: Victor Lira > --- > Notes: > This is a utilty script for help w

Re: [XEN PATCH v5 13/17] xen: add deviations for MISRA C 2012 Dir D4.10

2024-07-30 Thread Nicola Vetrini
On 2024-07-30 11:45, Jan Beulich wrote: On 23.07.2024 10:15, Alessandro Zucchelli wrote: From: Nicola Vetrini Add safe deviation for *.c files, as estabilished in past discussion. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin Signed-off-by: Nicola Vetrini Signed

[XEN PATCH] automation/eclair_analysis: add Rule 18.6 to the clean guidelines

2024-07-31 Thread Nicola Vetrini
lowing the presence of cautions (currently there are no violations). No functional change. Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/monitored.ecl | 1 + automation/eclair_analysis/ECLAIR/tagging.ecl | 1 + 2 files changed, 2 insertions(+) diff --git a/automation/eclai

Re: [PATCH] automation: fix eclair scanning for merge requests

2024-08-02 Thread Nicola Vetrini
{GITLAB_USER_LOGIN}" +event=push +ref_kind=branch +ref="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" headCommitId="${CI_COMMIT_SHA}" -baseCommitId="${CI_MERGE_REQUEST_DIFF_BASE_SHA}" +pushUser="${GITLAB_USER_NAME}"

Re: [PATCH v2 1/2] xen/device-tree: Move Arm's setup.c bootinfo functions to common

2024-08-07 Thread Nicola Vetrini
+#endif +bool static_heap; +}; + +#ifdef CONFIG_ACPI +#define BOOTINFO_ACPI_INIT .acpi.common.max_banks = NR_MEM_BANKS, +#else +#define BOOTINFO_ACPI_INIT +#endif + +#ifdef CONFIG_STATIC_SHM +#define BOOTINFO_SHMEM_INIT .shmem.common.max_banks = NR_SHMEM_BANKS, +#else +#define BOOTINFO_SHMEM_INIT +#endif + +#define BOOTINFO_INIT \ +{ \ +.mem.common.max_banks = NR_MEM_BANKS, \ +.reserved_mem.common.max_banks = NR_MEM_BANKS, \ +BOOTINFO_ACPI_INIT \ +BOOTINFO_SHMEM_INIT \ +} + +extern struct bootinfo bootinfo; + +void populate_boot_allocator(void); + +size_t boot_fdt_info(const void *fdt, paddr_t paddr); + +const char *boot_fdt_cmdline(const void *fdt); + +static inline struct membanks *bootinfo_get_reserved_mem(void) +{ +return container_of(&bootinfo.reserved_mem.common, struct membanks, common); +} + +static inline struct membanks *bootinfo_get_mem(void) +{ +return container_of(&bootinfo.mem.common, struct membanks, common); +} + +#ifdef CONFIG_ACPI +static inline struct membanks *bootinfo_get_acpi(void) +{ +return container_of(&bootinfo.acpi.common, struct membanks, common); +} +#endif + +#ifdef CONFIG_STATIC_SHM +static inline struct membanks *bootinfo_get_shmem(void) +{ +return container_of(&bootinfo.shmem.common, struct membanks, common); +} + +static inline struct shmem_membank_extra *bootinfo_get_shmem_extra(void) +{ +return bootinfo.shmem.extra; +} +#endif + +#endif /* XEN_BOOTFDT_H */ -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [PATCH 9/9] x86/bitops: Use the POPCNT instruction when available

2024-08-23 Thread Nicola Vetrini
1UL << (BITS_PER_LONG - 1)), 2); +RUNTIME_CHECK(arch_generic_hweightl, -1UL, BITS_PER_LONG); +} +#endif /* CONFIG_X86 */ #endif /* CONFIG_SELF_TESTS */ -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [XEN PATCH v2 1/3] drivers: char: address violation of MISRA C Rule 20.7

2024-05-03 Thread Nicola Vetrini
On 2024-05-01 21:57, Stefano Stabellini wrote: On Tue, 30 Apr 2024, Nicola Vetrini wrote: MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses

Re: [XEN PATCH v2 1/3] drivers: char: address violation of MISRA C Rule 20.7

2024-05-03 Thread Nicola Vetrini
On 2024-05-03 12:10, Jan Beulich wrote: On 03.05.2024 09:29, Nicola Vetrini wrote: On 2024-05-01 21:57, Stefano Stabellini wrote: On Tue, 30 Apr 2024, Nicola Vetrini wrote: MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parent

Re: [REGRESSION] Re: [XEN PATCH 0/3] automation/eclair: do not allow failure for triggered analyses

2024-05-05 Thread Nicola Vetrini
50868 -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

[XEN PATCH] automation/eclair_analysis: unblock pipelines from certain repositories

2024-05-06 Thread Nicola Vetrini
Repositories under people/* only execute the analyze step if manually triggered, but in order to avoid blocking the rest of the pipeline if such step is not run, allow it to fail. Reported-by: Andrew Cooper Signed-off-by: Nicola Vetrini --- See https://gitlab.com/xen-project/people/bugseng/xen

[XEN PATCH v3] x86/IOMMU: address violations of MISRA C:2012 Rule 14.4

2024-05-08 Thread Nicola Vetrini
using enum constants as controlling expressions to comply with Rule 14.4. Amend the comment in the enum definition to reflect the fact that boolean uses of iommu_intremap are no longer allowed. No functional change. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin Signed-off-

[XEN PATCH] automation/eclair_analysis: tag MISRA C Rule 8.2 as clean.

2024-05-09 Thread Nicola Vetrini
Tag the rule as clean, as there are no more violations in the codebase since e8e8afee990a ("svm: Fix MISRA 8.2 violation"). Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/tagging.ecl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/

[XEN PATCH] automation/eclair_analysis: tag MISRA C Rule 1.1 as clean

2024-05-10 Thread Nicola Vetrini
Tag the rule as clean, as there are no more violations in the codebase since 93c27d54dd23 ("xen/arm: Fix MISRA regression on R1.1, flexible array member not at the end"). Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/tagging.ecl | 2 +- 1 file changed, 1 inser

Re: [XEN PATCH 03/10] automation/eclair_analysis: deviate macro count_args_ for MISRA Rule 20.7

2024-05-15 Thread Nicola Vetrini
On 2024-05-01 21:54, Stefano Stabellini wrote: On Mon, 29 Apr 2024, Nicola Vetrini wrote: On 2024-04-25 02:28, Stefano Stabellini wrote: > On Tue, 23 Apr 2024, Nicola Vetrini wrote: > > The count_args_ macro violates Rule 20.7, but it can't be made > > compliant with Rule 2

[XEN PATCH 0/4] address violations of MISRA C Rule 20.7

2024-05-15 Thread Nicola Vetrini
gy adopted to bring them into compliance is to add parentheses around macro arguments where needed. Nicola Vetrini (4): x86/vpmu: address violations of MISRA C Rule 20.7 x86/hvm: address violations of MISRA C Rule 20.7 x86_64/uaccess: address violations of MISRA C Rule 20.7 x86_64/cpu_idl

[XEN PATCH 4/4] x86_64/cpu_idle: address violations of MISRA C Rule 20.7

2024-05-15 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- xen/arch/x86/x86_64/cpu_idle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/x86_64/cpu_idle.c b/xen/arch/x86/x86_64/cpu_idle.c index fc

[XEN PATCH 3/4] x86_64/uaccess: address violations of MISRA C Rule 20.7

2024-05-15 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. xlat_malloc_init is touched for consistency, despite the construct being already deviated. No functional change. Signed-off-by: Nicola Vetrini --- xen/arch/x86/include/asm/x86_64/uaccess.h | 7 --- 1 file changed, 4 insert

[XEN PATCH 2/4] x86/hvm: address violations of MISRA C Rule 20.7

2024-05-15 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- xen/arch/x86/hvm/mtrr.c | 2 +- xen/arch/x86/hvm/rtc.c | 2 +- xen/arch/x86/include/asm/hvm/save.h | 2 +- 3 files changed, 3 insertions(+), 3 deletion

[XEN PATCH 1/4] x86/vpmu: address violations of MISRA C Rule 20.7

2024-05-15 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- xen/arch/x86/cpu/vpmu_amd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c index db2fa420e14a..97

[XEN PATCH] automation/eclair_analysis: fully deviate MISRA C Rules 21.9 and 21.10

2024-05-15 Thread Nicola Vetrini
allowing uses of these functions in the project. The rules are also marked as clean as a consequence. Signed-off-by: Nicola Vetrini --- .../eclair_analysis/ECLAIR/deviations.ecl | 14 ++ .../eclair_analysis/ECLAIR/monitored.ecl | 2 ++ automation/eclair_analysis/ECLAIR

Re: [XEN PATCH 2/4] x86/hvm: address violations of MISRA C Rule 20.7

2024-05-16 Thread Nicola Vetrini
On 2024-05-16 01:18, Stefano Stabellini wrote: On Wed, 15 May 2024, Nicola Vetrini wrote: MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses

[XEN PATCH] automation/eclair_analysis: set MISRA C Rule 10.2 as clean

2024-05-17 Thread Nicola Vetrini
This rule has no more violations in the codebase, so it can be set as clean. No functional change. Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/tagging.ecl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl

[XEN PATCH] automation/eclair_analysis: add already clean rules to the analysis

2024-05-21 Thread Nicola Vetrini
Some MISRA C rules already have no violations in Xen, so they can be set as clean. Reorder the rules in tagging.ecl according to version ordering (i.e. sort -V) and split the configuration on multiple lines for readability. Signed-off-by: Nicola Vetrini --- .../eclair_analysis/ECLAIR

Re: [XEN PATCH v3] arm/mem_access: add conditional build of mem_access.c

2024-05-22 Thread Nicola Vetrini
s good so once we agree on the commit message, then I am happy to update it on commit. Cheers, since Julien is ok with the patch, with the commit message he proposed, I think this needs an R-by or an A-by in order to commit for 4.19. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

[XEN PATCH 3/4] x86: address violations of MISRA C Rule 8.4

2024-05-27 Thread Nicola Vetrini
sult, they can be exempted using a comment-based deviation. No functional change. Signed-off-by: Nicola Vetrini --- Adding the asmlinkage macro to variables is not appropriate, as this pseudo-attribute may expand, for instance, to a different calling convention in the future (e.g. stdcall) --- xe

[XEN PATCH 4/4] x86/traps: address violation of MISRA C Rule 8.4

2024-05-27 Thread Nicola Vetrini
e function must remain extern. Therefore, this function is deviated using a comment-based deviation. No functional change. Signed-off-by: Nicola Vetrini --- xen/arch/x86/traps.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 468a03608102..99

[XEN PATCH 0/4] various ECLAIR and MISRA improvements

2024-05-27 Thread Nicola Vetrini
Hi all, this series contains various miscellaneous changes to the ECLAIR and deviations for MISRA rules Nicola Vetrini (4): docs/misra: exclude gdbsx from MISRA compliance automation/eclair_analysis: avoid an ECLAIR warning about escaping x86: address violations of MISRA C Rule 8.4 x86

[XEN PATCH 2/4] automation/eclair_analysis: avoid an ECLAIR warning about escaping

2024-05-27 Thread Nicola Vetrini
The parentheses in this regular expression should be doubly escaped because they are undergo escaping twice. Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automation/eclair_analysis

[XEN PATCH 1/4] docs/misra: exclude gdbsx from MISRA compliance

2024-05-27 Thread Nicola Vetrini
These files are used when debugging Xen, and are not meant to comply with MISRA rules at the moment. No functional change. Signed-off-by: Nicola Vetrini --- docs/misra/exclude-list.json | 8 1 file changed, 8 insertions(+) diff --git a/docs/misra/exclude-list.json b/docs/misra

Re: [XEN PATCH 3/4] x86: address violations of MISRA C Rule 8.4

2024-05-28 Thread Nicola Vetrini
On 2024-05-28 08:28, Jan Beulich wrote: On 27.05.2024 16:53, Nicola Vetrini wrote: Rule 8.4 states: "A compatible declaration shall be visible when an object or function with external linkage is defined." These variables are only referenced from asm modules, so they need to be extern

Re: [PATCH v2 06/13] xen/bitops: Implement ffs() in common logic

2024-05-30 Thread Nicola Vetrini
CC: Simone Ballarin CC: Federico Serafini CC: Nicola Vetrini v2: * Fall back to generic, not builtin. * Extend the testing with multi-bit values. * Use always_inline for x86 * Defer x86 optimisation to a later change --- xen/arch/arm/include/asm/bitops.h | 2 +- xen/arch/ppc/include/as

Re: [PATCH v2 06/13] xen/bitops: Implement ffs() in common logic

2024-06-01 Thread Nicola Vetrini
On 2024-05-31 10:48, Andrew Cooper wrote: On 31/05/2024 9:34 am, Andrew Cooper wrote: On 31/05/2024 7:56 am, Nicola Vetrini wrote: On 2024-05-31 03:14, Stefano Stabellini wrote: On Fri, 24 May 2024, Andrew Cooper wrote: Perform constant-folding unconditionally, rather than having it

[XEN PATCH 0/5] address violations of MISRA C rules

2024-06-01 Thread Nicola Vetrini
Patches 1 to 4 address violations of MISRA C Rule 20.12 by deviating certain uses of some macros, while the last patch addresses some regressions introduced by the latest bitops series Nicola Vetrini (5): xen/domain: deviate violation of MISRA C Rule 20.12 x86/domain: deviate violation of

[XEN PATCH 3/5] x86: deviate violation of MISRA C Rule 20.12

2024-06-01 Thread Nicola Vetrini
ameter and for token pasting the rule deliberately violated. A SAF-x-safe comment is used to deviate the usage. No functional change. Signed-off-by: Nicola Vetrini --- xen/arch/x86/include/asm/shared.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/x86/include/asm/shared.h b/xe

[XEN PATCH 4/5] automation/eclair_analysis: address remaining violations of MISRA C Rule 20.12

2024-06-01 Thread Nicola Vetrini
change. Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++ 1 file changed, 6 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index cf62a874d928..f29db9e08248 100644 --- a

[XEN PATCH 5/5] xen: fix MISRA regressions on rule 20.9 and 20.12

2024-06-01 Thread Nicola Vetrini
ator. No functional change. Fixes: ea59e7d780d9 ("xen/bitops: Cleanup and new infrastructure ahead of rearrangements") Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 2 +- xen/include/xen/self-tests.h | 2 +- 2 files changed,

[XEN PATCH 2/5] x86/domain: deviate violation of MISRA C Rule 20.12

2024-06-01 Thread Nicola Vetrini
ular macro argument and as an operand for stringification in the expansion of CHECK_FIELD_. This is deviated using a SAF-x-safe comment. No functional change. Signed-off-by: Nicola Vetrini --- xen/arch/x86/domain.c | 1 + xen/arch/x86/domctl.c | 1 + 2 files changed, 2 insertions(+) diff --git a/xe

[XEN PATCH 1/5] xen/domain: deviate violation of MISRA C Rule 20.12

2024-06-01 Thread Nicola Vetrini
both as a regular macro argument and as an operand for stringification in the expansion of macro spin_lock_init_prof. A SAF-x-safe deviation is introduced to justify this. No functional change. Signed-off-by: Nicola Vetrini --- docs/misra/safe.json | 8 xen/common/domain.c | 1 + 2 files

Re: [XEN PATCH 5/5] xen: fix MISRA regressions on rule 20.9 and 20.12

2024-06-01 Thread Nicola Vetrini
On 2024-06-01 14:47, Andrew Cooper wrote: On 01/06/2024 11:16 am, Nicola Vetrini wrote: ea59e7d780d9 ("xen/bitops: Cleanup and new infrastructure ahead of rearrangements") introduced new violations on previously clean rules 20.9 and 20.12. The first is introduced because CONFIG_CC_I

Re: [XEN PATCH 5/5] xen: fix MISRA regressions on rule 20.9 and 20.12

2024-06-01 Thread Nicola Vetrini
On 2024-06-01 15:08, Andrew Cooper wrote: On 01/06/2024 1:58 pm, Nicola Vetrini wrote: On 2024-06-01 14:47, Andrew Cooper wrote: On 01/06/2024 11:16 am, Nicola Vetrini wrote: ea59e7d780d9 ("xen/bitops: Cleanup and new infrastructure ahead of rearrangements") introduced new vio

Re: [XEN PATCH 0/5] address violations of MISRA C rules

2024-06-01 Thread Nicola Vetrini
On 2024-06-01 16:37, Andrew Cooper wrote: On 01/06/2024 11:16 am, Nicola Vetrini wrote: Patches 1 to 4 address violations of MISRA C Rule 20.12 by deviating certain uses of some macros, while the last patch addresses some regressions introduced by the latest bitops series Nicola Vetrini (5

[XEN PATCH] automation/eclair_analysis: add more clean MISRA guidelines

2024-06-01 Thread Nicola Vetrini
Rules 20.9, 20.12 and 14.4 are now clean on ARM and x86, so they are added to the list of clean guidelines. Some guidelines listed in the additional clean section for ARM are also clean on x86, so they can be removed from there. No functional change. Signed-off-by: Nicola Vetrini --- +Cc

Re: [XEN PATCH 4/5] automation/eclair_analysis: address remaining violations of MISRA C Rule 20.12

2024-06-03 Thread Nicola Vetrini
On 2024-06-03 07:58, Jan Beulich wrote: On 01.06.2024 12:16, Nicola Vetrini wrote: --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -483,6 +483,12 @@ leads to a violation of the Rule are deviated." -config=MC3R1.R20.12,m

Re: [XEN PATCH 1/5] xen/domain: deviate violation of MISRA C Rule 20.12

2024-06-03 Thread Nicola Vetrini
On 2024-06-03 08:39, Jan Beulich wrote: On 01.06.2024 12:16, Nicola Vetrini wrote: MISRA C Rule 20.12 states: "A macro parameter used as an operand to the # or ## operators, which is itself subject to further macro replacement, shall only be used as an operand to these operators"

Re: [XEN PATCH 4/5] automation/eclair_analysis: address remaining violations of MISRA C Rule 20.12

2024-06-03 Thread Nicola Vetrini
On 2024-06-03 20:52, Jan Beulich wrote: On 03.06.2024 09:13, Nicola Vetrini wrote: On 2024-06-03 07:58, Jan Beulich wrote: On 01.06.2024 12:16, Nicola Vetrini wrote: --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -483,6 +483,12

Re: [XEN PATCH 4/5] automation/eclair_analysis: address remaining violations of MISRA C Rule 20.12

2024-06-03 Thread Nicola Vetrini
On 2024-06-03 23:24, Jan Beulich wrote: On 03.06.2024 21:12, Nicola Vetrini wrote: On 2024-06-03 20:52, Jan Beulich wrote: On 03.06.2024 09:13, Nicola Vetrini wrote: On 2024-06-03 07:58, Jan Beulich wrote: On 01.06.2024 12:16, Nicola Vetrini wrote: --- a/automation/eclair_analysis/ECLAIR

Re: [XEN PATCH] automation/eclair_analysis: add more clean MISRA guidelines

2024-06-04 Thread Nicola Vetrini
On 2024-06-04 13:39, Oleksii K. wrote: On Sat, 2024-06-01 at 21:13 +0200, Nicola Vetrini wrote: Rules 20.9, 20.12 and 14.4 are now clean on ARM and x86, so they are added to the list of clean guidelines. Some guidelines listed in the additional clean section for ARM are also clean on x86, so

Re: [XEN PATCH 3/5] x86: deviate violation of MISRA C Rule 20.12

2024-06-07 Thread Nicola Vetrini
On 2024-06-04 08:08, Jan Beulich wrote: On 01.06.2024 12:16, Nicola Vetrini wrote: --- a/xen/arch/x86/include/asm/shared.h +++ b/xen/arch/x86/include/asm/shared.h @@ -76,6 +76,7 @@ static inline void arch_set_##field(struct vcpu *v, \ GET_SET_SHARED(unsigned long, max_pfn

[XEN PATCH for-4.19 v2 3/3] automation/eclair_analysis: add more clean MISRA guidelines

2024-06-07 Thread Nicola Vetrini
Rules 20.9, 20.12 and 14.4 are now clean on ARM and x86, so they are added to the list of clean guidelines. Some guidelines listed in the additional clean section for ARM are also clean on x86, so they can be removed from there. No functional change. Signed-off-by: Nicola Vetrini

[XEN PATCH for-4.19 v2 0/3] address remaining violations of Rule 20.12

2024-06-07 Thread Nicola Vetrini
patches. Nicola Vetrini (3): x86/domain: deviate violation of MISRA C Rule 20.12 automation/eclair_analysis: address remaining violations of MISRA C Rule 20.12 automation/eclair_analysis: add more clean MISRA guidelines automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++ automation

[XEN PATCH for-4.19 v2 2/3] automation/eclair_analysis: address remaining violations of MISRA C Rule 20.12

2024-06-07 Thread Nicola Vetrini
change. Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++ 1 file changed, 6 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index 447c1e6661d1..e2653f77eb2c 100644 --- a

[XEN PATCH for-4.19 v2 1/3] x86/domain: deviate violation of MISRA C Rule 20.12

2024-06-07 Thread Nicola Vetrini
ular macro argument and as an operand for stringification in the expansion of CHECK_FIELD_. This is deviated using a SAF-x-safe comment. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- docs/misra/safe.json | 8 xen/arch/x86/domain.c | 1 + xen/arch/x86/domctl.

Re: [XEN PATCH for-4.19 v2 3/3] automation/eclair_analysis: add more clean MISRA guidelines

2024-06-10 Thread Nicola Vetrini
On 2024-06-10 09:43, Jan Beulich wrote: On 07.06.2024 22:13, Nicola Vetrini wrote: Rules 20.9, 20.12 and 14.4 are now clean on ARM and x86, so they are added to the list of clean guidelines. Why is 20.9 being mentioned here when ... --- a/automation/eclair_analysis/ECLAIR/tagging.ecl +++ b

[XEN PATCH 1/6] automation/eclair: address violations of MISRA C Rule 20.7

2024-06-11 Thread Nicola Vetrini
he risk of misuse due developer confusion is deemed not substantial enough to warrant a more involved refactor, thus the macro is deviated for this rule. No functional change. Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 8 1 file changed, 8 insertion

[XEN PATCH 0/6] address several violations of MISRA Rule 20.7

2024-06-11 Thread Nicola Vetrini
here. [1] https://lore.kernel.org/xen-devel/2f2c865f20d0296e623f1d65bed25c083f5dd497.1711700095.git.nicola.vetr...@bugseng.com/ Nicola Vetrini (6): automation/eclair: address violations of MISRA C Rule 20.7 xen/self-tests: address violations of MISRA rule 20.7 xen/guest_access: address

[XEN PATCH 2/6] xen/self-tests: address violations of MISRA rule 20.7

2024-06-11 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- In this case the use of parentheses can detect misuses of the COMPILE_CHECK macro for the fn argument that happen to pass the compile-time check (see e.g. https://godbolt.org/z

[XEN PATCH 4/6] x86emul: address violations of MISRA C Rule 20.7

2024-06-11 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- These local helpers could in principle be deviated, but the readability and functionality are essentially unchanged by complying with the rule, so I decided to modify the macro def

[XEN PATCH 5/6] x86/irq: address violations of MISRA C Rule 20.7

2024-06-11 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- Note that the rule does not apply to f because that parameter is not used as an expression in the macro, but rather as an identifier. --- xen/include/xen/irq.h | 2 +- 1 file

[XEN PATCH 6/6] automation/eclair_analysis: clean ECLAIR configuration scripts

2024-06-11 Thread Nicola Vetrini
Remove from the ECLAIR integration scripts an unused option, which was already ignored, and make the help texts consistent with the rest of the scripts. No functional change. Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/analyze.sh | 3 +-- 1 file changed, 1 insertion

[XEN PATCH 3/6] xen/guest_access: address violations of MISRA rule 20.7

2024-06-11 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- xen/include/xen/guest_access.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/xen/guest_access.h b/xen/include/xen/guest_access.h index af

Re: [XEN PATCH 4/6] x86emul: address violations of MISRA C Rule 20.7

2024-06-12 Thread Nicola Vetrini
On 2024-06-12 11:19, Jan Beulich wrote: On 11.06.2024 17:53, Nicola Vetrini wrote: MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure

Re: [XEN PATCH 4/6] x86emul: address violations of MISRA C Rule 20.7

2024-06-13 Thread Nicola Vetrini
On 2024-06-12 12:36, Jan Beulich wrote: On 12.06.2024 11:52, Nicola Vetrini wrote: On 2024-06-12 11:19, Jan Beulich wrote: On 11.06.2024 17:53, Nicola Vetrini wrote: MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parent

[XEN PATCH v2 2/6][RESEND] xen/self-tests: address violations of MISRA rule 20.7

2024-06-17 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Jan Beulich --- In this case the use of parentheses can detect misuses of the COMPILE_CHECK macro for the fn argument that happen to pass the compile-time check (see

[XEN PATCH v2 3/6][RESEND] xen/guest_access: address violations of MISRA rule 20.7

2024-06-17 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/include/xen/guest_access.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/xen/guest_access.h b/xen/include/xen/gues

[XEN PATCH v2 4/6][RESEND] automation/eclair_analysis: address violations of MISRA C Rule 20.7

2024-06-17 Thread Nicola Vetrini
ause it is very unlikely to induce developer confusion and result in the wrong control flow being carried out. No functional change. Signed-off-by: Nicola Vetrini --- Changes in v2: - Introduce a deviation instead of adding parentheses --- automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++

[XEN PATCH v2 6/6][RESEND] automation/eclair_analysis: clean ECLAIR configuration scripts

2024-06-17 Thread Nicola Vetrini
Remove from the ECLAIR integration scripts an unused option, which was already ignored, and make the help texts consistent with the rest of the scripts. No functional change. Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/analyze.sh | 3 +-- 1 file changed, 1 insertion

[XEN PATCH v2 5/6][RESEND] x86/irq: address violations of MISRA C Rule 20.7

2024-06-17 Thread Nicola Vetrini
n possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- Note that the rule does not apply to f because that parameter is not used as an expression in the macro, but rather as an identifier. --- xen/include/xen

[XEN PATCH v2 0/6][RESEND] address violations of MISRA C Rule 20.7

2024-06-17 Thread Nicola Vetrini
Nicola Vetrini (6): automation/eclair: address violations of MISRA C Rule 20.7 xen/self-tests: address violations of MISRA rule 20.7 xen/guest_access: address violations of MISRA rule 20.7 automation/eclair_analysis: address violations of MISRA C Rule 20.7 x86/irq: address violations of

[XEN PATCH v2 1/6][RESEND] automation/eclair: address violations of MISRA C Rule 20.7

2024-06-17 Thread Nicola Vetrini
he risk of misuse due developer confusion is deemed not substantial enough to warrant a more involved refactor, thus the macro is deviated for this rule. No functional change. Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 8 1 file changed, 8 insertion

MISRA C Rule 5.3 violation - shadowing in mctelem.c

2024-06-19 Thread Nicola Vetrini
nks, Nicola [1] https://saas.eclairit.com:3787/fs/var/local/eclair/XEN.ecdf/ECLAIR_normal/staging/X86_64-BUGSENG/latest/PROJECT.ecd;/by_service/MC3R1.R5.3.html -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: MISRA C Rule 5.3 violation - shadowing in mctelem.c

2024-06-20 Thread Nicola Vetrini
On 2024-06-19 15:42, Jan Beulich wrote: On 19.06.2024 15:23, Nicola Vetrini wrote: I was looking at the shadowing due to the struct identifier and the local variables "mctctl" in x86/cpu/mcheck/mctelem.c (see [1], the second report). This kind of shadowing seems very intentiona

  1   2   3   4   5   6   7   8   9   10   >