From: Avi Kivity <avi@redhat.com>
To: "François Diakhate" <fdiakh@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: Fix kvm_free_physmem_slot memory leak.
Date: Thu, 06 Nov 2008 17:14:18 +0200 [thread overview]
Message-ID: <491309CA.8030605@redhat.com> (raw)
In-Reply-To: <6ad07c640810280257q5cc7f425rccd01617a9347c3b@mail.gmail.com>
(late reply, sorry)
François Diakhate wrote:
> [Sorry, I realized I forgot to check style, here is the fixed patch]
>
> Make sure that kvm_free_physmem_slot also frees the VM memory
> if it was allocated by the kernel.
>
> /*
> * Free any memory in @free but not in @dont.
> */
> -static void kvm_free_physmem_slot(struct kvm_memory_slot *free,
> +static void kvm_free_physmem_slot(struct kvm *kvm,
> + struct kvm_memory_slot *free,
> struct kvm_memory_slot *dont)
> {
> + if (!dont || free->userspace_addr != dont->userspace_addr) {
> + struct kvm_userspace_memory_region mem = {
> + .slot = memslot_id(kvm, free),
> + .guest_phys_addr = free->base_gfn << PAGE_SHIFT,
> + .memory_size = 0,
> + .flags = 0,
> + };
> + kvm_arch_set_memory_region(kvm, &mem, *free, free->user_alloc);
> + }
> +
> if (!dont || free->rmap != dont->rmap)
>
What happens here if the both free and dont have nonzero, differnt
->userspace_addr values? Is is even possible?
Also, the call chain is fishy. set_memory_region calls
free_physmem_slot which calls arch_set_memory_region. This is turning
into pasta.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2008-11-06 15:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-28 9:08 [PATCH 2/2] KVM: Fix kvm_free_physmem_slot memory leak François Diakhate
2008-10-28 9:57 ` François Diakhate
2008-11-06 15:14 ` Avi Kivity [this message]
2008-11-07 12:16 ` François Diakhate
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=491309CA.8030605@redhat.com \
--to=avi@redhat.com \
--cc=fdiakh@gmail.com \
--cc=kvm@vger.kernel.org \
/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