* [PATCH] powerpc/perf: Add documentation around use of "ppc_set_pmu_inuse" in PMU core-book3s
@ 2020-03-30 11:38 Athira Rajeev
2020-03-31 12:43 ` Athira Rajeev
0 siblings, 1 reply; 2+ messages in thread
From: Athira Rajeev @ 2020-03-30 11:38 UTC (permalink / raw)
To: mpe; +Cc: maddy, linuxppc-dev
"pmcregs_in_use" flag is part of lppaca (Virtual Process Area),
which is used to indicate whether Performance Monitoring Unit (PMU) and
PMU sprs are in-use and whether should it be saved/restored by
hypervisor. ppc_set_pmu_inuse() is used to set/unset the VPA
flag "pmcregs_in_use". "pmcregs_in_use" flag is set in
"power_pmu_enable" via ppc_set_pmu_inuse(1) and it is unset
when there are no active events (n_events == 0 condition).
Patch here adds documentation on the ppc_set_pmu_inuse() usage.
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
arch/powerpc/perf/core-book3s.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 3086055..48bfdc9 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1285,6 +1285,11 @@ static void power_pmu_enable(struct pmu *pmu)
goto out;
if (cpuhw->n_events == 0) {
+ /*
+ * Indicate PMU not in-use to Hypervisor.
+ * We end-up here via "ctx_sched_out()" from common code and
+ * "power_pmu_del()".
+ */
ppc_set_pmu_inuse(0);
goto out;
}
@@ -1341,6 +1346,11 @@ static void power_pmu_enable(struct pmu *pmu)
* Write the new configuration to MMCR* with the freeze
* bit set and set the hardware events to their initial values.
* Then unfreeze the events.
+ * ppc_set_pmu_inuse(1): "power_pmu_enable" will unset the
+ * "pmcregs_in_use" flag when a previous profiling/sampling session
+ * is completed and un-setting of flag will notify the Hypervisor to
+ * drop save/restore of PMU sprs. Now that PMU need to be enabled, first
+ * set the "pmcregs_in_use" flag in VPA.
*/
ppc_set_pmu_inuse(1);
mtspr(SPRN_MMCRA, cpuhw->mmcr[2] & ~MMCRA_SAMPLE_ENABLE);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] powerpc/perf: Add documentation around use of "ppc_set_pmu_inuse" in PMU core-book3s
2020-03-30 11:38 [PATCH] powerpc/perf: Add documentation around use of "ppc_set_pmu_inuse" in PMU core-book3s Athira Rajeev
@ 2020-03-31 12:43 ` Athira Rajeev
0 siblings, 0 replies; 2+ messages in thread
From: Athira Rajeev @ 2020-03-31 12:43 UTC (permalink / raw)
To: Michael Ellerman; +Cc: maddy, linuxppc-dev
Hi,
Please ignore this version as I messed up with the author information. I am sending a V2 with the proper author name.
Thanks
Athira
> On 30-Mar-2020, at 5:08 PM, Athira Rajeev <atrajeev@linux.vnet.ibm.com> wrote:
>
> "pmcregs_in_use" flag is part of lppaca (Virtual Process Area),
> which is used to indicate whether Performance Monitoring Unit (PMU) and
> PMU sprs are in-use and whether should it be saved/restored by
> hypervisor. ppc_set_pmu_inuse() is used to set/unset the VPA
> flag "pmcregs_in_use". "pmcregs_in_use" flag is set in
> "power_pmu_enable" via ppc_set_pmu_inuse(1) and it is unset
> when there are no active events (n_events == 0 condition).
>
> Patch here adds documentation on the ppc_set_pmu_inuse() usage.
>
> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
> arch/powerpc/perf/core-book3s.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
> index 3086055..48bfdc9 100644
> --- a/arch/powerpc/perf/core-book3s.c
> +++ b/arch/powerpc/perf/core-book3s.c
> @@ -1285,6 +1285,11 @@ static void power_pmu_enable(struct pmu *pmu)
> goto out;
>
> if (cpuhw->n_events == 0) {
> + /*
> + * Indicate PMU not in-use to Hypervisor.
> + * We end-up here via "ctx_sched_out()" from common code and
> + * "power_pmu_del()".
> + */
> ppc_set_pmu_inuse(0);
> goto out;
> }
> @@ -1341,6 +1346,11 @@ static void power_pmu_enable(struct pmu *pmu)
> * Write the new configuration to MMCR* with the freeze
> * bit set and set the hardware events to their initial values.
> * Then unfreeze the events.
> + * ppc_set_pmu_inuse(1): "power_pmu_enable" will unset the
> + * "pmcregs_in_use" flag when a previous profiling/sampling session
> + * is completed and un-setting of flag will notify the Hypervisor to
> + * drop save/restore of PMU sprs. Now that PMU need to be enabled, first
> + * set the "pmcregs_in_use" flag in VPA.
> */
> ppc_set_pmu_inuse(1);
> mtspr(SPRN_MMCRA, cpuhw->mmcr[2] & ~MMCRA_SAMPLE_ENABLE);
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-31 12:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-30 11:38 [PATCH] powerpc/perf: Add documentation around use of "ppc_set_pmu_inuse" in PMU core-book3s Athira Rajeev
2020-03-31 12:43 ` Athira Rajeev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox