Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KSMConfig.cleanup: Ensure ksm to be disabled at the end of the case #3705

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

PaulYuuu
Copy link
Contributor

In the cleanup function, "start_ksmtuned" will start the
ksmtuned.service, it controls and tunes the ksm service, but depends on
the KSM_MONITOR_INTERVAL. So ksm is not closed immediately, but at some
time in KSM_MONITOR_INTERVAL loop. Without this fix, the next test case
may launch the guest with ksm enabled, which is not expected.

ID: 2215183
Signed-off-by: Yihuang Yu [email protected]

The output of `process.run("cat /sys/kernel/mm/ksm/run").stdout_text`
is '0\n', which does not match numeric only string, the make the
function always returns `True`.

Signed-off-by: Yihuang Yu <[email protected]>
@PaulYuuu
Copy link
Contributor Author

2023-06-14 22:16:30,464 avocado.utils.wait DEBUG| Waiting for ksm to be disabled (55.106887299 secs)
2023-06-14 22:16:30,464 avocado.utils.process INFO | Running 'cat /sys/kernel/mm/ksm/run'
2023-06-14 22:16:30,465 avocado.utils.process DEBUG| [stdout] 1
2023-06-14 22:16:30,465 avocado.utils.process INFO | Command 'cat /sys/kernel/mm/ksm/run' finished with 0 after 0.000858685s
2023-06-14 22:16:35,470 avocado.utils.wait DEBUG| Waiting for ksm to be disabled (60.117019623 secs)
2023-06-14 22:16:35,471 avocado.utils.process INFO | Running 'cat /sys/kernel/mm/ksm/run'
2023-06-14 22:16:35,471 avocado.utils.process DEBUG| [stdout] 0
2023-06-14 22:16:35,480 avocado.core.status.repo DEBUG| Task "1-io-github-autotest-qemu.ksm_base.base.arm64-pci" finished message: "{'result': 'PASS', 'fail_reason': '', 'class_name': 'VirtTest', 'fail_class': '', 'traceback': '', 'status': 'finished', 'time': 83358.423854287}"

@PaulYuuu
Copy link
Contributor Author

Hello @YongxueHong @mcasquer, could you help to review?

@PaulYuuu
Copy link
Contributor Author

cc @hs0210

@YongxueHong
Copy link
Contributor

Hi @bgartzi
I CC this PR to you since you are refactoring the related part.
Please feel free to leave comments if you have.
Thanks.

@bgartzi
Copy link
Contributor

bgartzi commented Jun 16, 2023

Thanks @YongxueHong for letting me know about this. No concerns on my side ATM. I'm locking into the discussion on this patch, though.

@mcasquer
Copy link
Contributor

KSM tests passed successfully

 (01/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads.q35: STARTED
 (01/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads.q35: PASS (1197.19 s)
 (02/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.migrate.tcp.q35: STARTED
 (02/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.migrate.tcp.q35: PASS (190.23 s)
 (03/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.migrate.tcp.with_filter_off.with_post_copy.q35: STARTED
 (03/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.migrate.tcp.with_filter_off.with_post_copy.q35: PASS (160.10 s)
 (04/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.migrate.tcp.with_filter_off.with_multifd.q35: STARTED
 (04/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.migrate.tcp.with_filter_off.with_multifd.q35: PASS (181.62 s)
 (05/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_base.disable.other_host.q35: STARTED
 (05/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_base.disable.other_host.q35: PASS (373.11 s)
 (06/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_base.base.q35: STARTED
 (06/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_base.base.q35: PASS (374.51 s)
 (07/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_base.negative.q35: STARTED
 (07/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_base.negative.q35: PASS (375.71 s)
 (08/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_overcommit.ksm_serial.q35: STARTED
 (08/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_overcommit.ksm_serial.q35: PASS (2223.14 s)
 (09/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_overcommit.ksm_parallel.q35: STARTED
 (09/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_overcommit.ksm_parallel.q35: PASS (3499.23 s)
 (10/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_ksmtuned.q35: STARTED
 (10/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.ksm_ksmtuned.q35: PASS (430.33 s)
 (11/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.system_reset_during_boot.q35: STARTED
 (11/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.system_reset_during_boot.q35: PASS (765.12 s)
 (12/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.system_powerdown.q35: STARTED
 (12/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.system_powerdown.q35: PASS (162.18 s)
 (13/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.system_reset_bootable.q35: STARTED
 (13/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.system_reset_bootable.q35: PASS (439.39 s)
 (14/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.stop_continue.stop_cont_only.q35: STARTED
 (14/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.stop_continue.stop_cont_only.q35: PASS (134.81 s)
 (15/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.reboot.q35: STARTED
 (15/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.reboot.q35: PASS (1477.40 s)
 (16/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.boot.q35: STARTED
 (16/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.boot.q35: PASS (129.35 s)
 (17/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.shutdown.q35: STARTED
 (17/17) Host_RHEL.m9.u3.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.9.3.0.x86_64.io-github-autotest-qemu.shutdown.q35: PASS (126.16 s)
RESULTS    : PASS 17 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0

Copy link
Contributor

@mcasquer mcasquer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

In the `cleanup` function, "start_ksmtuned" will start the
ksmtuned.service, it controls and tunes the ksm service, but depends on
the KSM_MONITOR_INTERVAL. So ksm is not closed immediately, but at some
time in KSM_MONITOR_INTERVAL loop. Without this fix, the next test case
may launch the guest with ksm enabled, which is not expected.

Signed-off-by: Yihuang Yu <[email protected]>
Copy link
Contributor

@YongxueHong YongxueHong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@YongxueHong YongxueHong merged commit e20d6f4 into avocado-framework:master Jul 11, 2023
@PaulYuuu PaulYuuu deleted the ksm-release branch October 23, 2023 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants