From: Peter Zijlstra <peterz@infradead.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Will Deacon <Will.Deacon@arm.com>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [PATCH] perf: drop module reference on event init failure
Date: Fri, 16 Jan 2015 13:49:42 +0100 [thread overview]
Message-ID: <20150116124942.GX23965@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20150116122603.GJ21809@leverpostej>
On Fri, Jan 16, 2015 at 12:26:03PM +0000, Mark Rutland wrote:
> On Wed, Jan 07, 2015 at 02:56:51PM +0000, Mark Rutland wrote:
> > When initialising an event, perf_init_event will call try_module_get to
> > ensure that the PMU's module cannot be removed for the lifetime of the
> > event, with __free_event dropping the reference when the event is
> > finally destroyed. If something fails after the event has been
> > initialised, but before the event is installed, perf_event_alloc will
> > drop the reference on the module.
> >
> > However, if we fail to initialise an event for some reason (e.g. we ask
> > an uncore PMU to perform sampling, and it refuses to initialise the
> > event), we do not drop the refcount. If we try to open such a bogus
> > event without a precise IDR type, we will loop over each PMU in the pmus
> > list, incrementing each of their refcounts without decrementing them.
> >
> > This patch adds a module_put when pmu->event_init(event) fails, ensuring
> > that the refcounts are balanced in failure cases. As the innards of the
> > precise and search based initialisation look very similar, this logic is
> > hoisted out into a new helper function. While the early return for the
> > failed try_module_get is removed from the search case, this is handled
> > by the remaining return when ret is not -ENOENT.
>
> I hate to ping, but is anyone going to look at this?
>
Thanks for reminding me; the inbox is still a horrid mess.
Looks good, thanks!
next prev parent reply other threads:[~2015-01-16 12:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-07 14:56 Mark Rutland
2015-01-08 11:32 ` Will Deacon
2015-01-08 12:09 ` Mark Rutland
2015-01-16 12:26 ` Mark Rutland
2015-01-16 12:49 ` Peter Zijlstra [this message]
2015-02-04 14:40 ` [tip:perf/core] perf: Drop " tip-bot for Mark Rutland
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=20150116124942.GX23965@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Will.Deacon@arm.com \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=paulus@samba.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
Powered by JetHome