Message ID | 20090701205957.GA9583@oksana.dev.rtsoft.ru (mailing list archive) |
---|---|
State | Accepted, archived |
Commit | ea96025a26ab8949adab1a8e81419202f92f3f7f |
Delegated to: | Benjamin Herrenschmidt |
Headers | show |
Anton Vorontsov wrote: > diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c > index 63cdf98..074905c 100644 > --- a/arch/powerpc/sysdev/qe_lib/qe_ic.c > +++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c > @@ -333,12 +333,10 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags, > if (ret) > return; > > - qe_ic = alloc_bootmem(sizeof(struct qe_ic)); > + qe_ic = kzalloc(sizeof(*qe_ic), GFP_KERNEL); This function is called during init_IRQ() in main.c. Looking at the code, I don't see any earlier calls to kzalloc(). Are you sure this is supposed to work?
On Jul 1, 2009, at 3:59 PM, Anton Vorontsov wrote: > qe_ic is in the same boat, just as every other PIC controller. Heh.. > doing some 'grep alloc_bootmem', it seems that there are pretty > much offenders. Let's fix them? > > arch/powerpc/platforms/82xx/pq2ads-pci-pic.c | 2 +- > arch/powerpc/sysdev/ipic.c | 4 +--- > arch/powerpc/sysdev/mpic.c | 9 ++++----- > arch/powerpc/sysdev/qe_lib/qe_ic.c | 4 +--- > arch/powerpc/sysdev/uic.c | 3 +-- > 5 files changed, 8 insertions(+), 14 deletions(-) mpic should already be fixed.. I just thing the pull occurred after - rc1 because of Ben being sick. - k
On Wed, Jul 01, 2009 at 04:13:43PM -0500, Timur Tabi wrote: > Anton Vorontsov wrote: > > > diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c > > index 63cdf98..074905c 100644 > > --- a/arch/powerpc/sysdev/qe_lib/qe_ic.c > > +++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c > > @@ -333,12 +333,10 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags, > > if (ret) > > return; > > > > - qe_ic = alloc_bootmem(sizeof(struct qe_ic)); > > + qe_ic = kzalloc(sizeof(*qe_ic), GFP_KERNEL); > > This function is called during init_IRQ() in main.c. That's the main point of this patch (as subject says). Nowadays init_IRQ() is called with kernel allocator available, so we shouldn't use alloc_bootmem() anymore. > Looking at the code, I don't see any earlier calls to kzalloc(). You seem to be looking into an outdated kernel. ;-) IIRC, the first caller of kzalloc() in init_IRQ() path appeared in commit 85355bb272db31a3f2dd99d547eef794805e1319 Author: Kumar Gala <galak@kernel.crashing.org> Date: Thu Jun 18 22:01:20 2009 +0000 powerpc: Fix mpic alloc warning > Are you sure this is supposed > to work? This was boot-tested on real HW. :-) Thanks,
On Wed, Jul 01, 2009 at 04:25:22PM -0500, Kumar Gala wrote: > > On Jul 1, 2009, at 3:59 PM, Anton Vorontsov wrote: > > >qe_ic is in the same boat, just as every other PIC controller. Heh.. > >doing some 'grep alloc_bootmem', it seems that there are pretty > >much offenders. Let's fix them? > > > >arch/powerpc/platforms/82xx/pq2ads-pci-pic.c | 2 +- > >arch/powerpc/sysdev/ipic.c | 4 +--- > >arch/powerpc/sysdev/mpic.c | 9 ++++----- > >arch/powerpc/sysdev/qe_lib/qe_ic.c | 4 +--- > >arch/powerpc/sysdev/uic.c | 3 +-- > >5 files changed, 8 insertions(+), 14 deletions(-) > > mpic should already be fixed.. I just thing the pull occurred after > -rc1 because of Ben being sick. Fixed by this? commit 85355bb272db31a3f2dd99d547eef794805e1319 Author: Kumar Gala <galak@kernel.crashing.org> Date: Thu Jun 18 22:01:20 2009 +0000 powerpc: Fix mpic alloc warning Then this isn't enough. There were two more calls of alloc_bootmem() in mpic. Thanks,
Anton Vorontsov wrote: > That's the main point of this patch (as subject says). Yes, I see that now. :-) > You seem to be looking into an outdated kernel. ;-) IIRC, the > first caller of kzalloc() in init_IRQ() path appeared in Yes, you're right.
Anton Vorontsov wrote: > This patch fixes various badnesses like this for all interrupt > controllers: ... > > Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> > --- Acked-by: Timur Tabi <timur@freescale.com>
diff --git a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c index ddf0bdc..7ee979f 100644 --- a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c +++ b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c @@ -147,7 +147,7 @@ int __init pq2ads_pci_init_irq(void) goto out; } - priv = alloc_bootmem(sizeof(struct pq2ads_pci_pic)); + priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) { of_node_put(np); ret = -ENOMEM; diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c index a86d3ce..69e2630 100644 --- a/arch/powerpc/sysdev/ipic.c +++ b/arch/powerpc/sysdev/ipic.c @@ -728,12 +728,10 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags) if (ret) return NULL; - ipic = alloc_bootmem(sizeof(struct ipic)); + ipic = kzalloc(sizeof(*ipic), GFP_KERNEL); if (ipic == NULL) return NULL; - memset(ipic, 0, sizeof(struct ipic)); - ipic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, NR_IPIC_INTS, &ipic_host_ops, 0); diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index d46de1f..3981ae4 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c @@ -508,9 +508,8 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic) printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n"); /* Allocate fixups array */ - mpic->fixups = alloc_bootmem(128 * sizeof(struct mpic_irq_fixup)); + mpic->fixups = kzalloc(128 * sizeof(*mpic->fixups), GFP_KERNEL); BUG_ON(mpic->fixups == NULL); - memset(mpic->fixups, 0, 128 * sizeof(struct mpic_irq_fixup)); /* Init spinlock */ spin_lock_init(&mpic->fixup_lock); @@ -1109,9 +1108,8 @@ struct mpic * __init mpic_alloc(struct device_node *node, psize /= 4; bits = intvec_top + 1; mapsize = BITS_TO_LONGS(bits) * sizeof(unsigned long); - mpic->protected = alloc_bootmem(mapsize); + mpic->protected = kzalloc(mapsize, GFP_KERNEL); BUG_ON(mpic->protected == NULL); - memset(mpic->protected, 0, mapsize); for (i = 0; i < psize; i++) { if (psrc[i] > intvec_top) continue; @@ -1353,7 +1351,8 @@ void __init mpic_init(struct mpic *mpic) #ifdef CONFIG_PM /* allocate memory to save mpic state */ - mpic->save_data = alloc_bootmem(mpic->num_sources * sizeof(struct mpic_irq_save)); + mpic->save_data = kmalloc(mpic->num_sources * sizeof(*mpic->save_data), + GFP_KERNEL); BUG_ON(mpic->save_data == NULL); #endif } diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c index 63cdf98..074905c 100644 --- a/arch/powerpc/sysdev/qe_lib/qe_ic.c +++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c @@ -333,12 +333,10 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags, if (ret) return; - qe_ic = alloc_bootmem(sizeof(struct qe_ic)); + qe_ic = kzalloc(sizeof(*qe_ic), GFP_KERNEL); if (qe_ic == NULL) return; - memset(qe_ic, 0, sizeof(struct qe_ic)); - qe_ic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, NR_QE_IC_INTS, &qe_ic_host_ops, 0); if (qe_ic->irqhost == NULL) diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c index d35405c..466ce9a 100644 --- a/arch/powerpc/sysdev/uic.c +++ b/arch/powerpc/sysdev/uic.c @@ -258,11 +258,10 @@ static struct uic * __init uic_init_one(struct device_node *node) BUG_ON(! of_device_is_compatible(node, "ibm,uic")); - uic = alloc_bootmem(sizeof(*uic)); + uic = kzalloc(sizeof(*uic), GFP_KERNEL); if (! uic) return NULL; /* FIXME: panic? */ - memset(uic, 0, sizeof(*uic)); spin_lock_init(&uic->lock); indexp = of_get_property(node, "cell-index", &len); if (!indexp || (len != sizeof(u32))) {