€•¼Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ#/translations/zh_CN/arch/arm64/perf”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/zh_TW/arch/arm64/perf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/it_IT/arch/arm64/perf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/ja_JP/arch/arm64/perf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/ko_KR/arch/arm64/perf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/pt_BR/arch/arm64/perf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/sp_SP/arch/arm64/perf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³Œ=/var/lib/git/docbuild/linux/Documentation/arch/arm64/perf.rst”h´KubhŒtarget”“”)”}”(hŒ.. _perf_index:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œ perf-index”uh1hÈh´Khhh²hh³hÇubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒPerf”h]”hŒPerf”…””}”(hhÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhØh²hh³hÇh´Kubh×)”}”(hhh]”(hÜ)”}”(hŒPerf Event Attributes”h]”hŒPerf Event Attributes”…””}”(hhîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhëh²hh³hÇh´K ubhŒ field_list”“”)”}”(hhh]”(hŒfield”“”)”}”(hhh]”(hŒ field_name”“”)”}”(hŒAuthor”h]”hŒAuthor”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh³hÇh´KubhŒ field_body”“”)”}”(hŒ%Andrew Murray ”h]”hŒ paragraph”“”)”}”(hjh]”(hŒAndrew Murray <”…””}”(hjh²hh³Nh´NubhŒ reference”“”)”}”(hŒandrew.murray@arm.com”h]”hŒandrew.murray@arm.com”…””}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:andrew.murray@arm.com”uh1j%hjubhŒ>”…””}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K hhþh²hubj)”}”(hhh]”(j)”}”(hŒDate”h]”hŒDate”…””}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjMh³hÇh´Kubj)”}”(hŒ 2019-03-06 ”h]”j)”}”(hŒ 2019-03-06”h]”hŒ 2019-03-06”…””}”(hjbh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K hj^ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjMubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K hhþh²hubeh}”(h]”h ]”h"]”h$]”h&]”uh1hühhëh²hh³hÇh´K ubh×)”}”(hhh]”(hÜ)”}”(hŒ exclude_user”h]”hŒ exclude_user”…””}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj‚h²hh³hÇh´Kubj)”}”(hŒ"This attribute excludes userspace.”h]”hŒ"This attribute excludes userspace.”…””}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Khj‚h²hubj)”}”(hŒFUserspace always runs at EL0 and thus this attribute will exclude EL0.”h]”hŒFUserspace always runs at EL0 and thus this attribute will exclude EL0.”…””}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Khj‚h²hubeh}”(h]”Œ exclude-user”ah ]”h"]”Œ exclude_user”ah$]”h&]”uh1hÖhhëh²hh³hÇh´Kubh×)”}”(hhh]”(hÜ)”}”(hŒexclude_kernel”h]”hŒexclude_kernel”…””}”(hjºh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj·h²hh³hÇh´Kubj)”}”(hŒ#This attribute excludes the kernel.”h]”hŒ#This attribute excludes the kernel.”…””}”(hjÈh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Khj·h²hubj)”}”(hŒQThe kernel runs at EL2 with VHE and EL1 without. Guest kernels always run at EL1.”h]”hŒQThe kernel runs at EL2 with VHE and EL1 without. Guest kernels always run at EL1.”…””}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Khj·h²hubj)”}”(hŒRFor the host this attribute will exclude EL1 and additionally EL2 on a VHE system.”h]”hŒRFor the host this attribute will exclude EL1 and additionally EL2 on a VHE system.”…””}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Khj·h²hubj)”}”(hŒdFor the guest this attribute will exclude EL1. Please note that EL2 is never counted within a guest.”h]”hŒdFor the guest this attribute will exclude EL1. Please note that EL2 is never counted within a guest.”…””}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K"hj·h²hubeh}”(h]”Œexclude-kernel”ah ]”h"]”Œexclude_kernel”ah$]”h&]”uh1hÖhhëh²hh³hÇh´Kubh×)”}”(hhh]”(hÜ)”}”(hŒ exclude_hv”h]”hŒ exclude_hv”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjh²hh³hÇh´K'ubj)”}”(hŒ'This attribute excludes the hypervisor.”h]”hŒ'This attribute excludes the hypervisor.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K)hjh²hubj)”}”(hŒ]For a VHE host this attribute is ignored as we consider the host kernel to be the hypervisor.”h]”hŒ]For a VHE host this attribute is ignored as we consider the host kernel to be the hypervisor.”…””}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K+hjh²hubj)”}”(hŒ¨For a non-VHE host this attribute will exclude EL2 as we consider the hypervisor to be any code that runs at EL2 which is predominantly used for guest/host transitions.”h]”hŒ¨For a non-VHE host this attribute will exclude EL2 as we consider the hypervisor to be any code that runs at EL2 which is predominantly used for guest/host transitions.”…””}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K.hjh²hubj)”}”(hŒaFor the guest this attribute has no effect. Please note that EL2 is never counted within a guest.”h]”hŒaFor the guest this attribute has no effect. Please note that EL2 is never counted within a guest.”…””}”(hjCh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K2hjh²hubeh}”(h]”Œ exclude-hv”ah ]”h"]”Œ exclude_hv”ah$]”h&]”uh1hÖhhëh²hh³hÇh´K'ubh×)”}”(hhh]”(hÜ)”}”(hŒexclude_host / exclude_guest”h]”hŒexclude_host / exclude_guest”…””}”(hj\h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjYh²hh³hÇh´K7ubj)”}”(hŒ>These attributes exclude the KVM host and guest, respectively.”h]”hŒ>These attributes exclude the KVM host and guest, respectively.”…””}”(hjjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K9hjYh²hubj)”}”(hŒiThe KVM host may run at EL0 (userspace), EL1 (non-VHE kernel) and EL2 (VHE kernel or non-VHE hypervisor).”h]”hŒiThe KVM host may run at EL0 (userspace), EL1 (non-VHE kernel) and EL2 (VHE kernel or non-VHE hypervisor).”…””}”(hjxh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K;hjYh²hubj)”}”(hŒ:The KVM guest may run at EL0 (userspace) and EL1 (kernel).”h]”hŒ:The KVM guest may run at EL0 (userspace) and EL1 (kernel).”…””}”(hj†h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K>hjYh²hubj)”}”(hXDue to the overlapping exception levels between host and guests we cannot exclusively rely on the PMU's hardware exception filtering - therefore we must enable/disable counting on the entry and exit to the guest. This is performed differently on VHE and non-VHE systems.”h]”hXDue to the overlapping exception levels between host and guests we cannot exclusively rely on the PMU’s hardware exception filtering - therefore we must enable/disable counting on the entry and exit to the guest. This is performed differently on VHE and non-VHE systems.”…””}”(hj”h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K@hjYh²hubj)”}”(hŒ¼For non-VHE systems we exclude EL2 for exclude_host - upon entering and exiting the guest we disable/enable the event as appropriate based on the exclude_host and exclude_guest attributes.”h]”hŒ¼For non-VHE systems we exclude EL2 for exclude_host - upon entering and exiting the guest we disable/enable the event as appropriate based on the exclude_host and exclude_guest attributes.”…””}”(hj¢h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KEhjYh²hubj)”}”(hŒñFor VHE systems we exclude EL1 for exclude_guest and exclude both EL0,EL2 for exclude_host. Upon entering and exiting the guest we modify the event to include/exclude EL0 as appropriate based on the exclude_host and exclude_guest attributes.”h]”hŒñFor VHE systems we exclude EL1 for exclude_guest and exclude both EL0,EL2 for exclude_host. Upon entering and exiting the guest we modify the event to include/exclude EL0 as appropriate based on the exclude_host and exclude_guest attributes.”…””}”(hj°h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KIhjYh²hubj)”}”(hŒ“The statements above also apply when these attributes are used within a non-VHE guest however please note that EL2 is never counted within a guest.”h]”hŒ“The statements above also apply when these attributes are used within a non-VHE guest however please note that EL2 is never counted within a guest.”…””}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KNhjYh²hubeh}”(h]”Œexclude-host-exclude-guest”ah ]”h"]”Œexclude_host / exclude_guest”ah$]”h&]”uh1hÖhhëh²hh³hÇh´K7ubh×)”}”(hhh]”(hÜ)”}”(hŒAccuracy”h]”hŒAccuracy”…””}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjÔh²hh³hÇh´KSubj)”}”(hXäOn non-VHE hosts we enable/disable counters on the entry/exit of host/guest transition at EL2 - however there is a period of time between enabling/disabling the counters and entering/exiting the guest. We are able to eliminate counters counting host events on the boundaries of guest entry/exit when counting guest events by filtering out EL2 for exclude_host. However when using !exclude_hv there is a small blackout window at the guest entry/exit where host events are not captured.”h]”hXäOn non-VHE hosts we enable/disable counters on the entry/exit of host/guest transition at EL2 - however there is a period of time between enabling/disabling the counters and entering/exiting the guest. We are able to eliminate counters counting host events on the boundaries of guest entry/exit when counting guest events by filtering out EL2 for exclude_host. However when using !exclude_hv there is a small blackout window at the guest entry/exit where host events are not captured.”…””}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KUhjÔh²hubj)”}”(hŒ-On VHE systems there are no blackout windows.”h]”hŒ-On VHE systems there are no blackout windows.”…””}”(hjóh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K]hjÔh²hubeh}”(h]”Œaccuracy”ah ]”h"]”Œaccuracy”ah$]”h&]”uh1hÖhhëh²hh³hÇh´KSubeh}”(h]”Œperf-event-attributes”ah ]”h"]”Œperf event attributes”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K ubh×)”}”(hhh]”(hÜ)”}”(hŒ*Perf Userspace PMU Hardware Counter Access”h]”hŒ*Perf Userspace PMU Hardware Counter Access”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjh²hh³hÇh´K`ubh×)”}”(hhh]”(hÜ)”}”(hŒOverview”h]”hŒOverview”…””}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj"h²hh³hÇh´Kcubj)”}”(hXThe perf userspace tool relies on the PMU to monitor events. It offers an abstraction layer over the hardware counters since the underlying implementation is cpu-dependent. Arm64 allows userspace tools to have access to the registers storing the hardware counters' values directly.”h]”hXThe perf userspace tool relies on the PMU to monitor events. It offers an abstraction layer over the hardware counters since the underlying implementation is cpu-dependent. Arm64 allows userspace tools to have access to the registers storing the hardware counters’ values directly.”…””}”(hj3h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Kdhj"h²hubj)”}”(hŒœThis targets specifically self-monitoring tasks in order to reduce the overhead by directly accessing the registers without having to go through the kernel.”h]”hŒœThis targets specifically self-monitoring tasks in order to reduce the overhead by directly accessing the registers without having to go through the kernel.”…””}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Kjhj"h²hubeh}”(h]”Œoverview”ah ]”h"]”h$]”Œoverview”ah&]”uh1hÖhjh²hh³hÇh´KcŒ referenced”Kubh×)”}”(hhh]”(hÜ)”}”(hŒHow-to”h]”hŒHow-to”…””}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjXh²hh³hÇh´Knubj)”}”(hŒ¸The focus is set on the armv8 PMUv3 which makes sure that the access to the pmu registers is enabled and that the userspace has access to the relevant information in order to use them.”h]”hŒ¸The focus is set on the armv8 PMUv3 which makes sure that the access to the pmu registers is enabled and that the userspace has access to the relevant information in order to use them.”…””}”(hjih²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KohjXh²hubj)”}”(hŒrIn order to have access to the hardware counters, the global sysctl kernel/perf_user_access must first be enabled:”h]”hŒrIn order to have access to the hardware counters, the global sysctl kernel/perf_user_access must first be enabled:”…””}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KshjXh²hubhŒ literal_block”“”)”}”(hŒ*echo 1 > /proc/sys/kernel/perf_user_access”h]”hŒ*echo 1 > /proc/sys/kernel/perf_user_access”…””}”hj‡sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”Œsh”Œhighlight_args”}”uh1j…h³hÇh´KvhjXh²hubj)”}”(hX{It is necessary to open the event using the perf tool interface with config1:1 attr bit set: the sys_perf_event_open syscall returns a fd which can subsequently be used with the mmap syscall in order to retrieve a page of memory containing information about the event. The PMU driver uses this page to expose to the user the hardware counter's index and other necessary data. Using this index enables the user to access the PMU registers using the `mrs` instruction. Access to the PMU registers is only valid while the sequence lock is unchanged. In particular, the PMSELR_EL0 register is zeroed each time the sequence lock is changed.”h]”(hXÂIt is necessary to open the event using the perf tool interface with config1:1 attr bit set: the sys_perf_event_open syscall returns a fd which can subsequently be used with the mmap syscall in order to retrieve a page of memory containing information about the event. The PMU driver uses this page to expose to the user the hardware counter’s index and other necessary data. Using this index enables the user to access the PMU registers using the ”…””}”(hjšh²hh³Nh´NubhŒtitle_reference”“”)”}”(hŒ`mrs`”h]”hŒmrs”…””}”(hj¤h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¢hjšubhŒ¶ instruction. Access to the PMU registers is only valid while the sequence lock is unchanged. In particular, the PMSELR_EL0 register is zeroed each time the sequence lock is changed.”…””}”(hjšh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KzhjXh²hubj)”}”(hŒ¤The userspace access is supported in libperf using the perf_evsel__mmap() and perf_evsel__read() functions. See `tools/lib/perf/tests/test-evsel.c`_ for an example.”h]”(hŒpThe userspace access is supported in libperf using the perf_evsel__mmap() and perf_evsel__read() functions. See ”…””}”(hj¼h²hh³Nh´Nubj&)”}”(hŒ$`tools/lib/perf/tests/test-evsel.c`_”h]”hŒ!tools/lib/perf/tests/test-evsel.c”…””}”(hjÄh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ!tools/lib/perf/tests/test-evsel.c”Œrefuri”Œihttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/lib/perf/tests/test-evsel.c”uh1j%hj¼Œresolved”KubhŒ for an example.”…””}”(hj¼h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K„hjXh²hubeh}”(h]”Œhow-to”ah ]”h"]”h$]”Œhow-to”ah&]”uh1hÖhjh²hh³hÇh´KnjWKubh×)”}”(hhh]”(hÜ)”}”(hŒAbout heterogeneous systems”h]”hŒAbout heterogeneous systems”…””}”(hjìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjéh²hh³hÇh´K‰ubj)”}”(hX'On heterogeneous systems such as big.LITTLE, userspace PMU counter access can only be enabled when the tasks are pinned to a homogeneous subset of cores and the corresponding PMU instance is opened by specifying the 'type' attribute. The use of generic event types is not supported in this case.”h]”hX+On heterogeneous systems such as big.LITTLE, userspace PMU counter access can only be enabled when the tasks are pinned to a homogeneous subset of cores and the corresponding PMU instance is opened by specifying the ‘type’ attribute. The use of generic event types is not supported in this case.”…””}”(hjúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KŠhjéh²hubj)”}”(hŒ·Have a look at `tools/perf/arch/arm64/tests/user-events.c`_ for an example. It can be run using the perf tool to check that the access to the registers works correctly from userspace:”h]”(hŒHave a look at ”…””}”(hjh²hh³Nh´Nubj&)”}”(hŒ,`tools/perf/arch/arm64/tests/user-events.c`_”h]”hŒ)tools/perf/arch/arm64/tests/user-events.c”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ)tools/perf/arch/arm64/tests/user-events.c”jÔŒqhttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/arch/arm64/tests/user-events.c”uh1j%hjjÖKubhŒ| for an example. It can be run using the perf tool to check that the access to the registers works correctly from userspace:”…””}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Khjéh²hubj†)”}”(hŒperf test -v user”h]”hŒperf test -v user”…””}”hj+sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj•‰j–Œsh”j˜}”uh1j…h³hÇh´K“hjéh²hubeh}”(h]”Œabout-heterogeneous-systems”ah ]”h"]”Œabout heterogeneous systems”ah$]”h&]”uh1hÖhjh²hh³hÇh´K‰ubh×)”}”(hhh]”(hÜ)”}”(hŒ&About chained events and counter sizes”h]”hŒ&About chained events and counter sizes”…””}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjCh²hh³hÇh´K˜ubj)”}”(hX[The user can request either a 32-bit (config1:0 == 0) or 64-bit (config1:0 == 1) counter along with userspace access. The sys_perf_event_open syscall will fail if a 64-bit counter is requested and the hardware doesn't support 64-bit counters. Chained events are not supported in conjunction with userspace counter access. If a 32-bit counter is requested on hardware with 64-bit counters, then userspace must treat the upper 32-bits read from the counter as UNKNOWN. The 'pmc_width' field in the user page will indicate the valid width of the counter and should be used to mask the upper bits as needed.”h]”hXaThe user can request either a 32-bit (config1:0 == 0) or 64-bit (config1:0 == 1) counter along with userspace access. The sys_perf_event_open syscall will fail if a 64-bit counter is requested and the hardware doesn’t support 64-bit counters. Chained events are not supported in conjunction with userspace counter access. If a 32-bit counter is requested on hardware with 64-bit counters, then userspace must treat the upper 32-bits read from the counter as UNKNOWN. The ‘pmc_width’ field in the user page will indicate the valid width of the counter and should be used to mask the upper bits as needed.”…””}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K™hjCh²hubh¶)”}”(hŒLinks”h]”hŒLinks”…””}”hjbsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1hµhjCh²hh³hÇh´K¢ubhÉ)”}”(hŒ£.. _tools/perf/arch/arm64/tests/user-events.c: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/arch/arm64/tests/user-events.c”h]”h}”(h]”Œ)tools-perf-arch-arm64-tests-user-events-c”ah ]”h"]”Œ)tools/perf/arch/arm64/tests/user-events.c”ah$]”h&]”jÔj uh1hÈh´K£hjCh²hh³hÇjWKubhÉ)”}”(hŒ“.. _tools/lib/perf/tests/test-evsel.c: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/lib/perf/tests/test-evsel.c”h]”h}”(h]”Œ!tools-lib-perf-tests-test-evsel-c”ah ]”h"]”Œ!tools/lib/perf/tests/test-evsel.c”ah$]”h&]”jÔjÕuh1hÈh´K¥hjCh²hh³hÇjWKubeh}”(h]”Œ&about-chained-events-and-counter-sizes”ah ]”h"]”Œ&about chained events and counter sizes”ah$]”h&]”uh1hÖhjh²hh³hÇh´K˜ubeh}”(h]”Œ*perf-userspace-pmu-hardware-counter-access”ah ]”h"]”Œ*perf userspace pmu hardware counter access”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K`ubh×)”}”(hhh]”(hÜ)”}”(hŒEvent Counting Threshold”h]”hŒEvent Counting Threshold”…””}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj˜h²hh³hÇh´K©ubh×)”}”(hhh]”(hÜ)”}”(hŒOverview”h]”hŒOverview”…””}”(hj¬h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj©h²hh³hÇh´K¬ubj)”}”(hX}FEAT_PMUv3_TH (Armv8.8) permits a PMU counter to increment only on events whose count meets a specified threshold condition. For example if threshold_compare is set to 2 ('Greater than or equal'), and the threshold is set to 2, then the PMU counter will now only increment by when an event would have previously incremented the PMU counter by 2 or more on a single processor cycle.”h]”hXFEAT_PMUv3_TH (Armv8.8) permits a PMU counter to increment only on events whose count meets a specified threshold condition. For example if threshold_compare is set to 2 (‘Greater than or equal’), and the threshold is set to 2, then the PMU counter will now only increment by when an event would have previously incremented the PMU counter by 2 or more on a single processor cycle.”…””}”(hjºh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K®hj©h²hubj)”}”(hŒ›To increment by 1 after passing the threshold condition instead of the number of events on that cycle, add the 'threshold_count' option to the commandline.”h]”hŒŸTo increment by 1 after passing the threshold condition instead of the number of events on that cycle, add the ‘threshold_count’ option to the commandline.”…””}”(hjÈh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Kµhj©h²hubeh}”(h]”Œid1”ah ]”h"]”h$]”jUah&]”uh1hÖhj˜h²hh³hÇh´K¬jWKubh×)”}”(hhh]”(hÜ)”}”(hŒHow-to”h]”hŒHow-to”…””}”(hjàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjÝh²hh³hÇh´Kºubj)”}”(hŒ5These are the parameters for controlling the feature:”h]”hŒ5These are the parameters for controlling the feature:”…””}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K¼hjÝh²hubhŒtable”“”)”}”(hhh]”hŒtgroup”“”)”}”(hhh]”(hŒcolspec”“”)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K2uh1jhjubj)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”jK2uh1jhjubhŒthead”“”)”}”(hhh]”hŒrow”“”)”}”(hhh]”(hŒentry”“”)”}”(hhh]”j)”}”(hŒ Parameter”h]”hŒ Parameter”…””}”(hj*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KÁhj'ubah}”(h]”h ]”h"]”h$]”h&]”uh1j%hj"ubj&)”}”(hhh]”j)”}”(hŒ Description”h]”hŒ Description”…””}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KÂhj>ubah}”(h]”h ]”h"]”h$]”h&]”uh1j%hj"ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubhŒtbody”“”)”}”(hhh]”(j!)”}”(hhh]”(j&)”}”(hhh]”j)”}”(hŒ threshold”h]”hŒ threshold”…””}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KÃhjiubah}”(h]”h ]”h"]”h$]”h&]”uh1j%hjfubj&)”}”(hhh]”j)”}”(hŒzValue to threshold the event by. A value of 0 means that thresholding is disabled and the other parameters have no effect.”h]”hŒzValue to threshold the event by. A value of 0 means that thresholding is disabled and the other parameters have no effect.”…””}”(hjƒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KÄhj€ubah}”(h]”h ]”h"]”h$]”h&]”uh1j%hjfubeh}”(h]”h ]”h"]”h$]”h&]”uh1j hjcubj!)”}”(hhh]”(j&)”}”(hhh]”j)”}”(hŒthreshold_compare”h]”hŒthreshold_compare”…””}”(hj£h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KÆhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j%hjubj&)”}”(hhh]”hŒ line_block”“”)”}”(hhh]”(hh´“”)”}”(hŒ@Comparison function to use, with the following values supported:”h]”hŒ@Comparison function to use, with the following values supported:”…””}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h´Œindent”Khj¼h³hÇh´Kubj¿)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1h´hj¼jÎKh³hÇh´Kubj¿)”}”(hŒ 0: Not-equal”h]”hŒ 0: Not-equal”…””}”(hjØh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h´jÎKhj¼h³hÇh´Kubj¿)”}”(hŒ 1: Equals”h]”hŒ 1: Equals”…””}”(hjæh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h´jÎKhj¼h³hÇh´Kubj¿)”}”(hŒ2: Greater-than-or-equal”h]”hŒ2: Greater-than-or-equal”…””}”(hjôh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h´jÎKhj¼h³hÇh´Kubj¿)”}”(hŒ 3: Less-than”h]”hŒ 3: Less-than”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h´jÎKhj¼h³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”uh1jºhj·ubah}”(h]”h ]”h"]”h$]”h&]”uh1j%hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j hjcubj!)”}”(hhh]”(j&)”}”(hhh]”j)”}”(hŒthreshold_count”h]”hŒthreshold_count”…””}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KÍhj%ubah}”(h]”h ]”h"]”h$]”h&]”uh1j%hj"ubj&)”}”(hhh]”j)”}”(hŒqIf this is set, count by 1 after passing the threshold condition instead of the value of the event on this cycle.”h]”hŒqIf this is set, count by 1 after passing the threshold condition instead of the value of the event on this cycle.”…””}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KÎhj<ubah}”(h]”h ]”h"]”h$]”h&]”uh1j%hj"ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j hjcubeh}”(h]”h ]”h"]”h$]”h&]”uh1jahjubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jhjþubah}”(h]”h ]”h"]”h$]”h&]”uh1jühjÝh²hh³Nh´Nubj)”}”(hŒcThe threshold, threshold_compare and threshold_count values can be provided per event, for example:”h]”hŒcThe threshold, threshold_compare and threshold_count values can be provided per event, for example:”…””}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KÑhjÝh²hubj†)”}”(hŒƒperf stat -e stall_slot/threshold=2,threshold_compare=2/ \ -e dtlb_walk/threshold=10,threshold_compare=3,threshold_count/”h]”hŒƒperf stat -e stall_slot/threshold=2,threshold_compare=2/ \ -e dtlb_walk/threshold=10,threshold_compare=3,threshold_count/”…””}”hjzsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj•‰j–Œsh”j˜}”uh1j…h³hÇh´KÔhjÝh²hubj)”}”(hŒÉIn this example the stall_slot event will count by 2 or more on every cycle where 2 or more stalls happen. And dtlb_walk will count by 1 on every cycle where the number of dtlb walks were less than 10.”h]”hŒÉIn this example the stall_slot event will count by 2 or more on every cycle where 2 or more stalls happen. And dtlb_walk will count by 1 on every cycle where the number of dtlb walks were less than 10.”…””}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KÙhjÝh²hubj)”}”(hŒYThe maximum supported threshold value can be read from the caps of each PMU, for example:”h]”hŒYThe maximum supported threshold value can be read from the caps of each PMU, for example:”…””}”(hj˜h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KÝhjÝh²hubj†)”}”(hŒLcat /sys/bus/event_source/devices/armv8_pmuv3/caps/threshold_max 0x000000ff”h]”hŒLcat /sys/bus/event_source/devices/armv8_pmuv3/caps/threshold_max 0x000000ff”…””}”hj¦sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj•‰j–Œsh”j˜}”uh1j…h³hÇh´KàhjÝh²hubj)”}”(hŒêIf a value higher than this is given, then opening the event will result in an error. The highest possible maximum is 4095, as the config field for threshold is limited to 12 bits, and the Perf tool will refuse to parse higher values.”h]”hŒêIf a value higher than this is given, then opening the event will result in an error. The highest possible maximum is 4095, as the config field for threshold is limited to 12 bits, and the Perf tool will refuse to parse higher values.”…””}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KæhjÝh²hubj)”}”(hŒþIf the PMU doesn't support FEAT_PMUv3_TH, then threshold_max will read 0, and attempting to set a threshold value will also result in an error. threshold_max will also read as 0 on aarch32 guests, even if the host is running on hardware with the feature.”h]”hXIf the PMU doesn’t support FEAT_PMUv3_TH, then threshold_max will read 0, and attempting to set a threshold value will also result in an error. threshold_max will also read as 0 on aarch32 guests, even if the host is running on hardware with the feature.”…””}”(hjÄh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KëhjÝh²hubeh}”(h]”Œid2”ah ]”h"]”h$]”jçah&]”uh1hÖhj˜h²hh³hÇh´KºjWKubeh}”(h]”Œevent-counting-threshold”ah ]”h"]”Œevent counting threshold”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K©ubeh}”(h]”(Œperf”hÕeh ]”h"]”(Œperf”Œ perf_index”eh$]”h&]”uh1hÖhhh²hh³hÇh´KŒexpect_referenced_by_name”}”jçhÊsŒexpect_referenced_by_id”}”hÕhÊsubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÛNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”j%Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”(Œ!tools/lib/perf/tests/test-evsel.c”]”jÄaŒ)tools/perf/arch/arm64/tests/user-events.c”]”jauŒrefids”}”hÕ]”hÊasŒnameids”}”(jçhÕjæjãjj j´j±jjjVjSjÑjÎjjj•j’Œoverview”NŒhow-to”Nj@j=jjŠjyjvj…j‚jÞjÛuŒ nametypes”}”(jçˆjæ‰j‰j´‰j‰jV‰jщj‰j•‰jY‰jZ‰j@‰j‰jyˆj…ˆjÞ‰uh}”(hÕhØjãhØj hëj±j‚jj·jSjjÎjYjjÔj’jjQj"jãjXj=jéjŠjCjvjpj‚j|jÛj˜jØj©jÔjÝuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”jKs…”R”Œparse_messages”]”(hŒsystem_message”“”)”}”(hhh]”j)”}”(hŒ+Duplicate implicit target name: "overview".”h]”hŒ/Duplicate implicit target name: “overviewâ€.”…””}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj{ubah}”(h]”h ]”h"]”h$]”h&]”jØaŒlevel”KŒtype”ŒINFO”Œsource”hÇŒline”K¬uh1jyhj©h²hh³hÇh´K¬ubjz)”}”(hhh]”j)”}”(hŒ)Duplicate implicit target name: "how-to".”h]”hŒ-Duplicate implicit target name: “how-toâ€.”…””}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj—ubah}”(h]”h ]”h"]”h$]”h&]”jÔaŒlevel”KŒtype”j”Œsource”hÇŒline”Kºuh1jyhjÝh²hh³hÇh´KºubeŒtransform_messages”]”jz)”}”(hhh]”j)”}”(hhh]”hŒ0Hyperlink target "perf-index" is not referenced.”…””}”hj·sbah}”(h]”h ]”h"]”h$]”h&]”uh1jhj´ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j”Œsource”hÇŒline”Kuh1jyubaŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.