diff mbox

[v3,1/8] include/hw/boards.h: Add a member in MachineState to store irq array

Message ID 1434510002-6976-2-git-send-email-zhaoshenglong@huawei.com
State New
Headers show

Commit Message

Shannon Zhao June 17, 2015, 2:59 a.m. UTC
From: Shannon Zhao <shannon.zhao@linaro.org>

Here we add a member in MachineState to store the irq array returned
from qemu_allocate_irqs. Then these irq arrays will be free before QEMU
exit and it will be used to fix the memory leak due to misuse
qemu_allocate_irqs.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 include/hw/boards.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Peter Crosthwaite June 17, 2015, 3:16 a.m. UTC | #1
On Tue, Jun 16, 2015 at 7:59 PM, Shannon Zhao <zhaoshenglong@huawei.com> wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> Here we add a member in MachineState to store the irq array returned
> from qemu_allocate_irqs. Then these irq arrays will be free before QEMU
> exit and it will be used to fix the memory leak due to misuse
> qemu_allocate_irqs.
>

This is based on an assumption that IRQ are a global concept. This (as
well as the one global address space) is something we really should
get away from. A better appoach would be to child the IRQs to the
Machine object (note that IRQs are QOM objects) for those machines
where this assumption makes sense. Then we don't have to pollute
common structs.

Regards,
Peter

> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
>  include/hw/boards.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 6379901..0dea769 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -148,6 +148,7 @@ struct MachineState {
>      char *initrd_filename;
>      const char *cpu_model;
>      AccelState *accelerator;
> +    qemu_irq *irqs;
>  };
>
>  #endif
> --
> 2.0.4
>
>
>
diff mbox

Patch

diff --git a/include/hw/boards.h b/include/hw/boards.h
index 6379901..0dea769 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -148,6 +148,7 @@  struct MachineState {
     char *initrd_filename;
     const char *cpu_model;
     AccelState *accelerator;
+    qemu_irq *irqs;
 };
 
 #endif