Skip to content

KVM: Add tdx_cpuoff_pinedVMdown case#571

Merged
xhao22 merged 1 commit intointel:mainfrom
atlarator:poweroff
Apr 16, 2026
Merged

KVM: Add tdx_cpuoff_pinedVMdown case#571
xhao22 merged 1 commit intointel:mainfrom
atlarator:poweroff

Conversation

@atlarator
Copy link
Copy Markdown
Contributor

It seems that cpu poweroff and vm down are concurrent processes so I run a subprocess on host to poweroff cpu.

lgtm.

Screenshot 2026-04-10 153543

@atlarator atlarator force-pushed the poweroff branch 4 times, most recently from 0cfe144 to a5b2904 Compare April 14, 2026 07:26
@atlarator
Copy link
Copy Markdown
Contributor Author

Now the booted vm should enabled with 64 cpus.

@atlarator
Copy link
Copy Markdown
Contributor Author

It seems that the sleep 6 is redundant in this case.

Screenshot 2026-04-15 092248

"""

for i in range(0, 20):
params["smp"] = 64
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

define the smp size in cfg

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As a default config parameter in avocado, explicit definition will cause case name chaos in avocado list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried to define this parameter in the config file, whether attach to case name or in an independent variant field.

process.system(f"taskset -pc 18 {pid}", ignore_status=True)
process.system("echo 0 > /sys/devices/system/cpu/cpu18/online")
session.cmd("init 0 &", ignore_all_errors=True)
process.system("sleep 3")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about time.sleep?

@fanchen2
Copy link
Copy Markdown
Contributor

Looks good to me.
@xhao22 Could you help to review?

session = vm.wait_for_login(timeout=timeout)
flags = params["guest_flags"]
check_cpu_flags(params, flags, test, session)
pid = process.getoutput("ps -edf | grep qemu | grep -E 'avocado-vt-vm.*' | grep -v grep | awk '{print $2}'")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is API get_pid() in avocado-vt, please use it instead of shell command.

check_cpu_flags(params, flags, test, session)
pid = process.getoutput("ps -edf | grep qemu | grep -E 'avocado-vt-vm.*' | grep -v grep | awk '{print $2}'")
process.system(f"taskset -pc 18 {pid}", ignore_status=True)
process.system("echo 0 > /sys/devices/system/cpu/cpu18/online")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is API cpu.offline() in avocado, please use it.
And why choose cpu 18 as hardcode?

seamcall_failed_match = seamcall_failed_pattern.search(dmesg.decode('utf-8'))
if hkid_str or crash_str or seamcall_failed_match:
test.fail(f"Detected the crash information in {i} time run. Fail!")
process.system("echo 1 > /sys/devices/system/cpu/cpu18/online")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment as above, cpu.online()

@xhao22 xhao22 merged commit c196e26 into intel:main Apr 16, 2026
4 of 5 checks passed
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.

3 participants