qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: Shannon Zhao <zhaoshenglong@huawei.com>, qemu-arm@nongnu.org
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
	shannon.zhaosl@gmail.com
Subject: Re: [Qemu-devel] [PATCH] KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice
Date: Thu, 31 May 2018 10:27:43 +0200	[thread overview]
Message-ID: <a61f1fe2-a53a-f57a-34d9-1d1da907e635@redhat.com> (raw)
In-Reply-To: <5B0FAC9E.6090306@huawei.com>

Hi Shannon,

On 05/31/2018 10:04 AM, Shannon Zhao wrote:
> 
> 
> On 2018/5/31 15:54, Auger Eric wrote:
>> Hi Shannon,
>>
>> On 05/31/2018 09:16 AM, Shannon Zhao wrote:
>>> kvm_irqchip_create called by kvm_init will call kvm_init_irq_routing to
>>> initialize global capability variables. If we call kvm_init_irq_routing in
>>> GIC realize function, previous allocated memory will leak.
>>>
>>> Fix this by deleting the unnecessary call.
>>>
>>> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
>> openpic_kvm seems to suffer the same leak. Don't you want to fix it as
>> well?
>>
> I have a look at below patch of openpic_kvm which says on ppc it doesn't
> call kvm_irqchip_create. So no such issue for it.
> 
> commit d85937e683f6ff4d68293cb24c780fb1f6820d2c
> Author: Scott Wood <scottwood@freescale.com>
> Date:   Wed Jun 12 15:32:51 2013 -0500
> 
>     kvm/openpic: in-kernel mpic support

Ah OK. Thanks for the pointer.

Eric
> 
>> Reviewed-by: Eric Auger <eric.auger@redhat.com>
>>
> Thanks.
> 
>> Thanks
>>
>> Eric
>>> ---
>>>  hw/intc/arm_gic_kvm.c   | 1 -
>>>  hw/intc/arm_gicv3_kvm.c | 1 -
>>>  2 files changed, 2 deletions(-)
>>>
>>> diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
>>> index 6f467e6..204369d 100644
>>> --- a/hw/intc/arm_gic_kvm.c
>>> +++ b/hw/intc/arm_gic_kvm.c
>>> @@ -572,7 +572,6 @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)
>>>  
>>>      if (kvm_has_gsi_routing()) {
>>>          /* set up irq routing */
>>> -        kvm_init_irq_routing(kvm_state);
>>>          for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) {
>>>              kvm_irqchip_add_irq_route(kvm_state, i, 0, i);
>>>          }
>>> diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
>>> index 001d82b..aa4c7c5 100644
>>> --- a/hw/intc/arm_gicv3_kvm.c
>>> +++ b/hw/intc/arm_gicv3_kvm.c
>>> @@ -813,7 +813,6 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)
>>>  
>>>      if (kvm_has_gsi_routing()) {
>>>          /* set up irq routing */
>>> -        kvm_init_irq_routing(kvm_state);
>>>          for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) {
>>>              kvm_irqchip_add_irq_route(kvm_state, i, 0, i);
>>>          }
>>>
>>
>> .
>>
> 

  reply	other threads:[~2018-05-31  8:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31  7:16 [Qemu-devel] [PATCH] KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice Shannon Zhao
2018-05-31  7:54 ` Auger Eric
2018-05-31  8:04   ` Shannon Zhao
2018-05-31  8:27     ` Auger Eric [this message]
2018-05-31 13:56 ` Peter Maydell

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=a61f1fe2-a53a-f57a-34d9-1d1da907e635@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhaosl@gmail.com \
    --cc=zhaoshenglong@huawei.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).