[PATCH 0/1] Fix energy calcultation in RAPL MSR

2024-08-07 Thread Anthony Harivel
i.e -smp 4 / -smp 8,sockets=2,dies=1 / -smp 8,sockets=4,dies=2 ) Anthony Harivel (1): target/i386: Fix arguments for vmsr_read_thread_stat() target/i386/kvm/kvm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.45.2

[PATCH 1/1] target/i386: Fix arguments for vmsr_read_thread_stat()

2024-08-07 Thread Anthony Harivel
Snapshot of the stat utime and stime for each thread, taken before and after the pause, must be stored in separate locations Signed-off-by: Anthony Harivel --- target/i386/kvm/kvm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386

[PATCH 0/2] Fix RAPL MSR support in staging

2024-07-26 Thread Anthony Harivel
Hi Paolo, RAPL MSR has landed in staging with few scratches. Here a couple of patches to solves CID 1558553 and 1558557. Anthony Anthony Harivel (2): target/i386: Fix typo that assign same value twice target/i386: Clean output of vmsr_read_thread_stat() target/i386/kvm/kvm.c | 4

[PATCH 2/2] target/i386: Clean output of vmsr_read_thread_stat()

2024-07-26 Thread Anthony Harivel
Fix leaking memory of file handle in case of error Erase unused "pid = -1" Add clearer error_report Should fix: CID 1558557 Signed-off-by: Anthony Harivel --- target/i386/kvm/vmsr_energy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/i386/kvm/vmsr_

[PATCH 1/2] target/i386: Fix typo that assign same value twice

2024-07-26 Thread Anthony Harivel
Should fix: CID 1558553 Signed-off-by: Anthony Harivel --- target/i386/kvm/kvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index b4aab9a410b5..31f149c9902c 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c

Re: [PATCH v6 0/3] Add support for the RAPL MSRs series

2024-06-26 Thread Anthony Harivel
Just a gentle ping for the above patch series. Anthony Harivel, May 22, 2024 at 17:34: > Dear maintainers, > > First of all, thank you very much for your review of my patch > [1]. > > In this version (v6), I have attempted to address all the problems > addressed by Da

[PATCH v6 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-05-22 Thread Anthony Harivel
h=/path/sock.sock Actual limitation: - Works only on Intel host CPU because AMD CPUs are using different MSR adresses. - Only the Package Power-Plane (MSR_PKG_ENERGY_STATUS) is reported at the moment. Signed-off-by: Anthony Harivel --- accel/kvm/kvm-all.c | 27 +++ docs/specs/index.r

[PATCH v6 1/3] qio: add support for SO_PEERCRED for socket channel

2024-05-22 Thread Anthony Harivel
sending process */ gid_t gid;/* Group ID of the sending process */ }; The use of this function is possible only for connected AF_UNIX stream sockets and for AF_UNIX stream and datagram socket pairs. On platform other than Linux, the function return 0. Signed-off-by: Anthony Harivel

[PATCH v6 2/3] tools: build qemu-vmsr-helper

2024-05-22 Thread Anthony Harivel
but can be extended to support AMD CPUs in the future. Signed-off-by: Anthony Harivel --- contrib/systemd/qemu-vmsr-helper.service | 15 + contrib/systemd/qemu-vmsr-helper.socket | 9 + docs/tools/index.rst | 1 + docs/tools/qemu-vmsr-helper.rst | 89 m

[PATCH v6 0/3] Add support for the RAPL MSRs series

2024-05-22 Thread Anthony Harivel
html [4]: https://mail.gnu.org/archive/html/qemu-devel/2024-04/msg02481.html Anthony Harivel (3): qio: add support for SO_PEERCRED for socket channel tools: build qemu-vmsr-helper Add support for RAPL MSRs in KVM/Qemu accel/kvm/kvm-all.c | 27 ++ contrib/systemd/qemu-v

Re: [PATCH v5 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-05-06 Thread Anthony Harivel
Anthony Harivel, Apr 26, 2024 at 10:36: > > Hi Paolo, > > Daniel P. Berrangé, Apr 25, 2024 at 17:42: > > On Thu, Apr 25, 2024 at 05:34:52PM +0200, Anthony Harivel wrote: > > > Hi Daniel, > > > > > > Daniel P. Berrangé, Apr 18, 2024 at 18:42: > &g

Re: [PATCH v5 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-04-26 Thread Anthony Harivel
Hi Paolo, Daniel P. Berrangé, Apr 25, 2024 at 17:42: > On Thu, Apr 25, 2024 at 05:34:52PM +0200, Anthony Harivel wrote: > > Hi Daniel, > > > > Daniel P. Berrangé, Apr 18, 2024 at 18:42: > > > > > > +if (kvm_is_rapl_feat_enable(cs)) {

Re: [PATCH v5 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-04-25 Thread Anthony Harivel
Hi Daniel, Daniel P. Berrangé, Apr 18, 2024 at 18:42: > > +if (kvm_is_rapl_feat_enable(cs)) { > > +if (!IS_INTEL_CPU(env)) { > > +error_setg(errp, "RAPL feature can only be\ > > + enabled with Intel CPU models"); > > +return fal

Re: [PATCH v5 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-04-18 Thread Anthony Harivel
Hi Daniel, Daniel P. Berrangé, Apr 18, 2024 at 18:42: > On Thu, Apr 11, 2024 at 02:14:34PM +0200, Anthony Harivel wrote: > > Starting with the "Sandy Bridge" generation, Intel CPUs provide a RAPL > > interface (Running Average Power Limit) for advertising the accumulat

Re: [PATCH v5 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-04-18 Thread Anthony Harivel
Hi Zhao, Zhao Liu, Apr 17, 2024 at 12:07: > Hi Anthony, > > May I ask what your usage scenario is? Is it to measure Guest's energy > consumption and to charged per watt consumed? ;-) See previous email from Daniel. > On Thu, Apr 11, 2024 at 02:14:34PM +0200, Anthony Har

Re: [PATCH v5 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-04-18 Thread Anthony Harivel
RAPL MSRs in KVM/Qemu > > > > On Wed, Apr 17, 2024 at 06:07:02PM +0800, Zhao Liu wrote: > > > Hi Anthony, > > > > > > May I ask what your usage scenario is? Is it to measure Guest's energy > > > consumption and to charged per watt consumed? ;-)

Re: [PATCH v5 0/3] Add support for the RAPL MSRs series

2024-04-18 Thread Anthony Harivel
Hi Daniel, Daniel P. Berrangé, Apr 17, 2024 at 19:23: > On Thu, Apr 11, 2024 at 02:14:31PM +0200, Anthony Harivel wrote: > > Dear maintainers, > > > > First of all, thank you very much for your review of my patch > > [1]. > > > > In this version (v

[PATCH v5 1/3] qio: add support for SO_PEERCRED for socket channel

2024-04-11 Thread Anthony Harivel
sending process */ gid_t gid;/* Group ID of the sending process */ }; The use of this function is possible only for connected AF_UNIX stream sockets and for AF_UNIX stream and datagram socket pairs. On platform other than Linux, the function return 0. Signed-off-by: Anthony Harivel

[PATCH v5 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-04-11 Thread Anthony Harivel
h=/path/sock.sock Actual limitation: - Works only on Intel host CPU because AMD CPUs are using different MSR adresses. - Only the Package Power-Plane (MSR_PKG_ENERGY_STATUS) is reported at the moment. Signed-off-by: Anthony Harivel --- accel/kvm/kvm-all.c | 27 +++ docs/specs/index.r

[PATCH v5 0/3] Add support for the RAPL MSRs series

2024-04-11 Thread Anthony Harivel
t regards, Anthony [1]: https://lists.gnu.org/archive/html/qemu-devel/2024-03/msg04417.html Anthony Harivel (3): qio: add support for SO_PEERCRED for socket channel tools: build qemu-vmsr-helper Add support for RAPL MSRs in KVM/Qemu accel/kvm/kvm-all.c | 27

[PATCH v5 2/3] tools: build qemu-vmsr-helper

2024-04-11 Thread Anthony Harivel
but can be extended to support AMD CPUs in the future. Signed-off-by: Anthony Harivel --- contrib/systemd/qemu-vmsr-helper.service | 15 + contrib/systemd/qemu-vmsr-helper.socket | 9 + docs/tools/index.rst | 1 + docs/tools/qemu-vmsr-helper.rst | 89 m

Re: [PATCH v4 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-04-05 Thread Anthony Harivel
Hi Daniel, > > +SocketAddress saddr = { > > +.type = SOCKET_ADDRESS_TYPE_UNIX, > > +.u.q_unix.path = socket_path > > +}; > > +QIOChannelSocket *sioc = qio_channel_socket_new(); > > +Error *local_err = NULL; > > + > > +int r; > > + > > +qio_channel_set_name(Q

Re: [PATCH v4 2/3] tools: build qemu-vmsr-helper

2024-03-28 Thread Anthony Harivel
Hi Daniel, My apologies for all the missed feedback in v2. I'll be more organized for my next iteration. For this specific comment below, I would like to make sure I'm testing the right way. > > diff --git a/meson.build b/meson.build > > index b375248a7614..376da49b60ab 100644 > > --- a/mes

[PATCH v4 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-03-18 Thread Anthony Harivel
h=/path/sock.sock Actual limitation: - Works only on Intel host CPU because AMD CPUs are using different MSR adresses. - Only the Package Power-Plane (MSR_PKG_ENERGY_STATUS) is reported at the moment. Signed-off-by: Anthony Harivel --- accel/kvm/kvm-all.c | 27 +++ docs/specs/index.r

[PATCH v4 2/3] tools: build qemu-vmsr-helper

2024-03-18 Thread Anthony Harivel
but can be extended to support AMD CPUs in the future. Signed-off-by: Anthony Harivel --- contrib/systemd/qemu-vmsr-helper.service | 15 + contrib/systemd/qemu-vmsr-helper.socket | 9 + docs/tools/index.rst | 1 + docs/tools/qemu-vmsr-helper.rst | 89 m

[PATCH v4 0/3] Add support for the RAPL MSRs series

2024-03-18 Thread Anthony Harivel
ion and usage Best regards, Anthony [1]: https://lore.kernel.org/all/20240125072214.318382-1-ahari...@redhat.com/#t Anthony Harivel (3): qio: add support for SO_PEERCRED for socket channel tools: build qemu-vmsr-helper Add support for RAPL MSRs in KVM/Qemu accel/kvm/kvm-all.c

[PATCH v4 1/3] qio: add support for SO_PEERCRED for socket channel

2024-03-18 Thread Anthony Harivel
sending process */ gid_t gid;/* Group ID of the sending process */ }; The use of this function is possible only for connected AF_UNIX stream sockets and for AF_UNIX stream and datagram socket pairs. On platform other than Linux, the function return 0. Signed-off-by: Anthony Harivel

Re: [PATCH v3 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-03-14 Thread Anthony Harivel
Hi Daniel, > You don't need to access it via the /node/ hierarchy > > The canonical path for CPUs would be > > /sys/devices/system/cpu/cpuNNN/topology > > The core_cpus_list file is giving you hyper-thread siblings within > a core, which I don't think is what you want. > > If you're after dis

Re: [PATCH v3 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-03-13 Thread Anthony Harivel
Hi Daniel, Daniel P. Berrangé, Mar 12, 2024 at 16:49: > The point still stands though. NUMA node ID numbers are not > guaranteed to be the same as socket ID numbers. Very often > then will be the same (which makes it annoying to test as it > is easy to not realize the difference), but we can't re

Re: [PATCH v3 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-03-12 Thread Anthony Harivel
Hi Daniel, Paolo, Here my last questions before wrapping up and send v4, or maybe call off my attempt to add RAPL interface in QEMU. Daniel P. Berrangé, Jan 30, 2024 at 10:39: > > +rcu_register_thread(); > > + > > +/* Get QEMU PID*/ > > +pid = getpid(); > > + > > +/* Nb of CPUS

Re: [PATCH v3 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-03-05 Thread Anthony Harivel
Hi Daniel, > > + > > +/* Retrieve all packages power plane energy counter */ > > +for (int i = 0; i <= maxpkgs; i++) { > > +for (int j = 0; j < num_threads; j++) { > > +/* > > + * Use the first thread we found that ran on the CPU > > +

Re: [PATCH v3 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-03-05 Thread Anthony Harivel
Daniel P. Berrangé, Mar 04, 2024 at 15:48: > On Mon, Mar 04, 2024 at 03:41:02PM +0100, Anthony Harivel wrote: > > > > Hi Daniel, > > > > > > +if (s->msr_energy.enable == true) { > > > > > > This looks to be where we need to check

Re: [PATCH v3 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-03-04 Thread Anthony Harivel
Hi Daniel, > > +if (s->msr_energy.enable == true) { > > This looks to be where we need to check that both the host CPU > vendor is intel, and the guest CPU vendor is intel, and that > the host CPU has the RAPL feature we're using. > > With regards, > Daniel > -- > |: https://berrange.co

Re: [PATCH v3 2/3] tools: build qemu-vmsr-helper

2024-03-01 Thread Anthony Harivel
Hi Paolo, > > > +static void compute_default_paths(void) > > > +{ > > > +socket_path = g_build_filename("/run", "qemu-vmsr-helper.sock", > > > NULL); > > > +pidfile = g_build_filename("/run", "qemu-vmsr-helper.pid", NULL); > > > +} > > > > We shouldn't be hardcoding /run, we need to honou

Re: [PATCH v3 2/3] tools: build qemu-vmsr-helper

2024-02-21 Thread Anthony Harivel
Daniel P. Berrangé, Feb 21, 2024 at 14:47: > On Wed, Feb 21, 2024 at 02:19:11PM +0100, Anthony Harivel wrote: > > Daniel P. Berrangé, Jan 29, 2024 at 20:45: > > > On Mon, Jan 29, 2024 at 08:33:21PM +0100, Paolo Bonzini wrote: > > > > On Mon, Jan 29, 2024

Re: [PATCH v3 2/3] tools: build qemu-vmsr-helper

2024-02-21 Thread Anthony Harivel
Daniel P. Berrangé, Jan 29, 2024 at 20:45: > On Mon, Jan 29, 2024 at 08:33:21PM +0100, Paolo Bonzini wrote: > > On Mon, Jan 29, 2024 at 7:53 PM Daniel P. Berrangé > > wrote: > > > > diff --git a/meson.build b/meson.build > > > > index d0329966f1b4..93fc233b0891 100644 > > > > --- a/meson.build >

Re: [PATCH v3 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-02-20 Thread Anthony Harivel
Daniel P. Berrangé, Jan 29, 2024 at 20:29: > On Thu, Jan 25, 2024 at 08:22:14AM +0100, Anthony Harivel wrote: > > diff --git a/docs/specs/rapl-msr.rst b/docs/specs/rapl-msr.rst > > new file mode 100644 > > index ..04d27c198fc0 > > --- /dev/null > &

[PATCH v3 0/3] Add support for the RAPL MSRs series

2024-01-24 Thread Anthony Harivel
age Best regards, Anthony [1]: https://www.mail-archive.com/qemu-devel@nongnu.org/msg1003382.html Anthony Harivel (3): qio: add support for SO_PEERCRED for socket channel tools: build qemu-vmsr-helper Add support for RAPL MSRs in KVM/Qemu accel/kvm/kvm-all.c | 27 ++

[PATCH v3 3/3] Add support for RAPL MSRs in KVM/Qemu

2024-01-24 Thread Anthony Harivel
h=/path/sock.sock Actual limitation: - Works only on Intel host CPU because AMD CPUs are using different MSR adresses. - Only the Package Power-Plane (MSR_PKG_ENERGY_STATUS) is reported at the moment. Signed-off-by: Anthony Harivel --- accel/kvm/kvm-all.c | 27 +++ docs/specs/index.r

[PATCH v3 1/3] qio: add support for SO_PEERCRED for socket channel

2024-01-24 Thread Anthony Harivel
sending process */ gid_t gid;/* Group ID of the sending process */ }; The use of this function is possible only for connected AF_UNIX stream sockets and for AF_UNIX stream and datagram socket pairs. On platform other than Linux, the function return 0. Signed-off-by: Anthony Harivel

[PATCH v3 2/3] tools: build qemu-vmsr-helper

2024-01-24 Thread Anthony Harivel
but can be extended to support AMD CPUs in the future. Signed-off-by: Anthony Harivel --- contrib/systemd/qemu-vmsr-helper.service | 15 + contrib/systemd/qemu-vmsr-helper.socket | 9 + docs/tools/index.rst | 1 + docs/tools/qemu-vmsr-helper.rst | 89 m

[PATCH v2 1/3] qio: add support for SO_PEERCRED for socket channel

2023-10-31 Thread Anthony Harivel
sending process */ gid_t gid;/* Group ID of the sending process */ }; The use of this function is possible only for connected AF_UNIX stream sockets and for AF_UNIX stream and datagram socket pairs. Signed-off-by: Anthony Harivel --- include/io/channel.h | 20 io

[PATCH v2 0/3] Add support for RAPL MSRs series

2023-10-31 Thread Anthony Harivel
-devel/20230616140830.316655-1-ahari...@redhat.com/ Anthony Harivel (3): qio: add support for SO_PEERCRED for socket channel tools: build qemu-vmsr-helper Add support for RAPL MSRs in KVM/Qemu accel/kvm/kvm-all.c | 26 ++ docs/specs/index.rst| 1 + docs/specs/rapl-m

[PATCH v2 2/3] tools: build qemu-vmsr-helper

2023-10-31 Thread Anthony Harivel
defined in rapl-msr-index.h. This list corresponds to the RAPL MSRs that will be supported in the next commit titled "Add support for RAPL MSRs in KVM/QEMU." Signed-off-by: Anthony Harivel --- docs/tools/index.rst| 1 + docs/tools/qemu-vmsr-helper.rst | 89 ++ m

[PATCH v2 3/3] Add support for RAPL MSRs in KVM/Qemu

2023-10-31 Thread Anthony Harivel
reality. There must be a single vCPU per virtual socket (e.g.: -smp 4,sockets=4). Accessing pkg-0 energy will give vCPU 0 energy, pkg-1 will give vCPU 1 energy, etc. Signed-off-by: Anthony Harivel accel/kvm/kvm-all.c | 26 +++ docs/specs/index.rst | 1 + docs/specs

Re: [PATCH] Add support for RAPL MSRs in KVM/Qemu

2023-06-28 Thread Anthony Harivel
Marcelo Tosatti, Jun 28, 2023 at 19:26: Hi Marcelo, > On Fri, Jun 16, 2023 at 04:08:30PM +0200, Anthony Harivel wrote: > This feature is activated with -accel kvm,rapl=true. > >> I suppose this should be a CPU flag instead? -cpu xxx,rapl=on. It's possible yes then I might ne

[PATCH] Add support for RAPL MSRs in KVM/Qemu

2023-06-16 Thread Anthony Harivel
an independent vMSR value, the vCPU topology must be changed to match that reality. There must be a single vCPU per virtual socket (e.g.: -smp 4,sockets=4). Accessing pkg-0 energy will give vCPU 0 energy, pkg-1 will give vCPU 1 energy, etc. Signed-off-by: Anthony Harivel --- Notes: This

Re: [RFC PATCH] Add support for RAPL MSRs in KVM/Qemu

2023-05-24 Thread Anthony Harivel
UNIT \ > > > > +handler: %s", > > > > + strerror(-ret)); > > > > +exit(1); > > > > +} > > > > + > > > > +r = kvm_filte

Re: [RFC PATCH] Add support for RAPL MSRs in KVM/Qemu

2023-05-19 Thread Anthony Harivel
Philippe Mathieu-Daudé, May 19, 2023 at 13:32: Hi Philippe, > > +/* > > + * Package statistic > > + * @ e_start: package energy counter before the sleep > > + * @ e_end: package energy counter after the sleep > > + * @ e_delta: delta of package energy counter > > + * @ e_ratio: store the energy r

Re: [RFC PATCH] Add support for RAPL MSRs in KVM/Qemu

2023-05-18 Thread Anthony Harivel
Marcelo Tosatti, May 17, 2023 at 17:43: Hi Marcelo, > On Wed, May 17, 2023 at 03:07:30PM +0200, Anthony Harivel wrote: > diff --git a/target/i386/cpu.h b/target/i386/cpu.h > > index 8504aaac6807..14f9c2901680 100644 > > --- a/target/i386/cpu.h > > +++ b/target/i386/cpu

[RFC PATCH] Add support for RAPL MSRs in KVM/Qemu

2023-05-17 Thread Anthony Harivel
an independent vMSR value, the vCPU topology must be changed to match that reality. There must be a single vCPU per virtual socket (e.g.: -smp 4,sockets=4). Accessing pkg-0 energy will give vCPU 0 energy, pkg-1 will give vCPU 1 energy, etc. Signed-off-by: Anthony Harivel --- Notes: