* [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq
@ 2015-05-29 5:26 Shannon Zhao
2015-05-29 5:26 ` [Qemu-devel] [PATCH v2 01/13] hw/i386/pc: Fix misusing qemu_allocate_irqs " Shannon Zhao
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:26 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
These are relevant to misusing qemu_allocate_irqs for requesting single
irq and they cause memory leak. So these patches use qemu_allocate_irq
for single irq to fix these memory leaks.
PS: These patches are split from my previous patchset [1] since they are
relevant to misusing qemu_allocate_irqs for single irq. And for the
reset patches of [1] will respin later.
Thanks,
Shannon
[1] [PATCH 00/29] Fix memory leak relevant to calling qemu_allocate_irqs
changes since v1:
* split those relevant to misusing qemu_allocate_irqs for single irq
Shannon Zhao (13):
hw/i386/pc: Fix misusing qemu_allocate_irqs for single irq
hw/isa/lpc_ich9.c: Fix misusing qemu_allocate_irqs for single irq
hw/isa/i82378.c: Fix misusing qemu_allocate_irqs for single irq
hw/timer/arm_timer.c: Fix misusing qemu_allocate_irqs for single irq
hw/intc/exynos4210_gic.c: Fix memory leak by adjusting order
hw/sparc/sun4m.c: Fix misusing qemu_allocate_irqs for single irq
hw/ppc/prep.c: Fix misusing qemu_allocate_irqs for single irq
hw/lm32/lm32_boards.c: Fix misusing qemu_allocate_irqs for single irq
hw/lm32/milkymist.c: Fix misusing qemu_allocate_irqs for single irq
hw/unicore32/puv3.c: Fix misusing qemu_allocate_irqs for single irq
hw/alpha/typhoon.c: Fix misusing qemu_allocate_irqs for single irq
hw/arm/nseries.c: Fix misusing qemu_allocate_irqs for single irq
hw/display/tc6393xb.c: Fix misusing qemu_allocate_irqs for single irq
hw/alpha/typhoon.c | 8 ++++----
hw/arm/nseries.c | 5 ++---
hw/display/tc6393xb.c | 2 +-
hw/i386/pc.c | 4 ++--
hw/i386/pc_piix.c | 4 +---
hw/i386/pc_q35.c | 4 +---
hw/intc/exynos4210_gic.c | 7 +++----
hw/isa/i82378.c | 7 ++-----
hw/isa/lpc_ich9.c | 5 +----
hw/lm32/lm32_boards.c | 10 ++++------
hw/lm32/milkymist.c | 5 ++---
hw/ppc/prep.c | 5 ++---
hw/sparc/sun4m.c | 6 ++----
hw/timer/arm_timer.c | 6 ++----
hw/unicore32/puv3.c | 8 ++++----
include/hw/i386/pc.h | 2 +-
16 files changed, 34 insertions(+), 54 deletions(-)
--
2.0.4
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 01/13] hw/i386/pc: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
@ 2015-05-29 5:26 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 02/13] hw/isa/lpc_ich9.c: " Shannon Zhao
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:26 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==20308== 8 bytes in 1 blocks are definitely lost in loss record 622 of 3,474
==20308== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==20308== by 0x2EB687: malloc_and_trace (vl.c:2556)
==20308== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==20308== by 0x377C57: qemu_extend_irqs (irq.c:55)
==20308== by 0x377CE3: qemu_allocate_irqs (irq.c:64)
==20308== by 0x2522B8: pc_allocate_cpu_irq (pc.c:1350)
==20308== by 0x255AFF: pc_q35_init (pc_q35.c:233)
==20308== by 0x2EFA52: main (vl.c:4249)
==16440== 8 bytes in 1 blocks are definitely lost in loss record 599 of 3,443
==16440== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16440== by 0x2EB687: malloc_and_trace (vl.c:2556)
==16440== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==16440== by 0x377C57: qemu_extend_irqs (irq.c:55)
==16440== by 0x377CE3: qemu_allocate_irqs (irq.c:64)
==16440== by 0x2522B8: pc_allocate_cpu_irq (pc.c:1350)
==16440== by 0x2546B6: pc_init1 (pc_piix.c:223)
==16440== by 0x254C16: pc_init_pci (pc_piix.c:311)
==16440== by 0x2EFA52: main (vl.c:4249)
Since pc_allocate_cpu_irq only requests one irq, so let it just call
qemu_allocate_irq.
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/i386/pc.c | 4 ++--
hw/i386/pc_piix.c | 4 +---
hw/i386/pc_q35.c | 4 +---
include/hw/i386/pc.h | 2 +-
4 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 769eb25..bb59a04 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1345,9 +1345,9 @@ FWCfgState *pc_memory_init(MachineState *machine,
return fw_cfg;
}
-qemu_irq *pc_allocate_cpu_irq(void)
+qemu_irq pc_allocate_cpu_irq(void)
{
- return qemu_allocate_irqs(pic_irq_request, NULL, 1);
+ return qemu_allocate_irq(pic_irq_request, NULL, 0);
}
DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 5e4c0b8..f2b6ebd 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -86,7 +86,6 @@ static void pc_init1(MachineState *machine,
ISABus *isa_bus;
PCII440FXState *i440fx_state;
int piix3_devfn = -1;
- qemu_irq *cpu_irq;
qemu_irq *gsi;
qemu_irq *i8259;
qemu_irq smi_irq;
@@ -220,8 +219,7 @@ static void pc_init1(MachineState *machine,
} else if (xen_enabled()) {
i8259 = xen_interrupt_controller_init();
} else {
- cpu_irq = pc_allocate_cpu_irq();
- i8259 = i8259_init(isa_bus, cpu_irq[0]);
+ i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq());
}
for (i = 0; i < ISA_NUM_IRQS; i++) {
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index e67f2de..f2e3cf7 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -79,7 +79,6 @@ static void pc_q35_init(MachineState *machine)
GSIState *gsi_state;
ISABus *isa_bus;
int pci_enabled = 1;
- qemu_irq *cpu_irq;
qemu_irq *gsi;
qemu_irq *i8259;
int i;
@@ -230,8 +229,7 @@ static void pc_q35_init(MachineState *machine)
} else if (xen_enabled()) {
i8259 = xen_interrupt_controller_init();
} else {
- cpu_irq = pc_allocate_cpu_irq();
- i8259 = i8259_init(isa_bus, cpu_irq[0]);
+ i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq());
}
for (i = 0; i < ISA_NUM_IRQS; i++) {
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 1b35168..6c6a45e 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -195,7 +195,7 @@ FWCfgState *pc_memory_init(MachineState *machine,
MemoryRegion *rom_memory,
MemoryRegion **ram_memory,
PcGuestInfo *guest_info);
-qemu_irq *pc_allocate_cpu_irq(void);
+qemu_irq pc_allocate_cpu_irq(void);
DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
ISADevice **rtc_state,
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 02/13] hw/isa/lpc_ich9.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
2015-05-29 5:26 ` [Qemu-devel] [PATCH v2 01/13] hw/i386/pc: Fix misusing qemu_allocate_irqs " Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 03/13] hw/isa/i82378.c: " Shannon Zhao
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==25058== 8 bytes in 1 blocks are definitely lost in loss record 623 of 3,473
==25058== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==25058== by 0x2EB657: malloc_and_trace (vl.c:2556)
==25058== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==25058== by 0x377C27: qemu_extend_irqs (irq.c:55)
==25058== by 0x377CB3: qemu_allocate_irqs (irq.c:64)
==25058== by 0x222338: ich9_lpc_pm_init (lpc_ich9.c:365)
==25058== by 0x255C42: pc_q35_init (pc_q35.c:255)
==25058== by 0x2EFA22: main (vl.c:4249)
Since ich9_lpc_pm_init only requests one irq, so let it just call
qemu_allocate_irq.
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/isa/lpc_ich9.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index dba7585..144b210 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -360,11 +360,8 @@ static void ich9_set_sci(void *opaque, int irq_num, int level)
void ich9_lpc_pm_init(PCIDevice *lpc_pci)
{
ICH9LPCState *lpc = ICH9_LPC_DEVICE(lpc_pci);
- qemu_irq *sci_irq;
-
- sci_irq = qemu_allocate_irqs(ich9_set_sci, lpc, 1);
- ich9_pm_init(lpc_pci, &lpc->pm, sci_irq[0]);
+ ich9_pm_init(lpc_pci, &lpc->pm, qemu_allocate_irq(ich9_set_sci, lpc, 0));
ich9_lpc_reset(&lpc->d.qdev);
}
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 03/13] hw/isa/i82378.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
2015-05-29 5:26 ` [Qemu-devel] [PATCH v2 01/13] hw/i386/pc: Fix misusing qemu_allocate_irqs " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 02/13] hw/isa/lpc_ich9.c: " Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 04/13] hw/timer/arm_timer.c: " Shannon Zhao
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==32654== 8 bytes in 1 blocks are definitely lost in loss record 476 of 4,036
==32654== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==32654== by 0x336F47: malloc_and_trace (vl.c:2556)
==32654== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==32654== by 0x3C093B: qemu_extend_irqs (irq.c:55)
==32654== by 0x3C09C7: qemu_allocate_irqs (irq.c:64)
==32654== by 0x3EA4CF: i82378_realize (i82378.c:92)
==32654== by 0x420991: pci_qdev_realize (pci.c:1781)
==32654== by 0x3BD47C: device_set_realized (qdev.c:1058)
==32654== by 0x4A6516: property_set_bool (object.c:1514)
==32654== by 0x4A4E10: object_property_set (object.c:837)
==32654== by 0x4A7132: object_property_set_qobject (qom-qobject.c:24)
==32654== by 0x4A507F: object_property_set_bool (object.c:905)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/isa/i82378.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index 9da9dfc..fcf97d8 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -65,7 +65,6 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
uint8_t *pci_conf;
ISABus *isabus;
ISADevice *isa;
- qemu_irq *out0_irq;
pci_conf = pci->config;
pci_set_word(pci_conf + PCI_COMMAND,
@@ -88,11 +87,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
All devices accept byte access only, except timer
*/
- /* Workaround the fact that i8259 is not qdev'ified... */
- out0_irq = qemu_allocate_irqs(i82378_request_out0_irq, s, 1);
-
/* 2 82C59 (irq) */
- s->i8259 = i8259_init(isabus, *out0_irq);
+ s->i8259 = i8259_init(isabus,
+ qemu_allocate_irq(i82378_request_out0_irq, s, 0));
isa_bus_irqs(isabus, s->i8259);
/* 1 82C54 (pit) */
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 04/13] hw/timer/arm_timer.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (2 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 03/13] hw/isa/i82378.c: " Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 05/13] hw/intc/exynos4210_gic.c: Fix memory leak by adjusting order Shannon Zhao
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==16356== 32 bytes in 2 blocks are definitely lost in loss record 1,689 of 2,802
==16356== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16356== by 0x35478F: malloc_and_trace (vl.c:2556)
==16356== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==16356== by 0x3ED94B: qemu_extend_irqs (irq.c:55)
==16356== by 0x3ED9D7: qemu_allocate_irqs (irq.c:64)
==16356== by 0x4BA8D1: sp804_init (arm_timer.c:285)
==16356== by 0x3EEE1D: sysbus_device_init (sysbus.c:204)
==16356== by 0x3E838D: device_realize (qdev.c:247)
==16356== by 0x3EA48C: device_set_realized (qdev.c:1058)
==16356== by 0x516CD2: property_set_bool (object.c:1514)
==16356== by 0x5155CC: object_property_set (object.c:837)
==16356== by 0x5178EE: object_property_set_qobject (qom-qobject.c:24)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/timer/arm_timer.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
index 1452910..d53f39a 100644
--- a/hw/timer/arm_timer.c
+++ b/hw/timer/arm_timer.c
@@ -280,14 +280,12 @@ static int sp804_init(SysBusDevice *sbd)
{
DeviceState *dev = DEVICE(sbd);
SP804State *s = SP804(dev);
- qemu_irq *qi;
- qi = qemu_allocate_irqs(sp804_set_irq, s, 2);
sysbus_init_irq(sbd, &s->irq);
s->timer[0] = arm_timer_init(s->freq0);
s->timer[1] = arm_timer_init(s->freq1);
- s->timer[0]->irq = qi[0];
- s->timer[1]->irq = qi[1];
+ s->timer[0]->irq = qemu_allocate_irq(sp804_set_irq, s, 0);
+ s->timer[1]->irq = qemu_allocate_irq(sp804_set_irq, s, 1);
memory_region_init_io(&s->iomem, OBJECT(s), &sp804_ops, s,
"sp804", 0x1000);
sysbus_init_mmio(sbd, &s->iomem);
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 05/13] hw/intc/exynos4210_gic.c: Fix memory leak by adjusting order
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (3 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 04/13] hw/timer/arm_timer.c: " Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 06/13] hw/sparc/sun4m.c: Fix misusing qemu_allocate_irqs for single irq Shannon Zhao
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==17211== 784 (288 direct, 496 indirect) bytes in 4 blocks are definitely lost in loss record 3,018 of 3,201
==17211== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==17211== by 0x35478F: malloc_and_trace (vl.c:2556)
==17211== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==17211== by 0x5148DD: object_new_with_type (object.c:428)
==17211== by 0x514939: object_new (object.c:439)
==17211== by 0x3EDA38: qemu_allocate_irq (irq.c:71)
==17211== by 0x3EDC2D: qemu_irq_split (irq.c:119)
==17211== by 0x23D231: exynos4210_init_board_irqs (exynos4210_gic.c:216)
==17211== by 0x293B00: exynos4210_init (exynos4210.c:250)
==17211== by 0x27915A: exynos4_boards_init_common (exynos4_boards.c:127)
==17211== by 0x2791D9: smdkc210_init (exynos4_boards.c:140)
==17211== by 0x358B5A: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/intc/exynos4210_gic.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c
index 0590d5d..b2a4950 100644
--- a/hw/intc/exynos4210_gic.c
+++ b/hw/intc/exynos4210_gic.c
@@ -213,9 +213,6 @@ void exynos4210_init_board_irqs(Exynos4210Irq *s)
uint32_t grp, bit, irq_id, n;
for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) {
- s->board_irqs[n] = qemu_irq_split(s->int_combiner_irq[n],
- s->ext_combiner_irq[n]);
-
irq_id = 0;
if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4) ||
n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4)) {
@@ -230,8 +227,10 @@ void exynos4210_init_board_irqs(Exynos4210Irq *s)
if (irq_id) {
s->board_irqs[n] = qemu_irq_split(s->int_combiner_irq[n],
s->ext_gic_irq[irq_id-32]);
+ } else {
+ s->board_irqs[n] = qemu_irq_split(s->int_combiner_irq[n],
+ s->ext_combiner_irq[n]);
}
-
}
for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) {
/* these IDs are passed to Internal Combiner and External GIC */
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 06/13] hw/sparc/sun4m.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (4 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 05/13] hw/intc/exynos4210_gic.c: Fix memory leak by adjusting order Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 07/13] hw/ppc/prep.c: " Shannon Zhao
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==23693== 8 bytes in 1 blocks are definitely lost in loss record 424 of 2,014
==23693== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==23693== by 0x21B93F: malloc_and_trace (vl.c:2556)
==23693== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==23693== by 0x2700DF: qemu_extend_irqs (irq.c:55)
==23693== by 0x27016B: qemu_allocate_irqs (irq.c:64)
==23693== by 0x1EC7DE: sun4m_hw_init (sun4m.c:1027)
==23693== by 0x1ECE17: ss5_init (sun4m.c:1374)
==23693== by 0x21FD0A: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/sparc/sun4m.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index a69bf2d..8a3599c 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -897,7 +897,6 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
espdma_irq, ledma_irq;
qemu_irq esp_reset, dma_enable;
qemu_irq fdc_tc;
- qemu_irq *cpu_halt;
unsigned long kernel_size;
DriveInfo *fd[MAX_FD];
FWCfgState *fw_cfg;
@@ -1024,9 +1023,8 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
escc_init(hwdef->serial_base, slavio_irq[15], slavio_irq[15],
serial_hds[0], serial_hds[1], ESCC_CLOCK, 1);
- cpu_halt = qemu_allocate_irqs(cpu_halt_signal, NULL, 1);
if (hwdef->apc_base) {
- apc_init(hwdef->apc_base, cpu_halt[0]);
+ apc_init(hwdef->apc_base, qemu_allocate_irq(cpu_halt_signal, NULL, 0));
}
if (hwdef->fd_base) {
@@ -1036,7 +1034,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
sun4m_fdctrl_init(slavio_irq[22], hwdef->fd_base, fd,
&fdc_tc);
} else {
- fdc_tc = *qemu_allocate_irqs(dummy_fdc_tc, NULL, 1);
+ fdc_tc = qemu_allocate_irq(dummy_fdc_tc, NULL, 0);
}
slavio_misc_init(hwdef->slavio_base, hwdef->aux1_base, hwdef->aux2_base,
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 07/13] hw/ppc/prep.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (5 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 06/13] hw/sparc/sun4m.c: Fix misusing qemu_allocate_irqs for single irq Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 08/13] hw/lm32/lm32_boards.c: " Shannon Zhao
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==22156== 8 bytes in 1 blocks are definitely lost in loss record 469 of 3,966
==22156== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==22156== by 0x337033: malloc_and_trace (vl.c:2556)
==22156== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==22156== by 0x3C0A27: qemu_extend_irqs (irq.c:55)
==22156== by 0x3C0AB3: qemu_allocate_irqs (irq.c:64)
==22156== by 0x26C792: ppc_prep_init (prep.c:628)
==22156== by 0x33B3FE: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/ppc/prep.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 7f52662..998ee2d 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -528,7 +528,6 @@ static void ppc_prep_init(MachineState *machine)
PCIDevice *pci;
ISABus *isa_bus;
ISADevice *isa;
- qemu_irq *cpu_exit_irq;
int ppc_boot_device;
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
@@ -625,11 +624,11 @@ static void ppc_prep_init(MachineState *machine)
/* PCI -> ISA bridge */
pci = pci_create_simple(pci_bus, PCI_DEVFN(1, 0), "i82378");
- cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
cpu = POWERPC_CPU(first_cpu);
qdev_connect_gpio_out(&pci->qdev, 0,
cpu->env.irq_inputs[PPC6xx_INPUT_INT]);
- qdev_connect_gpio_out(&pci->qdev, 1, *cpu_exit_irq);
+ qdev_connect_gpio_out(&pci->qdev, 1,
+ qemu_allocate_irq(cpu_request_exit, NULL, 0));
sysbus_connect_irq(&pcihost->busdev, 0, qdev_get_gpio_in(&pci->qdev, 9));
sysbus_connect_irq(&pcihost->busdev, 1, qdev_get_gpio_in(&pci->qdev, 11));
sysbus_connect_irq(&pcihost->busdev, 2, qdev_get_gpio_in(&pci->qdev, 9));
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 08/13] hw/lm32/lm32_boards.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (6 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 07/13] hw/ppc/prep.c: " Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 09/13] hw/lm32/milkymist.c: " Shannon Zhao
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==8662== 8 bytes in 1 blocks are definitely lost in loss record 228 of 1,108
==8662== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8662== by 0x1E77EB: malloc_and_trace (vl.c:2556)
==8662== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==8662== by 0x238C47: qemu_extend_irqs (irq.c:55)
==8662== by 0x238CD3: qemu_allocate_irqs (irq.c:64)
==8662== by 0x1C32FC: lm32_evr_init (lm32_boards.c:126)
==8662== by 0x1EBBB6: main (vl.c:4249)
==12877== 8 bytes in 1 blocks are definitely lost in loss record 209 of 1,042
==12877== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==12877== by 0x1E77E7: malloc_and_trace (vl.c:2556)
==12877== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==12877== by 0x238C43: qemu_extend_irqs (irq.c:55)
==12877== by 0x238CCF: qemu_allocate_irqs (irq.c:64)
==12877== by 0x1C384E: lm32_uclinux_init (lm32_boards.c:228)
==12877== by 0x1EBBB2: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/lm32/lm32_boards.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
index 14d0efc..70f48d3 100644
--- a/hw/lm32/lm32_boards.c
+++ b/hw/lm32/lm32_boards.c
@@ -78,7 +78,7 @@ static void lm32_evr_init(MachineState *machine)
DriveInfo *dinfo;
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
- qemu_irq *cpu_irq, irq[32];
+ qemu_irq irq[32];
ResetInfo *reset_info;
int i;
@@ -123,8 +123,7 @@ static void lm32_evr_init(MachineState *machine)
1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
/* create irq lines */
- cpu_irq = qemu_allocate_irqs(cpu_irq_handler, cpu, 1);
- env->pic_state = lm32_pic_init(*cpu_irq);
+ env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0));
for (i = 0; i < 32; i++) {
irq[i] = qdev_get_gpio_in(env->pic_state, i);
}
@@ -173,7 +172,7 @@ static void lm32_uclinux_init(MachineState *machine)
DriveInfo *dinfo;
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
- qemu_irq *cpu_irq, irq[32];
+ qemu_irq irq[32];
HWSetup *hw;
ResetInfo *reset_info;
int i;
@@ -225,8 +224,7 @@ static void lm32_uclinux_init(MachineState *machine)
1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
/* create irq lines */
- cpu_irq = qemu_allocate_irqs(cpu_irq_handler, env, 1);
- env->pic_state = lm32_pic_init(*cpu_irq);
+ env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, env, 0));
for (i = 0; i < 32; i++) {
irq[i] = qdev_get_gpio_in(env->pic_state, i);
}
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 09/13] hw/lm32/milkymist.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (7 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 08/13] hw/lm32/lm32_boards.c: " Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 10/13] hw/unicore32/puv3.c: " Shannon Zhao
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==20652== 8 bytes in 1 blocks are definitely lost in loss record 252 of 1,314
==20652== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==20652== by 0x1E77E7: malloc_and_trace (vl.c:2556)
==20652== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==20652== by 0x238C43: qemu_extend_irqs (irq.c:55)
==20652== by 0x238CCF: qemu_allocate_irqs (irq.c:64)
==20652== by 0x1C49AD: milkymist_init (milkymist.c:133)
==20652== by 0x1EBBB2: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/lm32/milkymist.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
index e0cec7d..e755f5b 100644
--- a/hw/lm32/milkymist.c
+++ b/hw/lm32/milkymist.c
@@ -86,7 +86,7 @@ milkymist_init(MachineState *machine)
DriveInfo *dinfo;
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *phys_sdram = g_new(MemoryRegion, 1);
- qemu_irq irq[32], *cpu_irq;
+ qemu_irq irq[32];
int i;
char *bios_filename;
ResetInfo *reset_info;
@@ -130,8 +130,7 @@ milkymist_init(MachineState *machine)
2, 0x00, 0x89, 0x00, 0x1d, 1);
/* create irq lines */
- cpu_irq = qemu_allocate_irqs(cpu_irq_handler, cpu, 1);
- env->pic_state = lm32_pic_init(*cpu_irq);
+ env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0));
for (i = 0; i < 32; i++) {
irq[i] = qdev_get_gpio_in(env->pic_state, i);
}
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 10/13] hw/unicore32/puv3.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (8 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 09/13] hw/lm32/milkymist.c: " Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 11/13] hw/alpha/typhoon.c: " Shannon Zhao
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==26001== 8 bytes in 1 blocks are definitely lost in loss record 234 of 1,038
==26001== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26001== by 0x1E1483: malloc_and_trace (vl.c:2556)
==26001== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==26001== by 0x22D17B: qemu_extend_irqs (irq.c:55)
==26001== by 0x22D207: qemu_allocate_irqs (irq.c:64)
==26001== by 0x1BC56D: puv3_soc_init (puv3.c:49)
==26001== by 0x1BC8B1: puv3_init (puv3.c:128)
==26001== by 0x1E584E: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/unicore32/puv3.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
index cc9a21a..703e29d 100644
--- a/hw/unicore32/puv3.c
+++ b/hw/unicore32/puv3.c
@@ -40,15 +40,15 @@ static void puv3_intc_cpu_handler(void *opaque, int irq, int level)
static void puv3_soc_init(CPUUniCore32State *env)
{
- qemu_irq *cpu_intc, irqs[PUV3_IRQS_NR];
+ qemu_irq cpu_intc, irqs[PUV3_IRQS_NR];
DeviceState *dev;
MemoryRegion *i8042 = g_new(MemoryRegion, 1);
int i;
/* Initialize interrupt controller */
- cpu_intc = qemu_allocate_irqs(puv3_intc_cpu_handler,
- uc32_env_get_cpu(env), 1);
- dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, *cpu_intc);
+ cpu_intc = qemu_allocate_irq(puv3_intc_cpu_handler,
+ uc32_env_get_cpu(env), 0);
+ dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, cpu_intc);
for (i = 0; i < PUV3_IRQS_NR; i++) {
irqs[i] = qdev_get_gpio_in(dev, i);
}
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 11/13] hw/alpha/typhoon.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (9 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 10/13] hw/unicore32/puv3.c: " Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 12/13] hw/arm/nseries.c: " Shannon Zhao
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==7055== 8 bytes in 1 blocks are definitely lost in loss record 403 of 2,192
==7055== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7055== by 0x24410F: malloc_and_trace (vl.c:2556)
==7055== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==7055== by 0x2B7A8B: qemu_extend_irqs (irq.c:55)
==7055== by 0x2B7B17: qemu_allocate_irqs (irq.c:64)
==7055== by 0x2197CB: typhoon_init (typhoon.c:844)
==7055== by 0x2178FD: clipper_init (dp264.c:73)
==7055== by 0x2484DA: main (vl.c:4249)
==7055==
==7055== 8 bytes in 1 blocks are definitely lost in loss record 404 of 2,192
==7055== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7055== by 0x24410F: malloc_and_trace (vl.c:2556)
==7055== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==7055== by 0x2B7A8B: qemu_extend_irqs (irq.c:55)
==7055== by 0x2B7B17: qemu_allocate_irqs (irq.c:64)
==7055== by 0x219BA7: typhoon_init (typhoon.c:924)
==7055== by 0x2178FD: clipper_init (dp264.c:73)
==7055== by 0x2484DA: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/alpha/typhoon.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index 7df842d..421162e 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -841,7 +841,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
}
}
- *p_rtc_irq = *qemu_allocate_irqs(typhoon_set_timer_irq, s, 1);
+ *p_rtc_irq = qemu_allocate_irq(typhoon_set_timer_irq, s, 0);
/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB,
but the address space hole reserved at this point is 8TB. */
@@ -918,11 +918,11 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
/* Init the ISA bus. */
/* ??? Technically there should be a cy82c693ub pci-isa bridge. */
{
- qemu_irq isa_pci_irq, *isa_irqs;
+ qemu_irq *isa_irqs;
*isa_bus = isa_bus_new(NULL, get_system_memory(), &s->pchip.reg_io);
- isa_pci_irq = *qemu_allocate_irqs(typhoon_set_isa_irq, s, 1);
- isa_irqs = i8259_init(*isa_bus, isa_pci_irq);
+ isa_irqs = i8259_init(*isa_bus,
+ qemu_allocate_irq(typhoon_set_isa_irq, s, 0));
isa_bus_irqs(*isa_bus, isa_irqs);
}
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 12/13] hw/arm/nseries.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (10 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 11/13] hw/alpha/typhoon.c: " Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 13/13] hw/display/tc6393xb.c: " Shannon Zhao
2015-05-30 14:12 ` [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs " Michael Tokarev
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==4835== 8 bytes in 1 blocks are definitely lost in loss record 509 of 3,278
==4835== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4835== by 0x354793: malloc_and_trace (vl.c:2556)
==4835== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==4835== by 0x3ED98F: qemu_extend_irqs (irq.c:55)
==4835== by 0x3EDA1B: qemu_allocate_irqs (irq.c:64)
==4835== by 0x280261: n8x0_gpio_setup (nseries.c:136)
==4835== by 0x2830AB: n8x0_init (nseries.c:1337)
==4835== by 0x2832D6: n800_init (nseries.c:1409)
==4835== by 0x358B5E: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/arm/nseries.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index d243159..a659e85 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -133,9 +133,8 @@ static void n800_mmc_cs_cb(void *opaque, int line, int level)
static void n8x0_gpio_setup(struct n800_s *s)
{
- qemu_irq *mmc_cs = qemu_allocate_irqs(n800_mmc_cs_cb, s->mpu->mmc, 1);
- qdev_connect_gpio_out(s->mpu->gpio, N8X0_MMC_CS_GPIO, mmc_cs[0]);
-
+ qdev_connect_gpio_out(s->mpu->gpio, N8X0_MMC_CS_GPIO,
+ qemu_allocate_irq(n800_mmc_cs_cb, s->mpu->mmc, 0));
qemu_irq_lower(qdev_get_gpio_in(s->mpu->gpio, N800_BAT_COVER_GPIO));
}
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 13/13] hw/display/tc6393xb.c: Fix misusing qemu_allocate_irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (11 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 12/13] hw/arm/nseries.c: " Shannon Zhao
@ 2015-05-29 5:27 ` Shannon Zhao
2015-05-30 14:12 ` [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs " Michael Tokarev
13 siblings, 0 replies; 15+ messages in thread
From: Shannon Zhao @ 2015-05-29 5:27 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, mjt, shannon.zhao, peter.maydell
From: Shannon Zhao <shannon.zhao@linaro.org>
valgrind complains about:
==3169== 8 bytes in 1 blocks are definitely lost in loss record 424 of 2,779
==3169== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==3169== by 0x3547D3: malloc_and_trace (vl.c:2556)
==3169== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==3169== by 0x3ED9CF: qemu_extend_irqs (irq.c:55)
==3169== by 0x3EDA5B: qemu_allocate_irqs (irq.c:64)
==3169== by 0x426F74: tc6393xb_init (tc6393xb.c:574)
==3169== by 0x28B7B4: tosa_init (tosa.c:235)
==3169== by 0x358B9E: main (vl.c:4249)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
hw/display/tc6393xb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c
index 66b7ade..f5f3f3e 100644
--- a/hw/display/tc6393xb.c
+++ b/hw/display/tc6393xb.c
@@ -571,7 +571,7 @@ TC6393xbState *tc6393xb_init(MemoryRegion *sysmem, uint32_t base, qemu_irq irq)
s->irq = irq;
s->gpio_in = qemu_allocate_irqs(tc6393xb_gpio_set, s, TC6393XB_GPIOS);
- s->l3v = *qemu_allocate_irqs(tc6393xb_l3v, s, 1);
+ s->l3v = qemu_allocate_irq(tc6393xb_l3v, s, 0);
s->blanked = 1;
s->sub_irqs = qemu_allocate_irqs(tc6393xb_sub_irq, s, TC6393XB_NR_IRQS);
--
2.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
` (12 preceding siblings ...)
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 13/13] hw/display/tc6393xb.c: " Shannon Zhao
@ 2015-05-30 14:12 ` Michael Tokarev
13 siblings, 0 replies; 15+ messages in thread
From: Michael Tokarev @ 2015-05-30 14:12 UTC (permalink / raw)
To: Shannon Zhao, qemu-devel
Cc: qemu-trivial, pbonzini, shannon.zhao, peter.maydell
29.05.2015 08:26, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> These are relevant to misusing qemu_allocate_irqs for requesting single
> irq and they cause memory leak. So these patches use qemu_allocate_irq
> for single irq to fix these memory leaks.
>
> PS: These patches are split from my previous patchset [1] since they are
> relevant to misusing qemu_allocate_irqs for single irq. And for the
> reset patches of [1] will respin later.
>
> Thanks,
> Shannon
>
> [1] [PATCH 00/29] Fix memory leak relevant to calling qemu_allocate_irqs
>
> changes since v1:
> * split those relevant to misusing qemu_allocate_irqs for single irq
>
> Shannon Zhao (13):
> hw/i386/pc: Fix misusing qemu_allocate_irqs for single irq
> hw/isa/lpc_ich9.c: Fix misusing qemu_allocate_irqs for single irq
> hw/isa/i82378.c: Fix misusing qemu_allocate_irqs for single irq
> hw/timer/arm_timer.c: Fix misusing qemu_allocate_irqs for single irq
> hw/intc/exynos4210_gic.c: Fix memory leak by adjusting order
> hw/sparc/sun4m.c: Fix misusing qemu_allocate_irqs for single irq
> hw/ppc/prep.c: Fix misusing qemu_allocate_irqs for single irq
> hw/lm32/lm32_boards.c: Fix misusing qemu_allocate_irqs for single irq
> hw/lm32/milkymist.c: Fix misusing qemu_allocate_irqs for single irq
> hw/unicore32/puv3.c: Fix misusing qemu_allocate_irqs for single irq
> hw/alpha/typhoon.c: Fix misusing qemu_allocate_irqs for single irq
> hw/arm/nseries.c: Fix misusing qemu_allocate_irqs for single irq
> hw/display/tc6393xb.c: Fix misusing qemu_allocate_irqs for single irq
Applied all patches, removing valgrind messages from commits.
Re-ordered the exynos4210_gic.c patch to be the first, so it
comes outside of the series, together with the previous split
of the same nature, hw/arm/omap_sx1.c.
You made me busy for quite some time, verifying all this :)
Thanks,
/mjt
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2015-05-30 14:13 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-29 5:26 [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs for single irq Shannon Zhao
2015-05-29 5:26 ` [Qemu-devel] [PATCH v2 01/13] hw/i386/pc: Fix misusing qemu_allocate_irqs " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 02/13] hw/isa/lpc_ich9.c: " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 03/13] hw/isa/i82378.c: " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 04/13] hw/timer/arm_timer.c: " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 05/13] hw/intc/exynos4210_gic.c: Fix memory leak by adjusting order Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 06/13] hw/sparc/sun4m.c: Fix misusing qemu_allocate_irqs for single irq Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 07/13] hw/ppc/prep.c: " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 08/13] hw/lm32/lm32_boards.c: " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 09/13] hw/lm32/milkymist.c: " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 10/13] hw/unicore32/puv3.c: " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 11/13] hw/alpha/typhoon.c: " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 12/13] hw/arm/nseries.c: " Shannon Zhao
2015-05-29 5:27 ` [Qemu-devel] [PATCH v2 13/13] hw/display/tc6393xb.c: " Shannon Zhao
2015-05-30 14:12 ` [Qemu-devel] [PATCH v2 00/13] use qemu_allocate_irq not _irqs " Michael Tokarev
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).