Re: [tip:perf/urgent] perf/x86: Set pmu->module in Intel PMU modules
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [tip:perf/urgent] perf/x86: Set pmu->module in Intel PMU modules
- From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 5 Jan 2017 10:46:30 -0800
- Cc: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, davidcc@xxxxxxxxxx, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, kan.liang@xxxxxxxxx, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>, Peter Anvin <hpa@xxxxxxxxx>, Borislav Petkov <bp@xxxxxxx>, Paul Turner <pjt@xxxxxxxxxx>, Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>, Stephane Eranian <eranian@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, "linux-tip-commits@xxxxxxxxxxxxxxx" <linux-tip-commits@xxxxxxxxxxxxxxx>
- In-reply-to: <20170105155221.GA3107@twins.programming.kicks-ass.net>
- References: <1482455860-116269-1-git-send-email-davidcc@google.com> <tip-74545f63890e38520eb4d1dbedcadaa9c0dbc824@git.kernel.org> <20170105155221.GA3107@twins.programming.kicks-ass.net>
On Thu, Jan 5, 2017 at 7:52 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> The first time I saw this I thought about doing something like the
> below, but never got around to testing if that works and subsequently
> forgot about things again.
>
> Does this make sense and or work?
I'd argue against it.
It will "work", but it's fragile. In particular, if something ever
ends up using perf_pmu_register() through some indirect helper
function, it will do the wrong thing, because
> +#define perf_pmu_register(_pmu, _name, _type) \
> +({ \
> + (_pmu)->module = THIS_MODULE; \
> + __perf_pmu_register((_pmu), (_name), (_type)); \
> +})
.. at that point "THIS_MODULE" could be the module that contains the
helper function that may not actually be the actual end-point module.
Looking at the situation right now, that never happens and all the
users seem to be "leaf" modules. But it would worry me a bit.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Index of Archives]
[Linux Stable Commits]
[Linux Stable Kernel]
[Linux Kernel]
[Linux USB Devel]
[Linux Video &Media]
[Linux Audio Users]
[Yosemite News]
[Linux SCSI]