From: Nicholas Piggin <npiggin@gmail.com>
To: Kajol Jain <kjain@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au
Cc: atrajeev@linux.vnet.ibm.com, maddy@linux.ibm.com,
disgoel@linux.vnet.ibm.com, rnsastry@linux.ibm.com
Subject: Re: [PATCH 1/2] powerpc/kvm: Move pmu code in kvm folder to separate file for power9 and later platforms
Date: Wed, 13 Jul 2022 15:41:54 +1000 [thread overview]
Message-ID: <1657690385.27p62dp0u2.astroid@bobo.none> (raw)
In-Reply-To: <20220711034927.213192-1-kjain@linux.ibm.com>
Excerpts from Kajol Jain's message of July 11, 2022 1:49 pm:
> File book3s_hv_p9_entry.c in powerpc/kvm folder consists of functions
> like freeze_pmu, switch_pmu_to_guest and switch_pmu_to_host which are
> specific to Performance Monitoring Unit(PMU) for power9 and later
> platforms.
>
> For better maintenance, moving pmu related code from
> book3s_hv_p9_entry.c to a new file called book3s_hv_p9_perf.c,
> without any logic change.
> Also make corresponding changes in the Makefile to include
> book3s_hv_p9_perf.c during compilation.
> +
> + if (ppc_get_pmu_inuse()) {
> + mtspr(SPRN_PMC1, host_os_sprs->pmc1);
> + mtspr(SPRN_PMC2, host_os_sprs->pmc2);
> + mtspr(SPRN_PMC3, host_os_sprs->pmc3);
> + mtspr(SPRN_PMC4, host_os_sprs->pmc4);
> + mtspr(SPRN_PMC5, host_os_sprs->pmc5);
> + mtspr(SPRN_PMC6, host_os_sprs->pmc6);
> + mtspr(SPRN_MMCR1, host_os_sprs->mmcr1);
> + mtspr(SPRN_MMCR2, host_os_sprs->mmcr2);
> + mtspr(SPRN_SDAR, host_os_sprs->sdar);
> + mtspr(SPRN_SIAR, host_os_sprs->siar);
> + mtspr(SPRN_SIER, host_os_sprs->sier1);
> +
> + if (cpu_has_feature(CPU_FTR_ARCH_31)) {
> + mtspr(SPRN_MMCR3, host_os_sprs->mmcr3);
> + mtspr(SPRN_SIER2, host_os_sprs->sier2);
> + mtspr(SPRN_SIER3, host_os_sprs->sier3);
> + }
> +
> + /* Set MMCRA then MMCR0 last */
> + mtspr(SPRN_MMCRA, host_os_sprs->mmcra);
> + mtspr(SPRN_MMCR0, host_os_sprs->mmcr0);
> + isync();
> + }
> +}
> +EXPORT_SYMBOL_GPL(switch_pmu_to_host);
>
I'm still thinking these parts of the code in particular that do the
host PMU save/restore could be handled by calls into perf subsystem. In
some cases it doesn't need to save SPRs because it can recreate them or
is not using them. Maybe it's not so simple.
Either way, I'm fine with this move to stat with.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
next prev parent reply other threads:[~2022-07-13 5:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-11 3:49 [PATCH 1/2] powerpc/kvm: Move pmu code in kvm folder to separate file for power9 and later platforms Kajol Jain
2022-07-11 3:49 ` [PATCH 2/2] powerpc/kvm: Remove comment related to moving PMU code to perf subsystem Kajol Jain
2022-07-13 5:43 ` Nicholas Piggin
2022-07-13 5:41 ` Nicholas Piggin [this message]
2022-07-14 7:54 ` [PATCH 1/2] powerpc/kvm: Move pmu code in kvm folder to separate file for power9 and later platforms Madhavan Srinivasan
2022-08-02 11:01 ` Michael Ellerman
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=1657690385.27p62dp0u2.astroid@bobo.none \
--to=npiggin@gmail.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=disgoel@linux.vnet.ibm.com \
--cc=kjain@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=rnsastry@linux.ibm.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).