All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] x86/ioapic: fix the irq_2_pin mem leak when destroy_irq
  2012-10-17 10:11 [PATCH] x86/ioapic: fix the irq_2_pin mem leak when destroy_irq Chuansheng Liu
@ 2012-10-17  2:02 ` Yinghai Lu
  2012-10-17  3:36   ` Liu, Chuansheng
  0 siblings, 1 reply; 4+ messages in thread
From: Yinghai Lu @ 2012-10-17  2:02 UTC (permalink / raw)
  To: Chuansheng Liu; +Cc: tglx, mingo, suresh.b.siddha, linux-kernel

On Wed, Oct 17, 2012 at 3:11 AM, Chuansheng Liu
<chuansheng.liu@intel.com> wrote:
>
> When destroying the irq, before free cfg, need to check
> cfg->irq_2_pin and free it when it is not NULL.
>
> Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
> ---

i had that in another patch...

https://lkml.org/lkml/2012/2/23/574

----
Subject	[PATCH 01/13] x86, irq: Convert irq_2_pin list to generic list
Date	Thu, 23 Feb 2012 19:48:47 -0800

So we can use generic list helper function.

Also make free_irq_cfg() free irq_2_pin list.
----

http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=commitdiff;h=4010f4dbd1b172e3080d3e6c459a58c4b575f081

Yinghai

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] x86/ioapic: fix the irq_2_pin mem leak when destroy_irq
  2012-10-17  2:02 ` Yinghai Lu
@ 2012-10-17  3:36   ` Liu, Chuansheng
  2012-10-17  4:40     ` Yinghai Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Liu, Chuansheng @ 2012-10-17  3:36 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: tglx, mingo, Siddha, Suresh B, linux-kernel

> -----Original Message-----
> From: yhlu.kernel@gmail.com [mailto:yhlu.kernel@gmail.com] On Behalf Of
> Yinghai Lu
> Sent: Wednesday, October 17, 2012 10:03 AM
> To: Liu, Chuansheng
> Cc: tglx@linutronix.de; mingo@redhat.com; Siddha, Suresh B;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] x86/ioapic: fix the irq_2_pin mem leak when destroy_irq
> 
> On Wed, Oct 17, 2012 at 3:11 AM, Chuansheng Liu
> <chuansheng.liu@intel.com> wrote:
> >
> > When destroying the irq, before free cfg, need to check
> > cfg->irq_2_pin and free it when it is not NULL.
> >
> > Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
> > ---
> 
> i had that in another patch...
> 
> https://lkml.org/lkml/2012/2/23/574
Sorry to not know that.
> 
> ----
> Subject	[PATCH 01/13] x86, irq: Convert irq_2_pin list to generic list
> Date	Thu, 23 Feb 2012 19:48:47 -0800
> 
> So we can use generic list helper function.
Does it really need the generic list with both prev and next pointers?
For irq_2_pin list, the next pointer seems be enough.

> 
> Also make free_irq_cfg() free irq_2_pin list.
> ----
> 
> http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=commitdiff;
> h=4010f4dbd1b172e3080d3e6c459a58c4b575f081
> 
> Yinghai

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/ioapic: fix the irq_2_pin mem leak when destroy_irq
  2012-10-17  3:36   ` Liu, Chuansheng
@ 2012-10-17  4:40     ` Yinghai Lu
  0 siblings, 0 replies; 4+ messages in thread
From: Yinghai Lu @ 2012-10-17  4:40 UTC (permalink / raw)
  To: Liu, Chuansheng; +Cc: tglx, mingo, Siddha, Suresh B, linux-kernel

On Tue, Oct 16, 2012 at 8:36 PM, Liu, Chuansheng
<chuansheng.liu@intel.com> wrote:
>> So we can use generic list helper function.
> Does it really need the generic list with both prev and next pointers?
> For irq_2_pin list, the next pointer seems be enough.

generic version should be always better than home grown one.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] x86/ioapic: fix the irq_2_pin mem leak when destroy_irq
@ 2012-10-17 10:11 Chuansheng Liu
  2012-10-17  2:02 ` Yinghai Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Chuansheng Liu @ 2012-10-17 10:11 UTC (permalink / raw)
  To: tglx, mingo, suresh.b.siddha, yinghai; +Cc: linux-kernel, chuansheng.liu


When destroying the irq, before free cfg, need to check
cfg->irq_2_pin and free it when it is not NULL.

Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
---
 arch/x86/kernel/apic/io_apic.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index c265593..a976ee3 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -201,6 +201,15 @@ static struct irq_pin_list *alloc_irq_pin_list(int node)
 	return kzalloc_node(sizeof(struct irq_pin_list), GFP_KERNEL, node);
 }
 
+static void free_irq_pin_list(struct irq_cfg *cfg)
+{
+	struct irq_pin_list *entry, *next;
+
+	for (entry = cfg->irq_2_pin; entry; entry = next) {
+		next = entry->next;
+		kfree(entry);
+	}
+}
 
 /* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
 static struct irq_cfg irq_cfgx[NR_IRQS_LEGACY];
@@ -276,6 +285,7 @@ static void free_irq_cfg(unsigned int at, struct irq_cfg *cfg)
 	irq_set_chip_data(at, NULL);
 	free_cpumask_var(cfg->domain);
 	free_cpumask_var(cfg->old_domain);
+	free_irq_pin_list(cfg);
 	kfree(cfg);
 }
 
-- 
1.7.0.4




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-17  4:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-17 10:11 [PATCH] x86/ioapic: fix the irq_2_pin mem leak when destroy_irq Chuansheng Liu
2012-10-17  2:02 ` Yinghai Lu
2012-10-17  3:36   ` Liu, Chuansheng
2012-10-17  4:40     ` Yinghai Lu

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.