[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<OS3PR01MB6903C0DAEAAC66FB86AAAC1FD40C2@OS3PR01MB6903.jpnprd01.prod.outlook.com>
Date: Wed, 25 Dec 2024 08:07:25 +0000
From: "Yoshihiro Furudera (Fujitsu)" <fj5100bi@...itsu.com>
To: 'Jonathan Cameron' <Jonathan.Cameron@...wei.com>
CC: 'Will Deacon' <will@...nel.org>, 'Mark Rutland' <mark.rutland@....com>,
'Jonathan Corbet' <corbet@....net>, 'Catalin Marinas'
<catalin.marinas@....com>, "'linux-arm-kernel@...ts.infradead.org'"
<linux-arm-kernel@...ts.infradead.org>, 'Bjorn Andersson'
<quic_bjorande@...cinc.com>, 'Geert Uytterhoeven' <geert+renesas@...der.be>,
'Krzysztof Kozlowski' <krzysztof.kozlowski@...aro.org>, 'Dmitry Baryshkov'
<dmitry.baryshkov@...aro.org>, 'Konrad Dybcio' <konradybcio@...nel.org>,
'Neil Armstrong' <neil.armstrong@...aro.org>, 'Arnd Bergmann'
<arnd@...db.de>, ' NĂcolas "F. R. A. Prado"'
<nfraprado@...labora.com>, 'Thomas Gleixner' <tglx@...utronix.de>, 'Peter
Zijlstra' <peterz@...radead.org>, "'linux-doc@...r.kernel.org'"
<linux-doc@...r.kernel.org>, "'linux-kernel@...r.kernel.org'"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 1/2] perf: Fujitsu: Add the Uncore MAC PMU driver
Hi, Jonathan
> > > +static ssize_t cpumask_show(struct device *dev,
> > > + struct device_attribute *attr, char *buf) {
> > > + struct mac_pmu *macpmu = to_mac_pmu(dev_get_drvdata(dev));
> > If as suggested below you used an index to store the cpu rather than a
> > one hot mask, you'd need to create the mask here to print it.
>
> I'll use the CPU index.
> So I will create a mask and print it.
>
> > > +
> > > + return cpumap_print_to_pagebuf(true, buf, &macpmu->cpumask); }
> >
> > ...
> >
> > > +static int fujitsu_mac_pmu_online_cpu(unsigned int cpu, struct
> > > +hlist_node *node) {
> > > + struct mac_pmu *macpmu = hlist_entry_safe(node, struct mac_pmu,
> > > +node);
> > > +
> > > + /* If there is not a CPU/PMU association pick this CPU */
> > > + if (cpumask_empty(&macpmu->cpumask))
> > > + cpumask_set_cpu(cpu, &macpmu->cpumask);
> > As below. Seems like just storing the CPU index (and using -1 for not
> > yet
> > set) would be simpler than
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static int fujitsu_mac_pmu_offline_cpu(unsigned int cpu, struct
> > > +hlist_node *node) {
> > > + struct mac_pmu *macpmu = hlist_entry_safe(node, struct mac_pmu,
> > node);
> > > + unsigned int target;
> > > +
> > > + if (!cpumask_test_and_clear_cpu(cpu, &macpmu->cpumask))
> >
> > If you are only ever going to set one bit in the mask, why not just
> > store the CPU index instead?
>
> I'll use the CPU index instead.
Sorry, I considered using the CPU index, but while implementing, I realized that
using cpumask makes the process simpler. Therefore, I would like to keep it as it is.
Best Regards,
Yoshihiro Furudera
Powered by blists - more mailing lists