linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: benh@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 1/2] Add irq_free_host() to free an irq_host
Date: Thu, 15 May 2008 17:00:37 +1000	[thread overview]
Message-ID: <1210834837.17568.21.camel@localhost> (raw)
In-Reply-To: <1210834512.8297.87.camel@pasglop>

[-- Attachment #1: Type: text/plain, Size: 1295 bytes --]

On Wed, 2008-05-14 at 23:55 -0700, Benjamin Herrenschmidt wrote:
> On Thu, 2008-05-08 at 14:23 +1000, Michael Ellerman wrote:
> > +void irq_free_host(struct irq_host *host)
> > +{
> > +       /* If it's still very early in boot we can't free, oh well. */
> > +       if (mem_init_done)
> > +               kfree(host);
> > +}
> 
> Hrm... that means that a host that was allocated before mem_init_done
> and freed later will call kfree on memory obtained from bootmem... no
> good.

God damn mem_init_done crap .. gah you're right.

> In which case do we need to free and irq host other than failure in
> irq_alloc_host ?

Well most code either doesn't check the return value, or panics. There's
two callers at the moment (after my patch) of irq_free_host(),
axon_msi.c and ipic.c - they both call free from the same function as
alloc so they're safe.

We could just do the free in irq_alloc_host()'s error path and have
irq_free_host() not actually free anything, just drop the reference
count. What a mess.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

      reply	other threads:[~2008-05-15  7:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08  4:23 [PATCH 1/2] Add irq_free_host() to free an irq_host Michael Ellerman
2008-05-08  4:23 ` [PATCH 2/2] Fix irq_alloc_host() reference counting and callers Michael Ellerman
2008-05-13 10:58   ` Paul Mackerras
2008-05-13 11:49     ` Michael Ellerman
2008-05-15  6:55 ` [PATCH 1/2] Add irq_free_host() to free an irq_host Benjamin Herrenschmidt
2008-05-15  7:00   ` Michael Ellerman [this message]

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=1210834837.17568.21.camel@localhost \
    --to=michael@ellerman.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    /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 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).