Skip to contentSkip to conversation

How to get the guest physical memory usage from host?

Qemu-devel Zhang Haoyu 3 participants 8 messages Dec 22, 2014 – Jan 3, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

How to get the guest physical memory usage from host? I don't want to introduce a guest-agent to get the info.

Thanks,
Zhang Haoyu

#1 lore raw
Quoted 8 lines · Zhang Haoyu

Hi,

How to get the guest physical memory usage from host? I don't want to introduce a guest-agent to get the info.

Thanks,
Zhang Haoyu

There`s probably one approach, simular to (currently abandoned) virt-dmesg, via peeking to the guest memory directly. What are reasons for not leaving this task to agent, as it looks much simpler?

#2 lore raw
Quoted 6 lines · Andrey Korolyov
Quoted 5 lines · Zhang Haoyu

Hi,

How to get the guest physical memory usage from host? I don't want to introduce a guest-agent to get the info.

Quoted 8 lines
Quoted 3 lines

Thanks,
Zhang Haoyu

There`s probably one approach, simular to (currently abandoned) virt-dmesg, via peeking to the guest memory directly. What are reasons for not leaving this task to agent, as it looks much simpler?

In some cases, we are not permitted to install anything in customer's guest environment.

Thanks,
Zhang Haoyu

#3 lore raw
Quoted 12 lines · Zhang Haoyu
Quoted 10 lines · Andrey Korolyov
Quoted 8 lines · Zhang Haoyu

Hi,

How to get the guest physical memory usage from host? I don't want to introduce a guest-agent to get the info.

Thanks,
Zhang Haoyu

Quoted 8 lines
Quoted 4 lines

There`s probably one approach, simular to (currently abandoned) virt-dmesg, via peeking to the guest memory directly. What are reasons for not leaving this task to agent, as it looks much simpler?

In some cases, we are not permitted to install anything in customer's guest environment.

Thanks,
Zhang Haoyu

Ok, looks like memory peeking techniques are only a choice then. And, of course, this approach tends to be less flexible, because it depends on a relatively strict requirements for running kernel in a guest.

#4 lore raw
Quoted 17 lines · Andrey Korolyov
Quoted 16 lines · Zhang Haoyu
Quoted 14 lines · Andrey Korolyov
Quoted 8 lines · Zhang Haoyu

Hi,

How to get the guest physical memory usage from host? I don't want to introduce a guest-agent to get the info.

Thanks,
Zhang Haoyu

There`s probably one approach, simular to (currently abandoned) virt-dmesg, via peeking to the guest memory directly. What are reasons for not leaving this task to agent, as it looks much simpler?

Quoted 9 lines
Quoted 4 lines

In some cases, we are not permitted to install anything in customer's guest environment.

Thanks,
Zhang Haoyu

Ok, looks like memory peeking techniques are only a choice then. And, of course, this approach tends to be less flexible, because it depends on a relatively strict requirements for running kernel in a guest.

Yes, it should depends on guest os implementation,
because physical memory is managed by OS, which have the full knowledge of memory usage, so I'm afraid that windows dose not friendly support it.
Could you detail the peeking techniques mentioned above?

Thanks,
Zhang Haoyu

#5 lore raw
Quoted 7 lines

Yes, it should depends on guest os implementation,
because physical memory is managed by OS, which have the full knowledge of memory usage, so I'm afraid that windows dose not friendly support it.
Could you detail the peeking techniques mentioned above?

Thanks,
Zhang Haoyu

Generally I meant virDomainMemoryPeek, but nothing prevents you to write code with same functionality, if libvirt usage is not preferred, it is only about asking monitor for chunks of memory and parse them in a proper way.

#6 lore raw
Quoted 5 lines · Andrey Korolyov
Quoted 5 lines

Yes, it should depends on guest os implementation,
because physical memory is managed by OS, which have the full knowledge of memory usage, so I'm afraid that windows dose not friendly support it.
Could you detail the peeking techniques mentioned above?

Quoted 8 lines
Quoted 2 lines

Thanks,
Zhang Haoyu

Generally I meant virDomainMemoryPeek, but nothing prevents you to write code with same functionality, if libvirt usage is not preferred, it is only about asking monitor for chunks of memory and parse them in a proper way.

Thanks, Andrey.

#7 lore raw
In reply to Andrey Korolyov
Quoted 6 lines · Andrey Korolyov
Quoted 5 lines · Zhang Haoyu

Hi,

How to get the guest physical memory usage from host? I don't want to introduce a guest-agent to get the info.

Quoted 7 lines
Quoted 3 lines

Thanks,
Zhang Haoyu

There`s probably one approach, simular to (currently abandoned) virt-dmesg, via peeking to the guest memory directly. What are reasons for not leaving this task to agent, as it looks much simpler?

Fixing virt-dmesg might be better since it has the machinery already for talking to libvirt and accessing the guest kernel memory.

Of course there is approx zero chance that this approach will work for Windows guests.

Rich.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW