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]
Message-ID: <1311582751.3938.1481.camel@minggr.sh.intel.com>
Date:	Mon, 25 Jul 2011 16:32:31 +0800
From:	Lin Ming <ming.m.lin@...el.com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	Ingo Molnar <mingo@...e.hu>, Andi Kleen <andi@...stfloor.org>,
	Stephane Eranian <eranian@...gle.com>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/6] perf: Add interface to add general events to
 sysfs

On Mon, 2011-07-25 at 15:57 +0800, Peter Zijlstra wrote:
> On Tue, 2011-07-19 at 15:52 +0800, Lin Ming wrote:
> 
> > > I'd rather not have a function pointer here, and all the kobj thingies
> > > can be hooking into the existing struct device, right?
> > 
> > I forgot to mention one important reason why I added a function pointer.
> > 
> > The events can only be added to sysfs after PMU sysfs is initialized in
> > perf_event_sysfs_init ->
> >     pmu_dev_alloc
> 
> Right.
> 
> > > @@ -5571,6 +5571,8 @@ static int pmu_dev_alloc(struct pmu *pmu)
> > >        if (ret)
> > >                goto free_dev;
> > >
> > > +       if (pmu->add_events)
> > > +               pmu->add_events();
> > 
> > So we need a pmu callback which is called in pmu_dev_alloc to add events
> > to sysfs.
> > 
> > You suggested a new interface,
> > int perf_pmu_add_event(struct pmu *pmu, const char *name, u64 config)
> > 
> > But where should it be called?
> > I guess you mean to call it in pmu init function, for example,
> > uncore_pmu_init.
> > 
> > But pmu init function maybe called before perf_event_sysfs_init, which
> > means the pmu sysfs has not been initialized yet.
> 
> Right, so there is no reason to call perf_pmu_register() really early,
> except for the normal pmu and the software pmu (since they're used by
> the watchdog muck).
> 
> The uncore for example can use late_initcall() just fine and use both
> perf_pmu_register() and the proposed perf_pmu_add_event() from the same 
> init call.
> 
> Only for the primary pmu and software thingies do we need to add an
> extra init call.

This seems a solution.

I'll use late_initcall for uncore.
Then later we can add an extra late_initcall for normal pmu and software
pmu.


--
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