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

[RFC PATCH 0/2] x86emul: address MISRA R2.6 in CONFIG_HVM=n builds


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Shuaidong Chen <shuaidong.chen@xxxxxxx>
  • Date: Tue, 10 Nov 2026 15:12:29 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=lS4YaiSLDsQ4dKUlA8GrxsQ8fVuUXXvyhSkID1NItz4=; b=GEeKKEGMmQ2411dx/AJUSIoPtrpiWhRx11/QPBfB+zFnhqfx43U0l68ZMCp4nCCVzKAc8HU75KnKdrzDc7OvKtPMlzrLDJpdXTgNw1XlcpB2yTpL6eLZ0Jg2qroKsZyoIXoza/WhvzU/U9+VM/K6amqaNNRGhmY6YsrvboKiJlpL33Ek+zJ5PDngbUF3h0mtrgLOIEAsoUOvBxCXfb9PaFbUUhWZ5T3utL5x/LpqYqLAgHAD0HhrkmPJRE8vlgF6GSgQOznltwh4QG/9psdveiN/i23oRbzL3ydE/zrBoPjdElDMzlE6OLMdGV347pS4OWSax+U2nSf+kfoxevGjYg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oxcA/9RL4WZIvrcMlJqYI+NLv5oyCmabtQcZuLMYsHN6wosLMQ+wXxlF9wNWuAHAHfvfy5jsMMx+h6kpt5pXN3LbwMt1GhAwTcR6ztzYvfaiRlLJk7k5vPeT3yZdihjU8uqWOvYpgnAxXc5onWEuY+JEESgMl7ER5u/6TaaqNh0eOrbRHZEBigSzq/IHa5xdO4Z0datEZDHx5uwhz7AAcT8vnkpjvjE6Em038k8+45eziJyRt512vmRDP5pKnXbADGPmzz/rEcIxhYLzfpne5GqEuEu70zZZqqA110ryLRmvJ2t9TmOLbPl+SGsYJUfVMqytibHBWrajelz45BfqlQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Nicola Vetrini" <nicola.vetrini@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, "Anthony PERARD" <anthony.perard@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>, Grygorii Strashko <grygorii_strashko@xxxxxxxx>, Penny Zheng <penny.zheng@xxxxxxx>, Ray Huang <Ray.Huang@xxxxxxx>, Shuaidong Chen <shuaidong.chen@xxxxxxx>
  • Delivery-date: Tue, 10 Nov 2026 07:13:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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




 


Rackspace

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