lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 18 Jun 2010 06:51:56 +0200
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	paulus <paulus@...ba.org>,
	stephane eranian <eranian@...glemail.com>,
	Robert Richter <robert.richter@....com>,
	Will Deacon <will.deacon@....com>,
	Paul Mundt <lethal@...ux-sh.org>,
	Cyrill Gorcunov <gorcunov@...il.com>,
	Lin Ming <ming.m.lin@...el.com>,
	Yanmin <yanmin_zhang@...ux.intel.com>,
	Deng-Cheng Zhu <dengcheng.zhu@...il.com>,
	David Miller <davem@...emloft.net>,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH 3/8] perf: register pmu implementations

On Wed, Jun 16, 2010 at 07:48:00PM +0200, Peter Zijlstra wrote:
> > > +
> > > +struct pmu *perf_init_event(struct perf_event *event)
> > > +{
> > > +	struct pmu *pmu;
> > > +	int idx;
> > > +
> > > +	idx = srcu_read_lock(&pmus_srcu);
> > > +	list_for_each_entry_rcu(pmu, &pmus, entry) {
> > > +		int ret = pmu->event_init(event);
> > > +		if (!ret)
> > > +			break;
> > > +		if (ret != -ENOENT) {
> > > +			pmu = ERR_PTR(ret);
> > > +			break;
> > >  		}
> > > -		pmu = &perf_ops_generic;
> > > -		break;
> > >  	}
> > > +	srcu_read_unlock(&pmus_srcu, idx);
> > 
> > 
> > 
> > This could use a simple mutex instead of a spinlock + srcu_sync on
> > writer and srcu on reader.
> 
> Right, that spinlock needs to be a mutex for sure, a later patch adds an
> allocation under it.
> 
> But even with a mutex we need srcu_sync in there to sync against the
> readers.
> 
> > That doesn't matter much that said. What I don't understand is
> > why we need to synchronize the writers. Walking the list with
> > list_*_rcu() looks justified once we support boot events, but
> > until then...
> 
> Well, the typical unregister user would be a module, if you unregister
> and then dealloc the struct pmu by unloading the module a reader might
> still see a reference to it if you don't srcu_sync it.


Ok, I see what you mean.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ