kvm_pagefault01: Do not write into tdp_mmu sysfile
PATCH 1/1 kvm_pagefault01: Do not write into tdp_mmu sysfile
The tdp_mmu sysfile was made read-only in kernel v6.3. Do not modify it but only reload vendor KVM modules if needed. Some kernel versions before v6.3 have writable tdp_mmu sysfile which appears to be independent from vendor KVM module settings. Print a warning about false negatives if tdp_mmu appears enabled after reloading KVM modules. It is unclear if that state may impact bug reproducibility.
--- testcases/kernel/kvm/kvm_pagefault01.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
testcases/kernel/kvm/kvm_pagefault01.c +3 -10
@@ -193,16 +193,14 @@ static void reload_module(const char *module, char *arg)static void disable_tdp (void ) { -if (!access (TDP_MMU_SYSFILE ,F_OK )) { -/* FIXME: Is setting tdp_mmu=0 sufficient to disable TDP? */ -return ; - } -if (read_bool_sys_param (TDP_AMD_SYSFILE ) >0 )reload_module ("kvm_amd" ,"npt=0" );if (read_bool_sys_param (TDP_INTEL_SYSFILE ) >0 )reload_module ("kvm_intel" ,"ept=0" ); + +if (read_bool_sys_param (TDP_MMU_SYSFILE ) >0 ) +tst_res (TINFO ,"tdp_mmu is enabled, beware of false negatives" ); }static void setup (void )
@@ -216,11 +214,6 @@ static struct tst_test test = { .setup = setup, .cleanup = tst_kvm_cleanup, .needs_root = 1, - .save_restore = (const struct tst_path_val []) { - {"/sys/module/kvm/parameters/tdp_mmu" ,"0" , -TST_SR_SKIP_MISSING |TST_SR_TCONF_RO }, - {} - }, .supported_archs = (const char *const []) {"x86_64" ,NULL
Signature · 5 lines
2.44.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Martin,
Quoted 6 lines
The
tdp_mmusysfile was made read-only in kernel v6.3. Do not modify it but only reload vendor KVM modules if needed. Some kernel versions before v6.3 have writabletdp_mmusysfile which appears to be independent from vendor KVM module settings. Print a warning about false negatives iftdp_mmuappears enabled after reloading KVM modules. It is unclear if that state may impact bug reproducibility.
Good catch.
...
Quoted 5 lines
static void
disable_tdp(void)
{testcases/kernel/kvm/kvm_pagefault01.c +0
-3-if (!access (TDP_MMU_SYSFILE ,F_OK )) { -/* FIXME: Is setting tdp_mmu=0 sufficient to disable TDP? */ -return ;
testcases/kernel/kvm/kvm_pagefault01.c static void reload_module(const char *module, char *arg) · line 203
Quoted 10 lines
testcases/kernel/kvm/kvm_pagefault01.c +3
-2- } -if (read_bool_sys_param (TDP_AMD_SYSFILE ) >0 )reload_module ("kvm_amd" ,"npt=0" );if (read_bool_sys_param (TDP_INTEL_SYSFILE ) >0 )reload_module ("kvm_intel" ,"ept=0" ); + +if (read_bool_sys_param (TDP_MMU_SYSFILE ) >0 ) +tst_res (TINFO ,"tdp_mmu is enabled, beware of false negatives" );
Wouldn't it be better to add "WARNING:" to make it more visible?
tst_res(TINFO, "WARNING: tdp_mmu is enabled, beware of false negatives");
(if you agree, I can change it before merge)
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 8 lines · Petr Vorel
testcases/kernel/kvm/kvm_pagefault01.c static void reload_module(const char *module, char *arg) · line 203
Quoted 3 lines
testcases/kernel/kvm/kvm_pagefault01.c +3
-0+ +if (read_bool_sys_param (TDP_MMU_SYSFILE ) >0 ) +tst_res (TINFO ,"tdp_mmu is enabled, beware of false negatives" );Wouldn't it be better to add "WARNING:" to make it more visible?
tst_res(TINFO, "WARNING: tdp_mmu is enabled, beware of false negatives");(if you agree, I can change it before merge)
I thought about it for a while and I see good reasons for both TINFO and TWARN. It shouldn't matter for our tests because tdp_mmu defaults to off on SLE-15SP4 and SLE-15SP5. If other reviewers agree, feel free to change it to TWARN.
Signature · 11 lines
Martin Doucha [email protected] SW Quality Engineer SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 8 lines · Petr Vorel
Quoted 6 lines
testcases/kernel/kvm/kvm_pagefault01.c static void reload_module(const char *module, char *arg) · line 203
Quoted 3 lines
testcases/kernel/kvm/kvm_pagefault01.c +3
-0+ +if (read_bool_sys_param (TDP_MMU_SYSFILE ) >0 ) +tst_res (TINFO ,"tdp_mmu is enabled, beware of false negatives" );Wouldn't it be better to add "WARNING:" to make it more visible?
tst_res(TINFO, "WARNING: tdp_mmu is enabled, beware of false negatives");
Quoted 6 lines
Quoted 1 line
(if you agree, I can change it before merge)
I thought about it for a while and I see good reasons for both TINFO and TWARN. It shouldn't matter for our tests because
tdp_mmudefaults to off on SLE-15SP4 and SLE-15SP5. If other reviewers agree, feel free to change it to TWARN.
I slightly prefer tst_res(TINFO, "WARNING: ...", than TWARN. Although false negative is serious, still failing the test based on suspicion of false positives is not good.
@Li, @Jan, @Metan: any opinion on it?
Also, I send a patch to add TINFO_WARN flag (yeah, ugly name) to print TINFO but slightly more visible due the color.
https://patchwork.ozlabs.org/project/ltp/list/?series=408394&state=*
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 8 lines · Petr Vorel
Quoted 4 lines
I thought about it for a while and I see good reasons for both TINFO and TWARN. It shouldn't matter for our tests because
tdp_mmudefaults to off on SLE-15SP4 and SLE-15SP5. If other reviewers agree, feel free to change it to TWARN.I slightly prefer tst_res(TINFO, "WARNING: ...", than TWARN. Although false negative is serious, still failing the test based on suspicion of false positives is not good.
+1 to changing the TINFO message during merge.
Signature · 11 lines
Martin Doucha [email protected] SW Quality Engineer SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 16 lines · Petr Vorel
Quoted 9 lines · Petr Vorel
Quoted 6 lines
testcases/kernel/kvm/kvm_pagefault01.c static void reload_module(const char *module, char *arg) · line 203
Quoted 3 lines
testcases/kernel/kvm/kvm_pagefault01.c +3
-0+ +if (read_bool_sys_param (TDP_MMU_SYSFILE ) >0 ) +tst_res (TINFO ,"tdp_mmu is enabled, beware of false negatives" );Wouldn't it be better to add "WARNING:" to make it more visible?
tst_res(TINFO, "WARNING: tdp_mmu is enabled, beware of false negatives");Quoted 6 lines
Quoted 1 line
(if you agree, I can change it before merge)
I thought about it for a while and I see good reasons for both TINFO and TWARN. It shouldn't matter for our tests because
tdp_mmudefaults to off on SLE-15SP4 and SLE-15SP5. If other reviewers agree, feel free to change it to TWARN.
Quoted 5 lines
I slightly prefer tst_res(TINFO, "WARNING: ...", than TWARN. Although false negative is serious, still failing the test based on suspicion of false positives is not good.
@Li, @Jan, @Metan: any opinion on it?
I'd go with TINFO here, as you suggested.
Quoted 9 lines
Also, I send a patch to add
TINFO_WARNflag (yeah, ugly name) to print TINFO but slightly more visible due the color.https://patchwork.ozlabs.org/project/ltp/list/?series=408394&state=*
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Martin, Jan,
Quoted 17 lines · Petr Vorel
Quoted 15 lines
Quoted 15 lines · Petr Vorel
Quoted 8 lines
testcases/kernel/kvm/kvm_pagefault01.c static void reload_module(const char *module, char *arg) · line 203
Quoted 3 lines
testcases/kernel/kvm/kvm_pagefault01.c +3
-0+ +if (read_bool_sys_param (TDP_MMU_SYSFILE ) >0 ) +tst_res (TINFO ,"tdp_mmu is enabled, beware of false negatives" );Wouldn't it be better to add "WARNING:" to make it more visible?
tst_res(TINFO, "WARNING: tdp_mmu is enabled, beware of false negatives");(if you agree, I can change it before merge)
I thought about it for a while and I see good reasons for both TINFO and TWARN. It shouldn't matter for our tests because
tdp_mmudefaults to off on SLE-15SP4 and SLE-15SP5. If other reviewers agree, feel free to change it to TWARN.
Quoted 7 lines
Quoted 5 lines
I slightly prefer tst_res(TINFO, "WARNING: ...", than TWARN. Although false negative is serious, still failing the test based on suspicion of false positives is not good.
@Li, @Jan, @Metan: any opinion on it?
I'd go with TINFO here, as you suggested.
Thanks a lot both!
Patchset merged (Jan, I did not dare to add your RBT or ABT as you did not add it), with added WARNING: (as Martin agreed).
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp