[PATCH v4 5/8] x86/emul: Make condition coverage warning non-fatal

Andrew Cooper posted 8 patches 1 day, 15 hours ago
[PATCH v4 5/8] x86/emul: Make condition coverage warning non-fatal
Posted by Andrew Cooper 1 day, 15 hours ago
Randconfig with GCC-14 (Debian Trixie) found:

  In file included from arch/x86/x86_emulate/x86_emulate.c:11,
                   from arch/x86/x86_emulate.c:27:
  arch/x86/x86_emulate/x86_emulate.c: In function 'x86_emulate':
  arch/x86/x86_emulate/private.h:482:8: error: Too many conditions (found 826); giving up coverage [-Werror=coverage-too-many-conditions]
    482 | ({  if ( (p) ) {                                                          \
        |        ^
  arch/x86/x86_emulate/x86_emulate.c:1283:5: note: in expansion of macro 'generate_exception_if'
   1283 |     generate_exception_if((mode_vif() &&
        |     ^~~~~~~~~~~~~~~~~~~~~

which is a consequence of having a new enough compiler to allow
CONFIG_CONDITIONAL_COVERAGE in to the mix.

In the short term make warning non-fatal.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Anthony PERARD <anthony.perard@vates.tech>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Julien Grall <julien@xen.org>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Volodymyr Babchuk <volodymyr_babchuk@epam.com>

v4:
 * New

Full failure logs:
  https://gitlab.com/xen-project/hardware/xen-staging/-/jobs/11331286819
---
 xen/arch/x86/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index d7aed7d92c15..a0bba5d9085e 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -98,6 +98,9 @@ $(obj)/usercopy.o: CFLAGS-y += -iquote .
 ifneq ($(CONFIG_HVM),y)
 $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif
+ifneq ($(CONFIG_CONDITION_COVERAGE),y)
+$(obj)/x86_emulate.o: CFLAGS-y += $(call cc-option,$(CC),-Wno-error=coverage-too-many-conditions)
+endif
 
 efi-y := $(shell if [ ! -r $(objtree)/include/xen/compile.h -o \
                       -O $(objtree)/include/xen/compile.h ]; then \
-- 
2.39.5


Re: [PATCH v4 5/8] x86/emul: Make condition coverage warning non-fatal
Posted by Andrew Cooper 1 day, 8 hours ago
On 12/09/2025 3:44 pm, Andrew Cooper wrote:
> Randconfig with GCC-14 (Debian Trixie) found:
>
>   In file included from arch/x86/x86_emulate/x86_emulate.c:11,
>                    from arch/x86/x86_emulate.c:27:
>   arch/x86/x86_emulate/x86_emulate.c: In function 'x86_emulate':
>   arch/x86/x86_emulate/private.h:482:8: error: Too many conditions (found 826); giving up coverage [-Werror=coverage-too-many-conditions]
>     482 | ({  if ( (p) ) {                                                          \
>         |        ^
>   arch/x86/x86_emulate/x86_emulate.c:1283:5: note: in expansion of macro 'generate_exception_if'
>    1283 |     generate_exception_if((mode_vif() &&
>         |     ^~~~~~~~~~~~~~~~~~~~~
>
> which is a consequence of having a new enough compiler to allow
> CONFIG_CONDITIONAL_COVERAGE in to the mix.
>
> In the short term make warning non-fatal.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Anthony PERARD <anthony.perard@vates.tech>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Julien Grall <julien@xen.org>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
>
> v4:
>  * New
>
> Full failure logs:
>   https://gitlab.com/xen-project/hardware/xen-staging/-/jobs/11331286819
> ---
>  xen/arch/x86/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
> index d7aed7d92c15..a0bba5d9085e 100644
> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -98,6 +98,9 @@ $(obj)/usercopy.o: CFLAGS-y += -iquote .
>  ifneq ($(CONFIG_HVM),y)
>  $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
>  endif
> +ifneq ($(CONFIG_CONDITION_COVERAGE),y)
> +$(obj)/x86_emulate.o: CFLAGS-y += $(call cc-option,$(CC),-Wno-error=coverage-too-many-conditions)
> +endif

This should be ifeq, not ifneq.  It's probably safe to drop the
cc-option too, as that limits it to compilers which know
-fcondition-coverage

~Andrew

Re: [PATCH v4 5/8] x86/emul: Make condition coverage warning non-fatal
Posted by dmukhin@xen.org 1 day, 10 hours ago
On Fri, Sep 12, 2025 at 03:44:24PM +0100, Andrew Cooper wrote:
> Randconfig with GCC-14 (Debian Trixie) found:
> 
>   In file included from arch/x86/x86_emulate/x86_emulate.c:11,
>                    from arch/x86/x86_emulate.c:27:
>   arch/x86/x86_emulate/x86_emulate.c: In function 'x86_emulate':
>   arch/x86/x86_emulate/private.h:482:8: error: Too many conditions (found 826); giving up coverage [-Werror=coverage-too-many-conditions]
>     482 | ({  if ( (p) ) {                                                          \
>         |        ^
>   arch/x86/x86_emulate/x86_emulate.c:1283:5: note: in expansion of macro 'generate_exception_if'
>    1283 |     generate_exception_if((mode_vif() &&
>         |     ^~~~~~~~~~~~~~~~~~~~~
> 
> which is a consequence of having a new enough compiler to allow
> CONFIG_CONDITIONAL_COVERAGE in to the mix.
> 
> In the short term make warning non-fatal.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Denis Mukhin <dmukhin@ford.com>