All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] x86emul: address MISRA R2.6 in CONFIG_HVM=n builds
@ 2026-11-10  7:12 Shuaidong Chen
  2026-11-10  7:12 ` [RFC PATCH 1/2] x86emul: mark the trimmed emulator's section-internal labels maybe-unused Shuaidong Chen
  2026-11-10  7:12 ` [RFC PATCH 2/2] misra: deviate R2.6 for the labels generated by CASE_SIMD_* Shuaidong Chen
  0 siblings, 2 replies; 7+ messages in thread
From: Shuaidong Chen @ 2026-11-10  7:12 UTC (permalink / raw)
  To: xen-devel
  Cc: Jan Beulich, Andrew Cooper, Roger Pau Monné,
	Stefano Stabellini, Nicola Vetrini, Doug Goldstein, Michal Orzel,
	Julien Grall, Anthony PERARD, Teddy Astie, Dmytro Prokopchuk,
	Grygorii Strashko, Penny Zheng, Ray Huang, Shuaidong Chen

With CONFIG_HVM=n, private.h defines X86EMUL_NO_FPU, X86EMUL_NO_MMX
and X86EMUL_NO_SIMD, and x86_emulate.c is left with 91 unused labels,
which ECLAIR reports under MISRA C:2012 Rule 2.6 (advisory).  The
ECLAIR jobs in automation/gitlab-ci/analyze.yaml all build with
CONFIG_HVM=y, so upstream's scans don't show them today; they surfaced
while analysing an HVM-less x86 configuration.

The 91 labels split in two groups:

- 9 hand-written simd_* labels whose gotos are all preprocessed out.
  Patch 1 marks them __maybe_unused, which the existing R2.6
  deviation already covers.  No functional change: the code and data
  sections of x86_emulate.o are unchanged.

- 82 labels produced by the CASE_SIMD_* macros, which deliberately
  expand to plain labels instead of case labels in this configuration.
  ECLAIR reports them at the macro use site, so they cannot be
  annotated in the source.  Patch 2 extends the R2.6 deviation to
  them.

Reproduced on current master with clang -Wunused-label on a
CONFIG_HVM=n build: 91 unused labels without the series, 82 (all
CASE_SIMD_*) with patch 1.  ECLAIR on an HVM-less x86 configuration:
before: https://gitlab.com/xen-project/people/amd/xen/-/jobs/17763605066
after:  https://gitlab.com/xen-project/people/amd/xen/-/jobs/17764580898

Sent as RFC for patch 2, a new deviation for reports upstream doesn't
currently see:
- Is extending the R2.6 deviation acceptable here?
- Alternatives considered: folding the ':' into the macros still
  leaves the labels in place; expanding the macros to nothing makes
  the code behind them unreachable (Rule 2.1, required).
- Would an ECLAIR job for a CONFIG_HVM=n configuration be welcome?

Shuaidong Chen (2):
  x86emul: mark the trimmed emulator's section-internal labels
    maybe-unused
  misra: deviate R2.6 for the labels generated by CASE_SIMD_*

 .../eclair_analysis/ECLAIR/deviations.ecl      |  4 +++-
 docs/misra/deviations.rst                      |  9 +++++++++
 xen/arch/x86/x86_emulate/x86_emulate.c         | 18 +++++++++---------
 3 files changed, 21 insertions(+), 10 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-10 13:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10  7:12 [RFC PATCH 0/2] x86emul: address MISRA R2.6 in CONFIG_HVM=n builds Shuaidong Chen
2026-11-10  7:12 ` [RFC PATCH 1/2] x86emul: mark the trimmed emulator's section-internal labels maybe-unused Shuaidong Chen
2026-11-10  9:30   ` Jan Beulich
2026-11-10 13:05     ` Chen, Shuaidong
2026-11-10  7:12 ` [RFC PATCH 2/2] misra: deviate R2.6 for the labels generated by CASE_SIMD_* Shuaidong Chen
2026-11-10  9:41   ` Jan Beulich
2026-11-10 13:09     ` Chen, Shuaidong

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.