public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Jerry Snitselaar <jerry.snitselaar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH] device_cgroup: lock assert fails in dev_exception_clean()
Date: Thu, 17 Jan 2013 15:13:42 -0800 (PST)	[thread overview]
Message-ID: <20130117231341.GA14588@cantor.us.oracle.com> (raw)
In-Reply-To: <20130117220642.GE16568-9pTldWuhBndy/B6EtB590w@public.gmane.org>

On Thu Jan 17 13, Tejun Heo wrote:
> Hello, Jerry.
> 
> Can you please also cc cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org and Aristeu Rozanski
> <aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>?
> 
> On Thu, Jan 17, 2013 at 03:00:18PM -0700, Jerry Snitselaar wrote:
> > devcgroup_css_free() calls dev_exception_clean() without the
> > devcgroup_mutex being held.
> > 
> > Shutting down a kvm virt was giving me the following trace:
> 
> Hmm...
> 
> > Signed-off-by: Jerry Snitselaar <jerry.snitselaar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> > ---
> >  security/device_cgroup.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/security/device_cgroup.c b/security/device_cgroup.c
> > index 19ecc8d..d794abc 100644
> > --- a/security/device_cgroup.c
> > +++ b/security/device_cgroup.c
> > @@ -215,7 +215,9 @@ static void devcgroup_css_free(struct cgroup *cgroup)
> >  	struct dev_cgroup *dev_cgroup;
> >  
> >  	dev_cgroup = cgroup_to_devcgroup(cgroup);
> > +	mutex_lock(&devcgroup_mutex);
> 
> You can't grab mutex from rcu callback.  It seems like the lockdep
> assertion isn't necessary in this case as the free callback should be
> the last remaining user of the dev_cgroup.  Maybe factor out
> __devcgroup_css_free() which doesn't have lockdep assertion?
> 

Ok. I was wondering if it was really needed since it was freeing
dev_cgroup right after that. I probably would have never noticed the
trace if hadn't been checking to see if a fix for ttm stopped it from
spamming me with them for trying to sleep in an invalid context.

Jerry

> >  	dev_exception_clean(dev_cgroup);
> > +	mutex_unlock(&devcgroup_mutex);
> >  	kfree(dev_cgroup);
> 
> Thanks.
> 
> -- 
> tejun

       reply	other threads:[~2013-01-17 23:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1358460018-14717-1-git-send-email-jerry.snitselaar@oracle.com>
     [not found] ` <1358460018-14717-2-git-send-email-jerry.snitselaar@oracle.com>
     [not found]   ` <20130117220642.GE16568@mtj.dyndns.org>
     [not found]     ` <20130117220642.GE16568-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-01-17 23:13       ` Jerry Snitselaar [this message]
     [not found]         ` <20130117231341.GA14588-w8wXvOoPVbZpWwPY5x2yo1aTQe2KTcn/@public.gmane.org>
2013-01-23  4:31           ` [PATCH] device_cgroup: lock assert fails in dev_exception_clean() Jerry Snitselaar
     [not found]             ` <20130123043140.GA5913-w8wXvOoPVbZpWwPY5x2yo1aTQe2KTcn/@public.gmane.org>
2013-01-23 14:29               ` Aristeu Rozanski
     [not found]                 ` <20130123142939.GC17632-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-01-23 16:36                   ` Tejun Heo
     [not found]                     ` <20130123163640.GB2373-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-01-23 16:38                       ` Aristeu Rozanski
     [not found]                         ` <20130123163849.GH17632-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-01-23 16:41                           ` Tejun Heo

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=20130117231341.GA14588@cantor.us.oracle.com \
    --to=jerry.snitselaar-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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