Re: Using perf to access hardware events in pre-launched VM


Minggui Cao
 

Hi, Paolo,

                If you can read 0x186, it means, you can read PMU MSRs, it shall work for perf to sample some events, like LLC misses.

 

You can also check by: dmesg | grep -i pmu

To check PMU driver is probed.

 

You don’t need modify the scenario file.

 

 

Minggui

 

 

 

 

From: acrn-users@... <acrn-users@...> On Behalf Of Paolo Crotti
Sent: Friday, March 25, 2022 7:08 PM
To: acrn-users@...
Subject: Re: [acrn-users] Using perf to access hardware events in pre-launched VM

 

Hi Minggui,

Thanks for the quick answer. With my original scenario, I tried rdmsr 0x186 and it returned rdmsr(0x186):0x0. Is it ok?

Then I modified the scenario and i get a lot of errors:

First I changed the <vm_type> PRE_STD_VM to RTVM, then run make hypervisor and I got this error:

make[1]: ingresso nella directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

Board XML is fetched from /home/paoloc/acrn-work/my_board.xml

Scneario XML is configuration fetched from /home/paoloc/acrn-work/notPartitioned-EnablePMU.xml

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/allocation.xml generated

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/unified.xml generated

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/config.mk generated

Traceback (most recent call last):

  File "/home/paoloc/acrn-work/acrn-hypervisor/hypervisor/../misc/config_tools/board_config/board_cfg_gen.py", line 137, in <module>

    err_dic = main(ARGS)

  File "/home/paoloc/acrn-work/acrn-hypervisor/hypervisor/../misc/config_tools/board_config/board_cfg_gen.py", line 95, in main

    err_dic = board_info_h.generate_file(config)

  File "/home/paoloc/acrn-work/acrn-hypervisor/misc/config_tools/board_config/board_info_h.py", line 96, in generate_file

    scenario_cfg_lib.VM_DB[common.VM_TYPES[0]]['load_type'] == "PRE_LAUNCHED_VM"

KeyError: 'RTVM'

make[1]: uscita dalla directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

make -C /home/paoloc/acrn-work/acrn-hypervisor/hypervisor BOARD=/home/paoloc/acrn-work/my_board.xml SCENARIO=/home/paoloc/acrn-work/notPartitioned-EnablePMU.xml HV_OBJDIR=/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor RELEASE=

make[1]: ingresso nella directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/include/config.h generated

Start pre-build static check ...

make -C ../misc/hv_prebuild BOARD=my_board SCENARIO=partitioned_CAT TARGET_DIR=/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs

make[2]: ingresso nella directory «/home/paoloc/acrn-work/acrn-hypervisor/misc/hv_prebuild»

make[2]: ***  Nessuna regola per generare l'obiettivo «/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/scenarios/partitioned_CAT/vm_configurations.c», necessario per «default».  Arresto.

make[2]: uscita dalla directory «/home/paoloc/acrn-work/acrn-hypervisor/misc/hv_prebuild»

make[1]: *** [Makefile:413: pre_build] Errore 2

make[1]: uscita dalla directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

make: *** [Makefile:109: hypervisor] Errore 2


Then if I add this line <load_order>PRE_LAUNCHED_VM</load_order>, I get a different error:

make[1]: ingresso nella directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

Board XML is fetched from /home/paoloc/acrn-work/my_board.xml

Scneario XML is configuration fetched from /home/paoloc/acrn-work/notPartitioned-EnablePMU.xml

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/allocation.xml generated

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/unified.xml generated

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/config.mk generated

Board configurations for my_board is generated successfully.

Error: Scenario xml file validation failed:

Error: vm:id=0: 'vm:id=0' Unexpected child with tag 'load_order' at position 2. Tag (name | clos | priority | legacy_vuart | console_vuart | communication_vuart) expected.: last call: <Element 'vm' at 0x7fd0629775e0>

Error: vm:id=1: 'vm:id=1' Unexpected child with tag 'load_order' at position 2. Tag (name | clos | priority | legacy_vuart | console_vuart | communication_vuart) expected.: last call: <Element 'vm' at 0x7fd06297b6d0>

make[1]: uscita dalla directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

make -C /home/paoloc/acrn-work/acrn-hypervisor/hypervisor BOARD=/home/paoloc/acrn-work/my_board.xml SCENARIO=/home/paoloc/acrn-work/notPartitioned-EnablePMU.xml HV_OBJDIR=/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor RELEASE=

make[1]: ingresso nella directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/include/config.h generated

Start pre-build static check ...

make -C ../misc/hv_prebuild BOARD=my_board SCENARIO=partitioned_CAT TARGET_DIR=/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs

make[2]: ingresso nella directory «/home/paoloc/acrn-work/acrn-hypervisor/misc/hv_prebuild»

make[2]: ***  Nessuna regola per generare l'obiettivo «/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/scenarios/partitioned_CAT/vm_configurations.c», necessario per «default».  Arresto.

make[2]: uscita dalla directory «/home/paoloc/acrn-work/acrn-hypervisor/misc/hv_prebuild»

make[1]: *** [Makefile:413: pre_build] Errore 2

make[1]: uscita dalla directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

make: *** [Makefile:109: hypervisor] Errore 2


And if I add <lapic_passthrough>y</lapic_passthrough>, I get another different error:

make[1]: ingresso nella directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

Board XML is fetched from /home/paoloc/acrn-work/my_board.xml

Scneario XML is configuration fetched from /home/paoloc/acrn-work/notPartitioned-EnablePMU.xml

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/allocation.xml generated

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/unified.xml generated

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/config.mk generated

Board configurations for my_board is generated successfully.

Error: Scenario xml file validation failed:

Error: vm:id=0: 'vm:id=0' Unexpected child with tag 'lapic_passthrough' at position 4.: last call: <Element 'vm' at 0x7fc2ef3a05e0>

Error: vm:id=1: 'vm:id=1' Unexpected child with tag 'lapic_passthrough' at position 4.: last call: <Element 'vm' at 0x7fc2ef3a4770>

make[1]: uscita dalla directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

make -C /home/paoloc/acrn-work/acrn-hypervisor/hypervisor BOARD=/home/paoloc/acrn-work/my_board.xml SCENARIO=/home/paoloc/acrn-work/notPartitioned-EnablePMU.xml HV_OBJDIR=/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor RELEASE=

make[1]: ingresso nella directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/include/config.h generated

Start pre-build static check ...

make -C ../misc/hv_prebuild BOARD=my_board SCENARIO=partitioned_CAT TARGET_DIR=/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs

make[2]: ingresso nella directory «/home/paoloc/acrn-work/acrn-hypervisor/misc/hv_prebuild»

make[2]: ***  Nessuna regola per generare l'obiettivo «/home/paoloc/acrn-work/acrn-hypervisor/build/hypervisor/configs/scenarios/partitioned_CAT/vm_configurations.c», necessario per «default».  Arresto.

make[2]: uscita dalla directory «/home/paoloc/acrn-work/acrn-hypervisor/misc/hv_prebuild»

make[1]: *** [Makefile:413: pre_build] Errore 2

make[1]: uscita dalla directory «/home/paoloc/acrn-work/acrn-hypervisor/hypervisor»

make: *** [Makefile:109: hypervisor] Errore 2


Do you have any idea what the problem could be?

P.S. Attached my original scenario and the modified one.

Join {acrn-users@lists.projectacrn.org to automatically receive all group messages.