mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] KVM: X86: Fix x86_emulator slab cache leak
Date: Fri, 11 Jun 2021 17:53:58 +0200	[thread overview]
Message-ID: <2ea05111-1598-f82c-e868-0615bc003612@redhat.com> (raw)
In-Reply-To: <1623387573-5969-1-git-send-email-wanpengli@tencent.com>

On 11/06/21 06:59, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
> 
> Commit c9b8b07cded58 (KVM: x86: Dynamically allocate per-vCPU emulation context)
> tries to allocate per-vCPU emulation context dynamically, however, the
> x86_emulator slab cache is still exiting after the kvm module is unload
> as below after destroying the VM and unloading the kvm module.
> 
> grep x86_emulator /proc/slabinfo
> x86_emulator          36     36   2672   12    8 : tunables    0    0    0 : slabdata      3      3      0
> 
> This patch fixes this slab cache leak by destroying the x86_emulator slab cache
> when the kvm module is unloaded.
> 
> Fixes: c9b8b07cded58 (KVM: x86: Dynamically allocate per-vCPU emulation context)
> Cc: stable@vger.kernel.org
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
>   arch/x86/kvm/x86.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 6d3955a6a763..fe26f33e8782 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -8258,6 +8258,7 @@ void kvm_arch_exit(void)
>   	kvm_x86_ops.hardware_enable = NULL;
>   	kvm_mmu_module_exit();
>   	free_percpu(user_return_msrs);
> +	kmem_cache_destroy(x86_emulator_cache);
>   	kmem_cache_destroy(x86_fpu_cache);
>   #ifdef CONFIG_KVM_XEN
>   	static_key_deferred_flush(&kvm_xen_enabled);
> 

Queued, thanks

Paolo


      reply	other threads:[~2021-06-11 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11  4:59 Wanpeng Li
2021-06-11 15:53 ` Paolo Bonzini [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=2ea05111-1598-f82c-e868-0615bc003612@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanjc@google.com \
    --cc=stable@vger.kernel.org \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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

all inboxes | Powered by JetHome®