From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Yicong Yang <yangyicong@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
Will Deacon <will@kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<gregkh@linuxfoundation.org>, <yangyicong@hisilicon.com>,
<linuxarm@huawei.com>, Dan Williams <dan.j.williams@intel.com>,
"Shaokun Zhang" <zhangshaokun@hisilicon.com>,
Jiucheng Xu <jiucheng.xu@amlogic.com>,
Khuong Dinh <khuong@os.amperecomputing.com>,
Robert Richter <rric@kernel.org>,
Atish Patra <atishp@atishpatra.org>,
Anup Patel <anup@brainfault.org>, Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Frank Li <Frank.li@nxp.com>,
Shuai Xue <xueshuai@linux.alibaba.com>,
Vineet Gupta <vgupta@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
Fenghua Yu <fenghua.yu@intel.com>,
Dave Jiang <dave.jiang@intel.com>, Wu Hao <hao.wu@intel.com>,
Tom Rix <trix@redhat.com>, <linux-fpga@vger.kernel.org>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Liang Kan <kan.liang@linux.intel.com>
Subject: Re: [PATCH 01/32] perf: Allow a PMU to have a parent
Date: Thu, 6 Apr 2023 11:16:07 +0100 [thread overview]
Message-ID: <20230406111607.00007be5@Huawei.com> (raw)
In-Reply-To: <61f8e489-ae76-38d6-2da0-43cf3c17853d@huawei.com>
On Thu, 6 Apr 2023 12:03:27 +0800
Yicong Yang <yangyicong@huawei.com> wrote:
> On 2023/4/4 21:41, Jonathan Cameron wrote:
> > Some PMUs have well defined parents such as PCI devices.
> > As the device_initialize() and device_add() are all within
> > pmu_dev_alloc() which is called from perf_pmu_register()
> > there is no opportunity to set the parent from within a driver.
> >
> > Add a struct device *parent field to struct pmu and use that
> > to set the parent.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> >
> > ---
> > Previously posted in CPMU series hence the change log.
> > v3: No change
> > ---
> > include/linux/perf_event.h | 1 +
> > kernel/events/core.c | 1 +
> > 2 files changed, 2 insertions(+)
> >
> > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> > index d5628a7b5eaa..b99db1eda72c 100644
> > --- a/include/linux/perf_event.h
> > +++ b/include/linux/perf_event.h
> > @@ -303,6 +303,7 @@ struct pmu {
> >
> > struct module *module;
> > struct device *dev;
> > + struct device *parent;
> > const struct attribute_group **attr_groups;
> > const struct attribute_group **attr_update;
> > const char *name;
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index fb3e436bcd4a..a84c282221f2 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -11367,6 +11367,7 @@ static int pmu_dev_alloc(struct pmu *pmu)
> >
> > dev_set_drvdata(pmu->dev, pmu);
> > pmu->dev->bus = &pmu_bus;
> > + pmu->dev->parent = pmu->parent;
>
> If there's no parent assigned, is it ok to add some check here? Then we can find it earlier
> maybe at develop stage.
In the long run I agree it would be good. Short term there are more instances of
struct pmu that don't have parents than those that do (even after this series).
We need to figure out what to do about those before adding checks on it being
set.
Jonathan
>
> Thanks.
>
> > pmu->dev->release = pmu_dev_release;
> >
> > ret = dev_set_name(pmu->dev, "%s", pmu->name);
> >
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-04-06 10:17 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 13:41 [PATCH 00/32] Add parents to struct pmu -> dev Jonathan Cameron
2023-04-04 13:41 ` [PATCH 01/32] perf: Allow a PMU to have a parent Jonathan Cameron
2023-04-04 13:51 ` Greg KH
2023-04-06 4:03 ` Yicong Yang
2023-04-06 10:16 ` Jonathan Cameron [this message]
2023-04-06 12:40 ` Peter Zijlstra
2023-04-06 16:44 ` Jonathan Cameron
2023-04-06 17:08 ` Greg KH
2023-04-12 9:56 ` Jonathan Cameron
2023-04-06 19:49 ` Peter Zijlstra
2023-06-06 13:06 ` Mark Rutland
2023-06-06 13:18 ` Peter Zijlstra
2023-06-06 13:30 ` Mark Rutland
2023-06-06 13:48 ` Peter Zijlstra
2023-06-07 11:00 ` Robin Murphy
2023-04-12 12:41 ` Robin Murphy
2023-04-04 13:41 ` [PATCH 02/32] perf/hisi-pcie: Assign parent for event_source device Jonathan Cameron
2023-04-04 13:51 ` Greg KH
2023-04-06 3:56 ` Yicong Yang
2023-04-04 13:41 ` [PATCH 03/32] Documentation: hisi-pmu: Drop reference to /sys/devices path Jonathan Cameron
2023-04-04 13:52 ` Greg KH
2023-04-06 3:56 ` Yicong Yang
2023-04-04 13:41 ` [PATCH 04/32] perf/hisi-uncore: Assign parents for event_source devices Jonathan Cameron
2023-04-04 13:52 ` Greg KH
2023-04-06 3:57 ` Yicong Yang
2023-04-04 13:41 ` [PATCH 05/32] Documentation: hns-pmu: Use /sys/bus/event_source/devices paths Jonathan Cameron
2023-04-04 13:52 ` Greg KH
2023-04-04 13:41 ` [PATCH 06/32] perf/hisi-hns3: Assign parents for event_source device Jonathan Cameron
2023-04-04 13:42 ` [PATCH 07/32] perf/amlogic: Assign parents for event_source devices Jonathan Cameron
2023-04-10 2:00 ` Jiucheng Xu
2023-04-04 13:42 ` [PATCH 08/32] perf/arm_cspmu: " Jonathan Cameron
2023-04-04 14:50 ` Suzuki K Poulose
2023-04-04 13:42 ` [PATCH 09/32] Documentation: xgene-pmu: Use /sys/bus/event_source/devices paths Jonathan Cameron
2023-04-04 13:42 ` [PATCH 10/32] perf/xgene: Assign parents for event_source devices Jonathan Cameron
2023-04-04 13:42 ` [PATCH 11/32] Documentation: thunderx2-pmu: Use /sys/bus/event_source/devices paths Jonathan Cameron
2023-04-04 13:42 ` [PATCH 12/32] perf/thunderx2: Assign parents for event_source devices Jonathan Cameron
2023-04-04 13:42 ` [PATCH 13/32] perf/riscv: " Jonathan Cameron
2023-04-04 13:42 ` [PATCH 14/32] Documentation: qcom-pmu: Use /sys/bus/event_source/devices paths Jonathan Cameron
2023-04-04 13:42 ` [PATCH 15/32] perf/qcom: Assign parents for event_source devices Jonathan Cameron
2023-04-04 13:42 ` [PATCH 16/32] perf/imx_ddr: " Jonathan Cameron
2023-04-04 13:42 ` [PATCH 17/32] perf/arm_pmu: " Jonathan Cameron
2023-04-04 13:42 ` [PATCH 18/32] perf/alibaba_uncore: Assign parents for event_source device Jonathan Cameron
2023-04-05 3:50 ` Shuai Xue
2023-04-04 13:42 ` [PATCH 19/32] perf/arm-cci: " Jonathan Cameron
2023-04-04 14:45 ` Suzuki K Poulose
2023-04-04 13:42 ` [PATCH 20/32] perf/arm-ccn: " Jonathan Cameron
2023-04-12 12:09 ` Suzuki K Poulose
2023-04-04 13:42 ` [PATCH 21/32] perf/arm-cmn: " Jonathan Cameron
2023-04-12 11:52 ` Robin Murphy
2023-04-04 13:42 ` [PATCH 22/32] perf/arm-dmc620: " Jonathan Cameron
2023-04-04 13:42 ` [PATCH 23/32] perf/arm-dsu: " Jonathan Cameron
2023-04-04 14:52 ` Suzuki K Poulose
2023-04-04 13:42 ` [PATCH 24/32] perf/arm-smmuv3: " Jonathan Cameron
2023-04-04 13:42 ` [PATCH 25/32] perf/arm-spe: " Jonathan Cameron
2023-04-12 12:08 ` Suzuki K Poulose
2023-04-04 13:42 ` [PATCH 26/32] arc: Assign parents for event_source devices Jonathan Cameron
2023-04-04 13:42 ` [PATCH 27/32] ARM: imx: Assign parents for mmdc " Jonathan Cameron
2023-04-04 13:42 ` [PATCH 28/32] dmaengine: idxd: Assign parent for event_source device Jonathan Cameron
2023-04-04 13:42 ` [PATCH 29/32] fpga: dfl: " Jonathan Cameron
2023-04-07 6:42 ` Xu Yilun
2023-04-04 13:42 ` [PATCH 30/32] drivers/nvdimm: " Jonathan Cameron
2023-04-05 5:05 ` Dan Williams
2023-04-04 13:42 ` [PATCH 31/32] Documentation: ABI + trace: hisi_ptt: update paths to bus/event_source Jonathan Cameron
2023-04-06 3:54 ` Yicong Yang
2023-04-04 13:42 ` [PATCH 32/32] hwtracing: hisi_ptt: Assign parent for event_source device Jonathan Cameron
2023-04-06 3:55 ` Yicong Yang
2023-04-04 13:51 ` [PATCH 00/32] Add parents to struct pmu -> dev Greg KH
2023-04-04 14:40 ` Greg KH
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=20230406111607.00007be5@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=Frank.li@nxp.com \
--cc=acme@kernel.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=anup@brainfault.org \
--cc=atishp@atishpatra.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=fenghua.yu@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hao.wu@intel.com \
--cc=jiucheng.xu@amlogic.com \
--cc=kan.liang@linux.intel.com \
--cc=khuong@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rric@kernel.org \
--cc=shawnguo@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=trix@redhat.com \
--cc=vgupta@kernel.org \
--cc=will@kernel.org \
--cc=xueshuai@linux.alibaba.com \
--cc=yangyicong@hisilicon.com \
--cc=yangyicong@huawei.com \
--cc=zhangshaokun@hisilicon.com \
/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;
as well as URLs for NNTP newsgroup(s).