All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: cbe-oss-dev@ozlabs.org, gregkh@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [Cbe-oss-dev] [RFC] Cell: shutdown method for spu_sysdev_class
Date: Wed, 30 May 2007 11:58:22 +0200	[thread overview]
Message-ID: <20070530095821.GA24373@lst.de> (raw)
In-Reply-To: <200705292023.49968.arnd@arndb.de>

On Tue, May 29, 2007 at 08:23:49PM +0200, Arnd Bergmann wrote:
> On Sunday 06 May 2007, Geoff Levand wrote:
> > --- ps3-linux-dev.orig/arch/powerpc/platforms/cell/spu_base.c
> > +++ ps3-linux-dev/arch/powerpc/platforms/cell/spu_base.c
> > @@ -463,8 +463,21 @@ void spu_free(struct spu *spu)
> >  }
> >  EXPORT_SYMBOL_GPL(spu_free);
> >
> > +static int spu_shutdown(struct sys_device *sysdev)
> > +{
> > +       struct spu *spu = container_of(sysdev, struct spu, sysdev);
> > +
> > +       // what else here???
> > +
> > +       spu_free_irqs(spu);
> > +       spu_destroy_spu(spu);
> > +       kfree(spu);
> > +       return 0;
> > +}
> > +
> >  struct sysdev_class spu_sysdev_class = {
> > -       set_kset_name("spu")
> > +       set_kset_name("spu"),
> > +       .shutdown = spu_shutdown,
> >  };
> >
> >  int spu_add_sysdev_attr(struct sysdev_attribute *attr)
> 
> After some debugging, I found that this patch creates an oops when slab
> debugging is enabled, the reason for that being that sysdev_shutdown()
> iterates over all system devices using list_for_each_entry(), not
> list_for_each_entry_safe().
> 
> There are two ways of fixing this:
> 
> - use list_for_each_entry_safe() to go over all devices so they
>   can be freed in their ->shutdown method.
> - not free the device, because we know the system is going down
>   anyway.
> 
> Is it documented or implied somewhere that ->shutdown must not free
> the device? If not, the first option is probably the safer choice.

It's not documented anywhere, but implicitly assumed.  I don't know
of any shutdown implementation that frees the device.

  reply	other threads:[~2007-05-30  9:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <463D1A2F.10708@am.sony.com>
2007-05-29 18:23 ` [Cbe-oss-dev] [RFC] Cell: shutdown method for spu_sysdev_class Arnd Bergmann
2007-05-30  9:58   ` Christoph Hellwig [this message]
2007-05-30 11:03     ` Arnd Bergmann

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=20070530095821.GA24373@lst.de \
    --to=hch@lst.de \
    --cc=arnd@arndb.de \
    --cc=cbe-oss-dev@ozlabs.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.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 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.