diff mbox

[kvm-unit-tests,3/6] x86/pmu: expect failure with nmi_watchdog

Message ID 1450128261-21170-4-git-send-email-rkrcmar@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Radim Krčmář Dec. 14, 2015, 9:24 p.m. UTC
Host's nmi_watchdog takes one slot, making the "all counters" unit-test
fail.  We know exactly what happens, mark it as expected failure.

PMU test is now executed regardless of host_nmi_watchdog.

Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com>
---
 x86/pmu.c         | 9 ++++++++-
 x86/unittests.cfg | 3 +--
 2 files changed, 9 insertions(+), 3 deletions(-)

Comments

Andrew Jones Dec. 14, 2015, 10:05 p.m. UTC | #1
On Mon, Dec 14, 2015 at 10:24:18PM +0100, Radim Kr?má? wrote:
> Host's nmi_watchdog takes one slot, making the "all counters" unit-test
> fail.  We know exactly what happens, mark it as expected failure.
> 
> PMU test is now executed regardless of host_nmi_watchdog.
> 
> Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com>
> ---
>  x86/pmu.c         | 9 ++++++++-
>  x86/unittests.cfg | 3 +--
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/x86/pmu.c b/x86/pmu.c
> index c68980044dee..4ca93235b977 100644
> --- a/x86/pmu.c
> +++ b/x86/pmu.c
> @@ -92,6 +92,7 @@ struct pmu_event {
>  };
>  
>  static int num_counters;
> +bool host_nmi_watchdog;
>  
>  char *buf;
>  
> @@ -291,7 +292,7 @@ static void check_counters_many(void)
>  		if (!verify_counter(&cnt[i]))
>  			break;
>  
> -	report("all counters", i == n);
> +	report_xfail("all counters", host_nmi_watchdog, i == n);

How about outputting "host_nmi_watchdog=%d" as well?

>  }
>  
>  static void check_counter_overflow(void)
> @@ -374,6 +375,7 @@ static void check_rdpmc(void)
>  
>  int main(int ac, char **av)
>  {
> +	int i;
>  	struct cpuid id = cpuid(10);
>  
>  	setup_vm();
> @@ -385,6 +387,11 @@ int main(int ac, char **av)
>  	ebx.full = id.b;
>  	edx.full = id.d;
>  
> +	/* XXX: horrible command line parsing */
> +	for (i = 1; i < ac; i++)
> +		if (!strcmp(av[i], "host_nmi_watchdog=1"))
> +			host_nmi_watchdog = true;
> +
>  	if (!eax.split.version_id) {
>  		printf("No pmu is detected!\n");
>  		return report_summary();
> diff --git a/x86/unittests.cfg b/x86/unittests.cfg
> index ffffc15c86df..6b94ad93dcf0 100644
> --- a/x86/unittests.cfg
> +++ b/x86/unittests.cfg
> @@ -106,8 +106,7 @@ file = msr.flat
>  
>  [pmu]
>  file = pmu.flat
> -extra_params = -cpu host
> -check = /proc/sys/kernel/nmi_watchdog=0
> +extra_params = -cpu host -append "host_nmi_watchdog=`cat /proc/sys/kernel/nmi_watchdog`"
>  
>  [port80]
>  file = port80.flat
> -- 
> 2.6.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Radim Krčmář Dec. 15, 2015, 1:01 p.m. UTC | #2
2015-12-14 16:05-0600, Andrew Jones:
> On Mon, Dec 14, 2015 at 10:24:18PM +0100, Radim Kr?má? wrote:
>> diff --git a/x86/pmu.c b/x86/pmu.c
>> @@ -291,7 +292,7 @@ static void check_counters_many(void)
>>  		if (!verify_counter(&cnt[i]))
>>  			break;
>>  
>> -	report("all counters", i == n);
>> +	report_xfail("all counters", host_nmi_watchdog, i == n);
> 
> How about outputting "host_nmi_watchdog=%d" as well?

It's already implied in the output.  Prefix will be XPASS/XFAIL if
host_nmi_watchdog=1 and PASS/FAIL otherwise.

Should it still be explicitly printed?
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Jones Dec. 15, 2015, 3:33 p.m. UTC | #3
On Tue, Dec 15, 2015 at 02:01:01PM +0100, Radim Kr?má? wrote:
> 2015-12-14 16:05-0600, Andrew Jones:
> > On Mon, Dec 14, 2015 at 10:24:18PM +0100, Radim Kr?má? wrote:
> >> diff --git a/x86/pmu.c b/x86/pmu.c
> >> @@ -291,7 +292,7 @@ static void check_counters_many(void)
> >>  		if (!verify_counter(&cnt[i]))
> >>  			break;
> >>  
> >> -	report("all counters", i == n);
> >> +	report_xfail("all counters", host_nmi_watchdog, i == n);
> > 
> > How about outputting "host_nmi_watchdog=%d" as well?
> 
> It's already implied in the output.  Prefix will be XPASS/XFAIL if
> host_nmi_watchdog=1 and PASS/FAIL otherwise.
> 
> Should it still be explicitly printed?

I think it could help interpret the results without needing to read
the code, but these types of tests generally require reading the
code...

drew

> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/x86/pmu.c b/x86/pmu.c
index c68980044dee..4ca93235b977 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -92,6 +92,7 @@  struct pmu_event {
 };
 
 static int num_counters;
+bool host_nmi_watchdog;
 
 char *buf;
 
@@ -291,7 +292,7 @@  static void check_counters_many(void)
 		if (!verify_counter(&cnt[i]))
 			break;
 
-	report("all counters", i == n);
+	report_xfail("all counters", host_nmi_watchdog, i == n);
 }
 
 static void check_counter_overflow(void)
@@ -374,6 +375,7 @@  static void check_rdpmc(void)
 
 int main(int ac, char **av)
 {
+	int i;
 	struct cpuid id = cpuid(10);
 
 	setup_vm();
@@ -385,6 +387,11 @@  int main(int ac, char **av)
 	ebx.full = id.b;
 	edx.full = id.d;
 
+	/* XXX: horrible command line parsing */
+	for (i = 1; i < ac; i++)
+		if (!strcmp(av[i], "host_nmi_watchdog=1"))
+			host_nmi_watchdog = true;
+
 	if (!eax.split.version_id) {
 		printf("No pmu is detected!\n");
 		return report_summary();
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index ffffc15c86df..6b94ad93dcf0 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -106,8 +106,7 @@  file = msr.flat
 
 [pmu]
 file = pmu.flat
-extra_params = -cpu host
-check = /proc/sys/kernel/nmi_watchdog=0
+extra_params = -cpu host -append "host_nmi_watchdog=`cat /proc/sys/kernel/nmi_watchdog`"
 
 [port80]
 file = port80.flat