From: Shannon Zhao <shannon.zhao@linaro.org>
To: Michael Tokarev <mjt@tls.msk.ru>,
Shannon Zhao <zhaoshenglong@huawei.com>,
qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org
Subject: Re: [Qemu-trivial] [PATCH v2 2/7] hw/mips/mips_jazz.c: Store irq array in MachineState to fix memory leak
Date: Thu, 04 Jun 2015 22:30:32 +0800 [thread overview]
Message-ID: <55706108.9070903@linaro.org> (raw)
In-Reply-To: <55705E46.4010106@msgid.tls.msk.ru>
On 2015/6/4 22:18, Michael Tokarev wrote:
> 30.05.2015 10:54, Shannon Zhao пишет:
>> >From: Shannon Zhao<shannon.zhao@linaro.org>
>> >
>> >Signed-off-by: Shannon Zhao<zhaoshenglong@huawei.com>
>> >Signed-off-by: Shannon Zhao<shannon.zhao@linaro.org>
>> >---
>> > hw/mips/mips_jazz.c | 28 ++++++++++++++--------------
>> > 1 file changed, 14 insertions(+), 14 deletions(-)
>> >
>> >diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
>> >index 2c153e0..259458b 100644
>> >--- a/hw/mips/mips_jazz.c
>> >+++ b/hw/mips/mips_jazz.c
>> >@@ -135,7 +135,7 @@ static void mips_jazz_init(MachineState *machine,
>> > MIPSCPU *cpu;
>> > CPUClass *cc;
>> > CPUMIPSState *env;
>> >- qemu_irq *rc4030, *i8259;
>> >+ qemu_irq *i8259;
> Hm. Why do you only cover rc4030, not i8259?
>
As i8259 is stored in ISABus->irqs by function isa_bus_irqs.
void isa_bus_irqs(ISABus *bus, qemu_irq *irqs)
{
if (!bus) {
hw_error("Can't set isa irqs with no isa bus present.");
}
bus->irqs = irqs;
}
> Besides, in order to keep the changes smaller, I think it is okay to
> keep the variables like that, here and in the rest of the function,
> and only add assignment of it to machine->irqs. This way, we also
> keep semantic names of the variables, rc4030[i] is easier to understand
> than machine->irqs[i], the former's more specific.
>
Agree.
> BTW, there's also cpu_exit_irq in this function whose allocation also
> suffers from qemu_allocate_irqs(..., 1) API abuse.
Yeah, missed this one.
--
Shannon
WARNING: multiple messages have this Message-ID (diff)
From: Shannon Zhao <shannon.zhao@linaro.org>
To: Michael Tokarev <mjt@tls.msk.ru>,
Shannon Zhao <zhaoshenglong@huawei.com>,
qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 2/7] hw/mips/mips_jazz.c: Store irq array in MachineState to fix memory leak
Date: Thu, 04 Jun 2015 22:30:32 +0800 [thread overview]
Message-ID: <55706108.9070903@linaro.org> (raw)
In-Reply-To: <55705E46.4010106@msgid.tls.msk.ru>
On 2015/6/4 22:18, Michael Tokarev wrote:
> 30.05.2015 10:54, Shannon Zhao пишет:
>> >From: Shannon Zhao<shannon.zhao@linaro.org>
>> >
>> >Signed-off-by: Shannon Zhao<zhaoshenglong@huawei.com>
>> >Signed-off-by: Shannon Zhao<shannon.zhao@linaro.org>
>> >---
>> > hw/mips/mips_jazz.c | 28 ++++++++++++++--------------
>> > 1 file changed, 14 insertions(+), 14 deletions(-)
>> >
>> >diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
>> >index 2c153e0..259458b 100644
>> >--- a/hw/mips/mips_jazz.c
>> >+++ b/hw/mips/mips_jazz.c
>> >@@ -135,7 +135,7 @@ static void mips_jazz_init(MachineState *machine,
>> > MIPSCPU *cpu;
>> > CPUClass *cc;
>> > CPUMIPSState *env;
>> >- qemu_irq *rc4030, *i8259;
>> >+ qemu_irq *i8259;
> Hm. Why do you only cover rc4030, not i8259?
>
As i8259 is stored in ISABus->irqs by function isa_bus_irqs.
void isa_bus_irqs(ISABus *bus, qemu_irq *irqs)
{
if (!bus) {
hw_error("Can't set isa irqs with no isa bus present.");
}
bus->irqs = irqs;
}
> Besides, in order to keep the changes smaller, I think it is okay to
> keep the variables like that, here and in the rest of the function,
> and only add assignment of it to machine->irqs. This way, we also
> keep semantic names of the variables, rc4030[i] is easier to understand
> than machine->irqs[i], the former's more specific.
>
Agree.
> BTW, there's also cpu_exit_irq in this function whose allocation also
> suffers from qemu_allocate_irqs(..., 1) API abuse.
Yeah, missed this one.
--
Shannon
next prev parent reply other threads:[~2015-06-04 14:30 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-30 7:54 [Qemu-trivial] [PATCH v2 0/7] Add a member in MachineState to store irq array Shannon Zhao
2015-05-30 7:54 ` [Qemu-devel] " Shannon Zhao
2015-05-30 7:54 ` [Qemu-trivial] [PATCH v2 1/7] hw/ppc/ppc440_bamboo.c: " Shannon Zhao
2015-05-30 7:54 ` [Qemu-devel] " Shannon Zhao
2015-06-04 14:12 ` [Qemu-trivial] " Michael Tokarev
2015-06-04 14:12 ` [Qemu-devel] " Michael Tokarev
2015-06-04 14:19 ` Shannon Zhao
2015-06-04 14:19 ` [Qemu-devel] " Shannon Zhao
2015-05-30 7:54 ` [Qemu-trivial] [PATCH v2 2/7] hw/mips/mips_jazz.c: Store irq array in MachineState to fix memory leak Shannon Zhao
2015-05-30 7:54 ` [Qemu-devel] " Shannon Zhao
2015-06-04 14:18 ` [Qemu-trivial] " Michael Tokarev
2015-06-04 14:18 ` [Qemu-devel] " Michael Tokarev
2015-06-04 14:30 ` Shannon Zhao [this message]
2015-06-04 14:30 ` Shannon Zhao
2015-06-04 14:32 ` Michael Tokarev
2015-06-04 14:32 ` [Qemu-devel] " Michael Tokarev
2015-06-04 14:51 ` [Qemu-trivial] " Shannon Zhao
2015-06-04 14:51 ` [Qemu-devel] " Shannon Zhao
2015-06-04 14:57 ` [Qemu-trivial] " Michael Tokarev
2015-06-04 14:57 ` [Qemu-devel] " Michael Tokarev
2015-06-04 15:09 ` [Qemu-trivial] " Shannon Zhao
2015-06-04 15:09 ` [Qemu-devel] " Shannon Zhao
2015-06-04 15:14 ` [Qemu-trivial] " Michael Tokarev
2015-06-04 15:14 ` [Qemu-devel] " Michael Tokarev
2015-06-04 15:17 ` [Qemu-trivial] " Michael Tokarev
2015-06-04 15:17 ` [Qemu-devel] " Michael Tokarev
2015-06-04 15:17 ` [Qemu-trivial] " Shannon Zhao
2015-06-04 15:17 ` [Qemu-devel] " Shannon Zhao
2015-06-04 15:23 ` [Qemu-trivial] " Shannon Zhao
2015-06-04 15:23 ` [Qemu-devel] " Shannon Zhao
2015-05-30 7:54 ` [Qemu-trivial] [PATCH v2 3/7] hw/m68k/an5206.c: " Shannon Zhao
2015-05-30 7:54 ` [Qemu-devel] " Shannon Zhao
2015-05-30 7:54 ` [Qemu-trivial] [PATCH v2 4/7] hw/sh4/r2d.c: " Shannon Zhao
2015-05-30 7:54 ` [Qemu-devel] " Shannon Zhao
2015-05-30 7:54 ` [Qemu-trivial] [PATCH v2 5/7] hw/arm/palm.c: " Shannon Zhao
2015-05-30 7:54 ` [Qemu-devel] " Shannon Zhao
2015-05-30 7:54 ` [Qemu-trivial] [PATCH v2 6/7] hw/arm/spitz.c: " Shannon Zhao
2015-05-30 7:54 ` [Qemu-devel] " Shannon Zhao
2015-05-30 7:54 ` [Qemu-trivial] [PATCH v2 7/7] hw/arm/tosa.c: " Shannon Zhao
2015-05-30 7:54 ` [Qemu-devel] " Shannon Zhao
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=55706108.9070903@linaro.org \
--to=shannon.zhao@linaro.org \
--cc=mjt@tls.msk.ru \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.