diff mbox series

[kvm-unit-tests] access: Split the reserved bit test for LA57

Message ID 163666439473.76718.7019768408374724345.stgit@bmoger-ubuntu (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] access: Split the reserved bit test for LA57 | expand

Commit Message

Babu Moger Nov. 11, 2021, 9:01 p.m. UTC
The test ./x86/access fails with a timeout when the system supports
LA57.

../tests/access
BUILD_HEAD=49934b5a
timeout -k 1s --foreground 180 /usr/local/bin/qemu-system-x86_64 --no-reboot
-nodefaults -device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4
-vnc none -serial stdio -device pci-testdev -machine accel=kvm
-kernel /tmp/tmp.X0UHRhah33 -smp 1 -cpu max # -initrd /tmp/tmp.4nqs81FZ5t
enabling apic
starting test

run
...........................................................................
...........................................................................
..................................................................
14008327 tests, 0 failures
starting 5-level paging test.

run
...........................................................................
...........................................................................
........................................
qemu-system-x86_64: terminating on signal 15 from pid 56169 (timeout)
FAIL access (timeout; duration=180)

The reason is, the test runs twice when LA57 is supported.
Once with 4-level paging and once with 5-level paging. It cannot complete
both these tests with default timeout of 180 seconds.

Fix the problem by splitting the test into two.
One for the 4-level paging and one for the 5-level paging.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
Note: Let me know if there is a better way to take care of this.

 x86/access.c      |   23 ++++++++++++++++-------
 x86/unittests.cfg |    6 ++++++
 2 files changed, 22 insertions(+), 7 deletions(-)

Comments

Paolo Bonzini Nov. 11, 2021, 9:03 p.m. UTC | #1
On 11/11/21 22:01, Babu Moger wrote:
> The test ./x86/access fails with a timeout when the system supports
> LA57.
> 
> ../tests/access
> BUILD_HEAD=49934b5a
> timeout -k 1s --foreground 180 /usr/local/bin/qemu-system-x86_64 --no-reboot
> -nodefaults -device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4
> -vnc none -serial stdio -device pci-testdev -machine accel=kvm
> -kernel /tmp/tmp.X0UHRhah33 -smp 1 -cpu max # -initrd /tmp/tmp.4nqs81FZ5t
> enabling apic
> starting test
> 
> run
> ...........................................................................
> ...........................................................................
> ..................................................................
> 14008327 tests, 0 failures
> starting 5-level paging test.
> 
> run
> ...........................................................................
> ...........................................................................
> ........................................
> qemu-system-x86_64: terminating on signal 15 from pid 56169 (timeout)
> FAIL access (timeout; duration=180)
> 
> The reason is, the test runs twice when LA57 is supported.
> Once with 4-level paging and once with 5-level paging. It cannot complete
> both these tests with default timeout of 180 seconds.
> 
> Fix the problem by splitting the test into two.
> One for the 4-level paging and one for the 5-level paging.
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> Note: Let me know if there is a better way to take care of this.

Aaron Lewis posted a series to separate the main() from everything else, 
so we can create two .c files for 4-level and 5-level page tables.

Paolo

> 
>   x86/access.c      |   23 ++++++++++++++++-------
>   x86/unittests.cfg |    6 ++++++
>   2 files changed, 22 insertions(+), 7 deletions(-)
> 
> diff --git a/x86/access.c b/x86/access.c
> index 4725bbd..d25066a 100644
> --- a/x86/access.c
> +++ b/x86/access.c
> @@ -1141,19 +1141,28 @@ static int ac_test_run(void)
>       return successes == tests;
>   }
>   
> -int main(void)
> +int main(int argc, char *argv[])
>   {
> -    int r;
> -
> -    printf("starting test\n\n");
> -    page_table_levels = 4;
> -    r = ac_test_run();
> +    int r, la57;
> +
> +    if ((argc == 2) && (strcmp(argv[1], "la57") == 0)) {
> +        if (this_cpu_has(X86_FEATURE_LA57))
> +            la57 = 1;
> +        else {
> +            report_skip("5-level paging not supported, skip...");
> +            return report_summary();
> +        }
> +    }
>   
> -    if (this_cpu_has(X86_FEATURE_LA57)) {
> +    if (la57) {
>           page_table_levels = 5;
>           printf("starting 5-level paging test.\n\n");
>           setup_5level_page_table();
>           r = ac_test_run();
> +    } else {
> +        page_table_levels = 4;
> +        printf("starting test.\n\n");
> +        r = ac_test_run();
>       }
>   
>       return r ? 0 : 1;
> diff --git a/x86/unittests.cfg b/x86/unittests.cfg
> index 3000e53..475fcc6 100644
> --- a/x86/unittests.cfg
> +++ b/x86/unittests.cfg
> @@ -119,6 +119,12 @@ arch = x86_64
>   extra_params = -cpu max
>   timeout = 180
>   
> +[access-la57]
> +file = access.flat
> +arch = x86_64
> +extra_params = -cpu max -append "la57"
> +timeout = 180
> +
>   [access-reduced-maxphyaddr]
>   file = access.flat
>   arch = x86_64
> 
> 
>
Babu Moger Nov. 11, 2021, 9:15 p.m. UTC | #2
On 11/11/21 3:03 PM, Paolo Bonzini wrote:
> On 11/11/21 22:01, Babu Moger wrote:
>> The test ./x86/access fails with a timeout when the system supports
>> LA57.
>>
>> ../tests/access
>> BUILD_HEAD=49934b5a
>> timeout -k 1s --foreground 180 /usr/local/bin/qemu-system-x86_64
>> --no-reboot
>> -nodefaults -device pc-testdev -device
>> isa-debug-exit,iobase=0xf4,iosize=0x4
>> -vnc none -serial stdio -device pci-testdev -machine accel=kvm
>> -kernel /tmp/tmp.X0UHRhah33 -smp 1 -cpu max # -initrd /tmp/tmp.4nqs81FZ5t
>> enabling apic
>> starting test
>>
>> run
>> ...........................................................................
>>
>> ...........................................................................
>>
>> ..................................................................
>> 14008327 tests, 0 failures
>> starting 5-level paging test.
>>
>> run
>> ...........................................................................
>>
>> ...........................................................................
>>
>> ........................................
>> qemu-system-x86_64: terminating on signal 15 from pid 56169 (timeout)
>> FAIL access (timeout; duration=180)
>>
>> The reason is, the test runs twice when LA57 is supported.
>> Once with 4-level paging and once with 5-level paging. It cannot complete
>> both these tests with default timeout of 180 seconds.
>>
>> Fix the problem by splitting the test into two.
>> One for the 4-level paging and one for the 5-level paging.
>>
>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>> ---
>> Note: Let me know if there is a better way to take care of this.
>
> Aaron Lewis posted a series to separate the main() from everything else,
> so we can create two .c files for 4-level and 5-level page tables.

Ok. Sure. I will check on that. May be I will send the patches once
Aaron's patches are merged.

Also one more thing, we are running pretty close on each of these tests.
Each of these tests run about 150 seconds. Very soon we may need to reduce
number of reserved bit combinations.

I looked at it little bit but have not found better way yet.  

Thanks

>
> Paolo
>
>>
>>   x86/access.c      |   23 ++++++++++++++++-------
>>   x86/unittests.cfg |    6 ++++++
>>   2 files changed, 22 insertions(+), 7 deletions(-)
>>
>> diff --git a/x86/access.c b/x86/access.c
>> index 4725bbd..d25066a 100644
>> --- a/x86/access.c
>> +++ b/x86/access.c
>> @@ -1141,19 +1141,28 @@ static int ac_test_run(void)
>>       return successes == tests;
>>   }
>>   -int main(void)
>> +int main(int argc, char *argv[])
>>   {
>> -    int r;
>> -
>> -    printf("starting test\n\n");
>> -    page_table_levels = 4;
>> -    r = ac_test_run();
>> +    int r, la57;
>> +
>> +    if ((argc == 2) && (strcmp(argv[1], "la57") == 0)) {
>> +        if (this_cpu_has(X86_FEATURE_LA57))
>> +            la57 = 1;
>> +        else {
>> +            report_skip("5-level paging not supported, skip...");
>> +            return report_summary();
>> +        }
>> +    }
>>   -    if (this_cpu_has(X86_FEATURE_LA57)) {
>> +    if (la57) {
>>           page_table_levels = 5;
>>           printf("starting 5-level paging test.\n\n");
>>           setup_5level_page_table();
>>           r = ac_test_run();
>> +    } else {
>> +        page_table_levels = 4;
>> +        printf("starting test.\n\n");
>> +        r = ac_test_run();
>>       }
>>         return r ? 0 : 1;
>> diff --git a/x86/unittests.cfg b/x86/unittests.cfg
>> index 3000e53..475fcc6 100644
>> --- a/x86/unittests.cfg
>> +++ b/x86/unittests.cfg
>> @@ -119,6 +119,12 @@ arch = x86_64
>>   extra_params = -cpu max
>>   timeout = 180
>>   +[access-la57]
>> +file = access.flat
>> +arch = x86_64
>> +extra_params = -cpu max -append "la57"
>> +timeout = 180
>> +
>>   [access-reduced-maxphyaddr]
>>   file = access.flat
>>   arch = x86_64
>>
>>
>>
>
diff mbox series

Patch

diff --git a/x86/access.c b/x86/access.c
index 4725bbd..d25066a 100644
--- a/x86/access.c
+++ b/x86/access.c
@@ -1141,19 +1141,28 @@  static int ac_test_run(void)
     return successes == tests;
 }
 
-int main(void)
+int main(int argc, char *argv[])
 {
-    int r;
-
-    printf("starting test\n\n");
-    page_table_levels = 4;
-    r = ac_test_run();
+    int r, la57;
+
+    if ((argc == 2) && (strcmp(argv[1], "la57") == 0)) {
+        if (this_cpu_has(X86_FEATURE_LA57))
+            la57 = 1;
+        else {
+            report_skip("5-level paging not supported, skip...");
+            return report_summary();
+        }
+    }
 
-    if (this_cpu_has(X86_FEATURE_LA57)) {
+    if (la57) {
         page_table_levels = 5;
         printf("starting 5-level paging test.\n\n");
         setup_5level_page_table();
         r = ac_test_run();
+    } else {
+        page_table_levels = 4;
+        printf("starting test.\n\n");
+        r = ac_test_run();
     }
 
     return r ? 0 : 1;
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index 3000e53..475fcc6 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -119,6 +119,12 @@  arch = x86_64
 extra_params = -cpu max
 timeout = 180
 
+[access-la57]
+file = access.flat
+arch = x86_64
+extra_params = -cpu max -append "la57"
+timeout = 180
+
 [access-reduced-maxphyaddr]
 file = access.flat
 arch = x86_64