diff mbox series

[kvm-unit-tests] x86: Fix test failures as a result of using clang-18

Message ID 20221129203240.1815829-1-aaronlewis@google.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] x86: Fix test failures as a result of using clang-18 | expand

Commit Message

Aaron Lewis Nov. 29, 2022, 8:32 p.m. UTC
When building 'debug' test on clang-18 the compiler more aggressively
inlines helper functions.  This results in test failures because some
of the helpers are not intended to be inlined.  Fix this by marking
those functions with 'noinline'.

Reported-by: John Sperbeck <jsperbeck@google.com>
Signed-off-by: Aaron Lewis <aaronlewis@google.com>
---
 x86/debug.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Paolo Bonzini Nov. 30, 2022, 1:56 p.m. UTC | #1
Queued, thanks.

Paolo

On Tue, Nov 29, 2022 at 9:33 PM Aaron Lewis <aaronlewis@google.com> wrote:
>
> When building 'debug' test on clang-18 the compiler more aggressively
> inlines helper functions.  This results in test failures because some
> of the helpers are not intended to be inlined.  Fix this by marking
> those functions with 'noinline'.
>
> Reported-by: John Sperbeck <jsperbeck@google.com>
> Signed-off-by: Aaron Lewis <aaronlewis@google.com>
> ---
>  x86/debug.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/x86/debug.c b/x86/debug.c
> index b66bf04..65784c5 100644
> --- a/x86/debug.c
> +++ b/x86/debug.c
> @@ -128,7 +128,7 @@ static void report_singlestep_basic(unsigned long start, const char *usermode)
>                "%sSingle-step #DB basic test", usermode);
>  }
>
> -static unsigned long singlestep_basic(void)
> +static noinline unsigned long singlestep_basic(void)
>  {
>         unsigned long start;
>
> @@ -165,7 +165,7 @@ static void report_singlestep_emulated_instructions(unsigned long start,
>                "%sSingle-step #DB on emulated instructions", usermode);
>  }
>
> -static unsigned long singlestep_emulated_instructions(void)
> +static noinline unsigned long singlestep_emulated_instructions(void)
>  {
>         unsigned long start;
>
> @@ -204,7 +204,7 @@ static void report_singlestep_with_sti_blocking(unsigned long start,
>  }
>
>
> -static unsigned long singlestep_with_sti_blocking(void)
> +static noinline unsigned long singlestep_with_sti_blocking(void)
>  {
>         unsigned long start_rip;
>
> @@ -239,7 +239,7 @@ static void report_singlestep_with_movss_blocking(unsigned long start,
>                "%sSingle-step #DB w/ MOVSS blocking", usermode);
>  }
>
> -static unsigned long singlestep_with_movss_blocking(void)
> +static noinline unsigned long singlestep_with_movss_blocking(void)
>  {
>         unsigned long start_rip;
>
> @@ -277,7 +277,7 @@ static void report_singlestep_with_movss_blocking_and_icebp(unsigned long start,
>                "%sSingle-Step + ICEBP #DB w/ MOVSS blocking", usermode);
>  }
>
> -static unsigned long singlestep_with_movss_blocking_and_icebp(void)
> +static noinline unsigned long singlestep_with_movss_blocking_and_icebp(void)
>  {
>         unsigned long start;
>
> @@ -320,7 +320,7 @@ static void report_singlestep_with_movss_blocking_and_dr7_gd(unsigned long start
>                "Single-step #DB w/ MOVSS blocking and DR7.GD=1");
>  }
>
> -static unsigned long singlestep_with_movss_blocking_and_dr7_gd(void)
> +static noinline unsigned long singlestep_with_movss_blocking_and_dr7_gd(void)
>  {
>         unsigned long start_rip;
>
> --
> 2.38.1.584.g0f3c55d4c2-goog
>
diff mbox series

Patch

diff --git a/x86/debug.c b/x86/debug.c
index b66bf04..65784c5 100644
--- a/x86/debug.c
+++ b/x86/debug.c
@@ -128,7 +128,7 @@  static void report_singlestep_basic(unsigned long start, const char *usermode)
 	       "%sSingle-step #DB basic test", usermode);
 }
 
-static unsigned long singlestep_basic(void)
+static noinline unsigned long singlestep_basic(void)
 {
 	unsigned long start;
 
@@ -165,7 +165,7 @@  static void report_singlestep_emulated_instructions(unsigned long start,
 	       "%sSingle-step #DB on emulated instructions", usermode);
 }
 
-static unsigned long singlestep_emulated_instructions(void)
+static noinline unsigned long singlestep_emulated_instructions(void)
 {
 	unsigned long start;
 
@@ -204,7 +204,7 @@  static void report_singlestep_with_sti_blocking(unsigned long start,
 }
 
 
-static unsigned long singlestep_with_sti_blocking(void)
+static noinline unsigned long singlestep_with_sti_blocking(void)
 {
 	unsigned long start_rip;
 
@@ -239,7 +239,7 @@  static void report_singlestep_with_movss_blocking(unsigned long start,
 	       "%sSingle-step #DB w/ MOVSS blocking", usermode);
 }
 
-static unsigned long singlestep_with_movss_blocking(void)
+static noinline unsigned long singlestep_with_movss_blocking(void)
 {
 	unsigned long start_rip;
 
@@ -277,7 +277,7 @@  static void report_singlestep_with_movss_blocking_and_icebp(unsigned long start,
 	       "%sSingle-Step + ICEBP #DB w/ MOVSS blocking", usermode);
 }
 
-static unsigned long singlestep_with_movss_blocking_and_icebp(void)
+static noinline unsigned long singlestep_with_movss_blocking_and_icebp(void)
 {
 	unsigned long start;
 
@@ -320,7 +320,7 @@  static void report_singlestep_with_movss_blocking_and_dr7_gd(unsigned long start
 	       "Single-step #DB w/ MOVSS blocking and DR7.GD=1");
 }
 
-static unsigned long singlestep_with_movss_blocking_and_dr7_gd(void)
+static noinline unsigned long singlestep_with_movss_blocking_and_dr7_gd(void)
 {
 	unsigned long start_rip;