From: Peter Xu <peterx@redhat.com>
To: "jack.chen" <zhunxun@gmail.com>
Cc: qemu <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] qemu memory manage question
Date: Mon, 17 Apr 2017 19:19:36 +0800 [thread overview]
Message-ID: <20170417111936.GF16703@pxdev.xzpeter.org> (raw)
In-Reply-To: <CADUDsAqnRJDhYcu2nR-zk5fkJDQ8GKkR7GjO-MrAEiJTt_X+oA@mail.gmail.com>
On Mon, Apr 17, 2017 at 06:55:40PM +0800, jack.chen wrote:
> Thanks,from the path you have list to me,it can be well explained,but
> according to the source code,in the end of
> kvm_init,kvm_memory_listener and kvm_io_listener were registered by
> memory_listener_register(),and in the end of
> memory_listener_register(),listener_add_address_space() was called for
> each address_space,so the listener->region_add was executed then.I do
> not know what mistake I have made,can you explain it to me ?? thank
> you very much!
Firstly, there are two address spaces for each system:
AddressSpace address_space_io;
AddressSpace address_space_memory;
The one you mentioned (kvm_io_listener) should be the listener for
address_space_io, not address_space_memory, while for RAM, it's
located on address_space_memory space.
Secondly, when calling memory_listener_register() in kvm_init(),
region_add() is actually not called, since FOR_EACH_FLAT_RANGE() in
listener_add_address_space() is actually looping nothing since at that
time the address_space_memory may not ever been rendered at all
(rendering should be triggered by memory_region_transaction_commit()
-> address_space_update_topology()).
Thanks,
--
Peter Xu
prev parent reply other threads:[~2017-04-17 11:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-17 10:09 [Qemu-devel] qemu memory manage question jack.chen
2017-04-17 10:26 ` Peter Xu
2017-04-17 10:55 ` jack.chen
2017-04-17 11:19 ` 李强
2017-04-18 2:25 ` jack.chen
2017-04-18 10:48 ` jack.chen
2017-04-17 11:19 ` Peter Xu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170417111936.GF16703@pxdev.xzpeter.org \
--to=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhunxun@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).