canonical / tdx

Intel confidential computing - TDX
GNU General Public License v3.0
97 stars 39 forks source link

Can I use VTune in TDX? #182

Open hedj17 opened 3 months ago

hedj17 commented 3 months ago

I want to use VTune in TDX to analyze program performance, but when I use VTune, the virtual machine's state changes to paused. What should I do if I want to use VTune or other performance analysis tools, or is this prohibited in TDX?

syncronize-issues-to-jira[bot] commented 3 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/PEK-963.

This message was autogenerated

bktan8 commented 3 months ago

Hello @hedj17 - Can you provide more details?

1) Provide steps to reproduce. Versions of software would also be helpful.
2) Are you trying to profile userspace components within the VM or are you trying to profile hardware events?

hedj17 commented 3 months ago

@bktan8 When I attempt to run the vtune-gui command in the virtual machine, the VM's state changes to "paused." This issue is unrelated to the content I intend to profile. Can you run vtune in tdx correctly?

I used tdx1.5 and the version of vtune is 2024.2

bktan8 commented 3 months ago

@hedj17 - can you try the non-GUI version of vtune inside the TD?

hedj17 commented 3 months ago

@bktan8 Yes, I have tried non-GUI version of vtune. It can also not run properly.

fanchen2 commented 3 months ago

@hedj17 I have no experience on VTune, but just remembered "pmu" is not supported in this TDX software stack, and because of this, perf cannot run properly in TD guest either.

hedj17 commented 3 months ago

@fanchen2 Thank you for your response. Is there any way for me to obtain the performance metrics of a program running in a TD guest?

BFuhry commented 2 months ago

@hedj17 Could you please try to start a Trust Domain (TD) with the PERFMON attribute set? For QEMU boot, you can set the attributes used during TD boot via QEMU command line parameters. For libvirt boot, you can set the attributes used during TD boot via the policy in the launchSecurity element of your template xml.

Table 3.9 in https://cdrdv2.intel.com/v1/dl/getContent/733579 lists all the attributes of a TD, in particular PERFMON. Additionally, you can find more information about performance measurements in a TD in https://cdrdv2.intel.com/v1/dl/getContent/733575. In particular, section 15.2 will give you some details.