About support for memory event on AMD CPUs
Dear developers,
Short version: is memory event supported on AMD CPUs or is it going to be supported?
Long version:
Environment: LibVMI 0.15.0 + Xen 4.14.3 on an **AMD CPU** (5950x), 64-bit Debian 11 Dom0.
What I am trying to accomplish: register a **memory event** handler, so that I can capture all memory accesses within a specific range issued by any thread, or all memory accesses within any range issued by a specific thread.
What I got instead: an error from LibVMI saying
"xc_hvm_set_mem_access failed with code: -1".
Some investigation: by inspecting the source code of LibVMI, I find the direct cause is one of the libxc functions, 1) xc_set_mem_access or
2) xc_altp2m_set_mem_access, returned error code -1.
After some searching, I found someone else having a similar problem [1]. I also noted LibVMI says:
Quoted 2 lines
Currently only the Xen Hypervisor provides these features, and some of these are specifically only available on Intel CPUs
However, I can't find the exact confirmation for the availability of memory event on AMD CPUs from https://wiki.xenproject.org.
Any suggestion?
(Sorry I was sending this email to the wrong place)
[1] https://github.com/libvmi/libvmi/pull/709#discussion_r353729777
Untitled YAN
Quoted 21 lines · YAN Untitled
Dear developers,
Short version: is memory event supported on AMD CPUs or is it going to be supported?
Long version:
Environment: LibVMI 0.15.0 + Xen 4.14.3 on an **AMD CPU** (5950x), 64-bit Debian 11 Dom0.
What I am trying to accomplish: register a **memory event** handler, so that I can capture all memory accesses within a specific range issued by any thread, or all memory accesses within any range issued by a specific thread.
What I got instead: an error from LibVMI saying
"xc_hvm_set_mem_accessfailed with code: -1".Some investigation: by inspecting the source code of LibVMI, I find the direct cause is one of the libxc functions, 1)
xc_set_mem_accessor
2)xc_altp2m_set_mem_access, returned error code -1.
Quoted 8 lines
After some searching, I found someone else having a similar problem [1]. I also noted LibVMI says:
Quoted 2 lines
Currently only the Xen Hypervisor provides these features, and some of these are specifically only available on Intel CPUs
However, I can't find the exact confirmation for the availability of memory event on AMD CPUs from https://wiki.xenproject.org.
Aiui underlying what you want is altp2m, which presently depends (in the hypervisor) on EPT being available (and in use for the guest in question).
Jan
Original email:
From: Jan Beulich <[email protected]>
Sent: Wednesday, November 24, 2021 15:54
To: YAN Untitled <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: About support for memory event on AMD CPUs
Quoted 28 lines · YAN Untitled
Quoted 27 lines
Dear developers,
Short version: is memory event supported on AMD CPUs or is it going to be supported?
Long version:
Environment: LibVMI 0.15.0 + Xen 4.14.3 on an **AMD CPU** (5950x), 64-bit Debian 11 Dom0.
What I am trying to accomplish: register a **memory event** handler, so that I can capture all memory accesses within a specific range issued by any thread, or all memory accesses within any range issued by a specific thread.
What I got instead: an error from LibVMI saying
"xc_hvm_set_mem_accessfailed with code: -1".Some investigation: by inspecting the source code of LibVMI, I find the direct cause is one of the libxc functions, 1)
xc_set_mem_accessor
2)xc_altp2m_set_mem_access, returned error code -1.After some searching, I found someone else having a similar problem [1]. I also noted LibVMI says:
Quoted 2 lines
Currently only the Xen Hypervisor provides these features, and some of these are specifically only available on Intel CPUs
Quoted 8 lines
Quoted 2 lines
However, I can't find the exact confirmation for the availability of memory event on AMD CPUs from https://wiki.xenproject.org.
Aiui underlying what you want is altp2m, which presently depends (in the hypervisor) on EPT being available (and in use for the guest in question).
Jan
Dear Jan,
Thanks for your reply. I really appreciate the information. After some searching with the keyword "EPT" I found [1]. So I checked on dom0 with "xl dmesg | grep HAP", which says:
Quoted 2 lines
(XEN) HVM: Hardware Assisted Paging (HAP) detected (XEN) HVM: HAP page sizes: 4kB, 2MB, 1GB
And the guest is an HVM guest running Debian 10 with kernel v4.16 built from source. Most of the configuration of the guest is generated by virt-manager. The "xl list -l" shows that there is no explicit configuration for EPT, RVI or HAP, but it does say the "type" is "hvm". So I am still quite confusing:
1. Is memory event feature for AMD's RVI is even implemented?
2. If memory event should be working on AMD CPUs with RVI enabled, am I missing any essential step to make it work?
[1] https://groups.google.com/g/vmitools/c/JRN11E64BNY
Untitled YAN
Quoted 51 lines · Untitled YAN
Original email:
From: Jan Beulich <[email protected]>
Sent: Wednesday, November 24, 2021 15:54
To: YAN Untitled <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: About support for memory event on AMD CPUsQuoted 28 lines · YAN Untitled
Quoted 27 lines
Dear developers,
Short version: is memory event supported on AMD CPUs or is it going to be supported?
Long version:
Environment: LibVMI 0.15.0 + Xen 4.14.3 on an **AMD CPU** (5950x), 64-bit Debian 11 Dom0.
What I am trying to accomplish: register a **memory event** handler, so that I can capture all memory accesses within a specific range issued by any thread, or all memory accesses within any range issued by a specific thread.
What I got instead: an error from LibVMI saying
"xc_hvm_set_mem_accessfailed with code: -1".Some investigation: by inspecting the source code of LibVMI, I find the direct cause is one of the libxc functions, 1)
xc_set_mem_accessor
2)xc_altp2m_set_mem_access, returned error code -1.After some searching, I found someone else having a similar problem [1]. I also noted LibVMI says:
Quoted 2 lines
Currently only the Xen Hypervisor provides these features, and some of these are specifically only available on Intel CPUs
Quoted 8 lines
Quoted 2 lines
However, I can't find the exact confirmation for the availability of memory event on AMD CPUs from https://wiki.xenproject.org.
Aiui underlying what you want is altp2m, which presently depends (in the hypervisor) on EPT being available (and in use for the guest in question).
Jan
Dear Jan,
Thanks for your reply. I really appreciate the information. After some searching with the keyword "EPT" I found [1]. So I checked on dom0 with "xl dmesg | grep HAP", which says:
Quoted 7 lines
Quoted 2 lines
(XEN) HVM: Hardware Assisted Paging (HAP) detected (XEN) HVM: HAP page sizes: 4kB, 2MB, 1GB
And the guest is an HVM guest running Debian 10 with kernel v4.16 built from source. Most of the configuration of the guest is generated by virt-manager. The "xl list -l" shows that there is no explicit configuration for EPT, RVI or HAP, but it does say the "type" is "hvm".
HAP is the term covering EPT on the Intel side and NPT for AMD.
Jan
Original email:
From: Jan Beulich <[email protected]>
Sent: Wednesday, November 24, 2021 17:27
To: Untitled YAN <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: About support for memory event on AMD CPUs
Quoted 55 lines · Untitled YAN
Quoted 54 lines
Original email:
From: Jan Beulich <[email protected]>
Sent: Wednesday, November 24, 2021 15:54
To: YAN Untitled <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected] enproject.>org>
Subject: Re: About support for memory event on AMD CPUsQuoted 28 lines · YAN Untitled
Quoted 27 lines
Dear developers,
Short version: is memory event supported on AMD CPUs or is it going to be supported?
Long version:
Environment: LibVMI 0.15.0 + Xen 4.14.3 on an **AMD CPU** (5950x), 64-bit Debian 11 Dom0.
What I am trying to accomplish: register a **memory event** handler, so that I can capture all memory accesses within a specific range issued by any thread, or all memory accesses within any range issued by a specific thread.
What I got instead: an error from LibVMI saying
"xc_hvm_set_mem_accessfailed with code: -1".Some investigation: by inspecting the source code of LibVMI, I find the direct cause is one of the libxc functions, 1)
xc_set_mem_accessor
2)xc_altp2m_set_mem_access, returned error code -1.After some searching, I found someone else having a similar problem [1]. I also noted LibVMI says:
Quoted 2 lines
Currently only the Xen Hypervisor provides these features, and some of these are specifically only available on Intel CPUs
Quoted 8 lines
Quoted 2 lines
However, I can't find the exact confirmation for the availability of memory event on AMD CPUs from https://wiki.xenproject.org.
Aiui underlying what you want is altp2m, which presently depends (in the hypervisor) on EPT being available (and in use for the guest in question).
Jan
Dear Jan,
Thanks for your reply. I really appreciate the information. After some searching with the keyword "EPT" I found [1]. So I checked on dom0 with "xl dmesg | grep HAP", which says:
Quoted 2 lines
(XEN) HVM: Hardware Assisted Paging (HAP) detected (XEN) HVM: HAP page sizes: 4kB, 2MB, 1GB
Quoted 8 lines
Quoted 4 lines
And the guest is an HVM guest running Debian 10 with kernel v4.16 built from source. Most of the configuration of the guest is generated by virt-manager. The "xl list -l" shows that there is no explicit configuration for EPT, RVI or HAP, but it does say the "type" is "hvm".
HAP is the term covering EPT on the Intel side and NPT for AMD.
Jan
Dear Jan,
Yeah that's why I wanted to confirm if the HAP is enabled for the guest - it turns out it is enabled but for some reason, xc_altp2m_set_mem_access failed. I am trying to replicate my setup on an Intel machine to find out if it's a configuration problem. Still don't know if it's implemented for AMD but thanks for your help and information.
Untitled YAN
Altp2m is only available on Intel, mem_access (restricting permissions) is only available on Intel and ARM. No technical reason for it not working on AMD, it just hasn't been implemented in Xen.
Tamas
Quoted 102 lines · Untitled YAN
Original email:
From: Jan Beulich <[email protected]>
Sent: Wednesday, November 24, 2021 17:27
To: Untitled YAN <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] < [email protected]>; [email protected] < [email protected]>; [email protected] < [email protected]>
Subject: Re: About support for memory event on AMD CPUsQuoted 7 lines · Untitled YAN
Quoted 6 lines
Original email:
From: Jan Beulich <[email protected]>
Sent: Wednesday, November 24, 2021 15:54
To: YAN Untitled <[email protected]>
Cc: [email protected] <[email protected]>; [email protected]<[email protected]>; [email protected] < [email protected]>; [email protected] <[email protected] enproject.>org>
Quoted 6 lines
Quoted 6 lines
Subject: Re: About support for memory event on AMD CPUs
Quoted 4 lines · YAN Untitled
Quoted 3 lines
Dear developers,
Short version: is memory event supported on AMD CPUs or is it going
to be
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
supported?
Long version:
Environment: LibVMI 0.15.0 + Xen 4.14.3 on an **AMD CPU** (5950x),
64-bit
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Debian 11 Dom0.
What I am trying to accomplish: register a **memory event** handler,
so that
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
I can capture all memory accesses within a specific range issued by
any thread,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
or all memory accesses within any range issued by a specific thread.
What I got instead: an error from LibVMI saying
"xc_hvm_set_mem_accessfailed with code: -1".Some investigation: by inspecting the source code of LibVMI, I find
the direct
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
cause is one of the libxc functions, 1)
xc_set_mem_accessor
2)xc_altp2m_set_mem_access, returned error code -1.After some searching, I found someone else having a similar problem
[1]. I also
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
noted LibVMI says:
Quoted 2 lines
Currently only the Xen Hypervisor provides these features, and some of these are specifically only available on Intel CPUs
However, I can't find the exact confirmation for the availability of
memory
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
event on AMD CPUs from https://wiki.xenproject.org.
Aiui underlying what you want is altp2m, which presently depends (in the hypervisor) on EPT being available (and in use for the guest in question).
Jan
Dear Jan,
Quoted 8 lines
Quoted 8 lines
Thanks for your reply. I really appreciate the information. After some searching with the keyword "EPT" I found [1]. So I checked on dom0 with "xl dmesg | grep HAP", which says:
Quoted 2 lines
(XEN) HVM: Hardware Assisted Paging (HAP) detected (XEN) HVM: HAP page sizes: 4kB, 2MB, 1GB
And the guest is an HVM guest running Debian 10 with kernel v4.16
built from
Quoted 1 line
Quoted 1 line
source. Most of the configuration of the guest is generated by
virt-manager.
Quoted 1 line
Quoted 1 line
The "xl list -l" shows that there is no explicit configuration for
EPT, RVI or
Quoted 5 lines
Quoted 1 line
HAP, but it does say the "type" is "hvm".
HAP is the term covering EPT on the Intel side and NPT for AMD.
Jan
Dear Jan,
Yeah that's why I wanted to confirm if the HAP is enabled for the guest - it
turns out it is enabled but for some reason,xc_altp2m_set_mem_accessfailed.
I am trying to replicate my setup on an Intel machine to find out if it's a configuration problem. Still don't know if it's implemented for AMD but thanks
for your help and information.Untitled YAN
Original email:
From: Tamas K Lengyel <[email protected]>
Sent: Wednesday, November 24, 2021 21:12
To: Untitled YAN <[email protected]>
Cc: Jan Beulich <[email protected]>; Alexandru Isaila <[email protected]>; Petre Pircalabu <[email protected]>; Xen-devel <[email protected]>
Subject: Re: About support for memory event on AMD CPUs
Quoted 79 lines
Altp2m is only available on Intel,
mem_access(restricting permissions) is only available on Intel and ARM. No technical reason for it not working on AMD, it just hasn't been implemented in Xen.Tamas
On Wed, Nov 24, 2021, 4:44 AM Untitled YAN <[email protected]> wrote:
Original email:From: Jan Beulich <[email protected]>
Sent: Wednesday, November 24, 2021 17:27
To: Untitled YAN <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected].> org>
Subject: Re: About support for memory event on AMD CPUsQuoted 55 lines · Untitled YAN
Quoted 54 lines
Original email:
From: Jan Beulich <[email protected]>
Sent: Wednesday, November 24, 2021 15:54
To: YAN Untitled <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected] > enproject.>org>
Subject: Re: About support for memory event on AMD CPUsQuoted 28 lines · YAN Untitled
Quoted 27 lines
Dear developers,
Short version: is memory event supported on AMD CPUs or is it going to be supported?
Long version:
Environment: LibVMI 0.15.0 + Xen 4.14.3 on an **AMD CPU** (5950x), 64-bit Debian 11 Dom0.
What I am trying to accomplish: register a **memory event** handler, so that I can capture all memory accesses within a specific range issued by any thread, or all memory accesses within any range issued by a specific thread.
What I got instead: an error from LibVMI saying
"xc_hvm_set_mem_accessfailed with code: -1".Some investigation: by inspecting the source code of LibVMI, I find the direct cause is one of the libxc functions, 1)
xc_set_mem_accessor
2)xc_altp2m_set_mem_access, returned error code -1.After some searching, I found someone else having a similar problem [1]. I also noted LibVMI says:
Quoted 2 lines
Currently only the Xen Hypervisor provides these features, and some of these are specifically only available on Intel CPUs
Quoted 8 lines
Quoted 2 lines
However, I can't find the exact confirmation for the availability of memory event on AMD CPUs from https://wiki.xenproject.org.
Aiui underlying what you want is altp2m, which presently depends (in the hypervisor) on EPT being available (and in use for the guest in question).
Jan
Dear Jan,
Thanks for your reply. I really appreciate the information. After some searching with the keyword "EPT" I found [1]. So I checked on dom0 with "xl dmesg | grep HAP", which says:
Quoted 2 lines
(XEN) HVM: Hardware Assisted Paging (HAP) detected (XEN) HVM: HAP page sizes: 4kB, 2MB, 1GB
Quoted 8 lines
Quoted 4 lines
And the guest is an HVM guest running Debian 10 with kernel v4.16 built from source. Most of the configuration of the guest is generated by virt-manager. The "xl list -l" shows that there is no explicit configuration for EPT, RVI or HAP, but it does say the "type" is "hvm".
HAP is the term covering EPT on the Intel side and NPT for AMD.
Jan
Dear Jan,
Quoted 8 lines
Yeah that's why I wanted to confirm if the HAP is enabled for the guest - it turns out it is enabled but for some reason,
xc_altp2m_set_mem_accessfailed. I am trying to replicate my setup on an Intel machine to find out if it's a configuration problem. Still don't know if it's implemented for AMD but thanks for your help and information.Untitled YAN
Dear Tamas,
Thanks for your clear answer. So I will watch the update note, or maybe I will try to get an Intel machine for my experiments. Thanks!
Untitled YAN