From: Suzuki K Poulose <Suzuki.Poulose@arm.com> To: Ionela Voinescu <email@example.com> Cc: firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, Jonathan Corbet <email@example.com> Subject: Re: [PATCH v2 4/6] Documentation: arm64: document support for the AMU extension Date: Thu, 30 Jan 2020 18:26:53 +0000 [thread overview] Message-ID: <20200130182653.GA123407@ewhatever.cambridge.arm.com> (raw) In-Reply-To: <20200130164542.GC5208@arm.com> Hi Ionela, On Thu, Jan 30, 2020 at 04:45:42PM +0000, Ionela Voinescu wrote: > Hi Suzuki, > > On Thursday 30 Jan 2020 at 15:04:27 (+0000), Suzuki Kuruppassery Poulose wrote: > > Hi Ionela, > > > > On 18/12/2019 18:26, Ionela Voinescu wrote: > > > The activity monitors extension is an optional extension introduced > > > by the ARMv8.4 CPU architecture. > > > > > > Add initial documentation for the AMUv1 extension: > > > - arm64/amu.txt: AMUv1 documentation > > > - arm64/booting.txt: system registers initialisation > > > - arm64/cpu-feature-registers.txt: visibility to userspace > > > > We have stopped adding "invisible" fields to the list. So, you > > can drop the changes to cpu-feature-registers.txt. > > > > > > > > Signed-off-by: Ionela Voinescu <firstname.lastname@example.org> > > > Cc: Catalin Marinas <email@example.com> > > > Cc: Will Deacon <firstname.lastname@example.org> > > > Cc: Jonathan Corbet <email@example.com> > > > --- > > > Documentation/arm64/amu.rst | 107 ++++++++++++++++++ > > > Documentation/arm64/booting.rst | 14 +++ > > > Documentation/arm64/cpu-feature-registers.rst | 2 + > > > Documentation/arm64/index.rst | 1 + > > > 4 files changed, 124 insertions(+) > > > create mode 100644 Documentation/arm64/amu.rst > > > > > > diff --git a/Documentation/arm64/amu.rst b/Documentation/arm64/amu.rst > > > new file mode 100644 > > > index 000000000000..62a6635522e1 > > > --- /dev/null > > > +++ b/Documentation/arm64/amu.rst > > > @@ -0,0 +1,107 @@ > > > +------------- > > > + > > > +The kernel can safely run a mix of CPUs with and without support for the > > > +activity monitors extension. > > > > > > Therefore, when CONFIG_ARM64_AMU_EXTN is > > > +selected we unconditionally enable the capability to allow any late CPU > > > +(secondary or hotplugged) to detect and use the feature. > > > + > > > +When the feature is detected on a CPU, a per-CPU variable (amu_feat) is > > > +set, but this does not guarantee the correct functionality of the > > > +counters, only the presence of the extension. > > > > nit: I would rather omit the implementation details (esp variable names) > > in the documentation. It may become a pain to keep this in sync with the > > code changes. You could simply mention, "we keep track of the availability > > of the feature" per CPU. If someone wants to figure out > > how, they can always read the code. > > > > > + > > > +Firmware (code running at higher exception levels, e.g. arm-tf) support is > > > +needed to: > > > + - Enable access for lower exception levels (EL2 and EL1) to the AMU > > > + registers. > > > + - Enable the counters. If not enabled these will read as 0. > > > + - Save/restore the counters before/after the CPU is being put/brought up > > > + from the 'off' power state. > > > + > > > +When using kernels that have this configuration enabled but boot with > > > +broken firmware the user may experience panics or lockups when accessing > > > +the counter registers. Even if these symptoms are not observed, the > > > +values returned by the register reads might not correctly reflect reality. > > > +Most commonly, the counters will read as 0, indicating that they are not > > > +enabled. If proper support is not provided in firmware it's best to disable > > > +CONFIG_ARM64_AMU_EXTN. > > > > For the sake of one kernel runs everywhere, do we need some other > > mechanism to disable the AMU. e.g kernel parameter to disable amu > > at runtime ? > > > > The reason I've not added this is twofold: > - Even if we add this, it should be in order to disable the use of the > counters for a certain purpose, in this case frequency invariance. > On its own AMU provides the counters but it does not mandate their > use. > - I could add something to disable the use of the core and cycle > counters for frequency invariance at runtime, but I doubt that > anyone would use it. Logically it makes sense to use the counters > order to have a more accurate view of the performance that the CPUs > are actually providing. Therefore, until anyone asks for this, I > thought it's better to keep it simple and not add extra switches, > until there is a use for them. > > Does it make sense? The comment is about addressing someone who must run an "AMU" enabled kernel ("one kernel") on a system with potentially "broken firmware", where there is no option to use the system as you mention above, the firmware could panic. How common is the "broken firmware" ? Right now there is no way to ensure "firmware" is sane and if someone detects that firmware is broken, there is no way to disable the AMU if they are running a standard distro kernel. A kernel parameter could prevent the AMU capability from being detected on a broken system and thus make it usable (without the AMU of course). Now, if the "broken firmware" is extremely rare, we could simply ignore this case and ignore the suggestion. Suzuki > > P.S. I'll make all the other changes you've suggested in v3. > > Thank you, > Ionela. > > > > > > diff --git a/Documentation/arm64/booting.rst b/Documentation/arm64/booting.rst > > > index 5d78a6f5b0ae..a3f1a47b6f1c 100644 > > > --- a/Documentation/arm64/booting.rst > > > +++ b/Documentation/arm64/booting.rst > > > @@ -248,6 +248,20 @@ Before jumping into the kernel, the following conditions must be met: > > > - HCR_EL2.APK (bit 40) must be initialised to 0b1 > > > - HCR_EL2.API (bit 41) must be initialised to 0b1 > > > + For CPUs with Activity Monitors Unit v1 (AMUv1) extension present: > > > + - If EL3 is present: > > > + CPTR_EL3.TAM (bit 30) must be initialised to 0b0 > > > + CPTR_EL2.TAM (bit 30) must be initialised to 0b0 > > > + AMCNTENSET0_EL0 must be initialised to 0b1111 > > > + AMCNTENSET1_EL0 must be initialised to a platform specific value > > > + having 0b1 set for the corresponding bit for each of the auxiliary > > > + counters present. > > > + - If the kernel is entered at EL1: > > > + AMCNTENSET0_EL0 must be initialised to 0b1111 > > > + AMCNTENSET1_EL0 must be initialised to a platform specific value > > > + having 0b1 set for the corresponding bit for each of the auxiliary > > > + counters present. > > > + > > > The requirements described above for CPU mode, caches, MMUs, architected > > > timers, coherency and system registers apply to all CPUs. All CPUs must > > > enter the kernel in the same exception level. > > > diff --git a/Documentation/arm64/cpu-feature-registers.rst b/Documentation/arm64/cpu-feature-registers.rst > > > index b6e44884e3ad..4770ae54032b 100644 > > > --- a/Documentation/arm64/cpu-feature-registers.rst > > > +++ b/Documentation/arm64/cpu-feature-registers.rst > > > @@ -150,6 +150,8 @@ infrastructure: > > > +------------------------------+---------+---------+ > > > | DIT | [51-48] | y | > > > +------------------------------+---------+---------+ > > > + | AMU | [47-44] | n | > > > + +------------------------------+---------+---------+ > > > > As mentioned above, please drop it. > > > > > > Suzuki
next prev parent reply other threads:[~2020-01-30 18:27 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-18 18:26 [PATCH v2 0/6] arm64: ARMv8.4 Activity Monitors support Ionela Voinescu 2019-12-18 18:26 ` [PATCH v2 1/6] arm64: add support for the AMU extension v1 Ionela Voinescu 2020-01-23 17:04 ` Valentin Schneider 2020-01-23 18:32 ` Ionela Voinescu 2020-01-24 12:00 ` Valentin Schneider 2020-01-28 11:00 ` Ionela Voinescu 2020-01-28 16:34 ` Suzuki Kuruppassery Poulose 2020-01-29 16:42 ` Ionela Voinescu 2019-12-18 18:26 ` [PATCH v2 2/6] arm64: trap to EL1 accesses to AMU counters from EL0 Ionela Voinescu 2020-01-23 17:04 ` Valentin Schneider 2020-01-23 17:34 ` Ionela Voinescu 2019-12-18 18:26 ` [PATCH v2 3/6] arm64/kvm: disable access to AMU registers from kvm guests Ionela Voinescu 2020-01-27 15:33 ` Valentin Schneider 2020-01-28 15:48 ` Ionela Voinescu 2020-01-28 17:26 ` Suzuki Kuruppassery Poulose 2020-01-28 17:37 ` Valentin Schneider 2020-01-28 17:52 ` Ionela Voinescu 2019-12-18 18:26 ` [PATCH v2 4/6] Documentation: arm64: document support for the AMU extension Ionela Voinescu 2020-01-27 16:47 ` Valentin Schneider 2020-01-28 16:53 ` Ionela Voinescu 2020-01-28 18:36 ` Valentin Schneider 2020-01-30 15:04 ` Suzuki Kuruppassery Poulose 2020-01-30 16:45 ` Ionela Voinescu 2020-01-30 18:26 ` Suzuki K Poulose [this message] 2020-01-31 9:54 ` Ionela Voinescu 2019-12-18 18:26 ` [PATCH v2 5/6] TEMP: sched: add interface for counter-based frequency invariance Ionela Voinescu 2020-01-29 19:37 ` Peter Zijlstra 2020-01-30 15:33 ` Ionela Voinescu 2019-12-18 18:26 ` [PATCH v2 6/6] arm64: use activity monitors for " Ionela Voinescu 2020-01-23 11:49 ` Lukasz Luba 2020-01-23 17:07 ` Ionela Voinescu 2020-01-24 1:19 ` Lukasz Luba 2020-01-24 13:12 ` Ionela Voinescu 2020-01-24 15:17 ` Lukasz Luba 2020-01-28 17:36 ` Ionela Voinescu 2020-01-29 17:13 ` Valentin Schneider 2020-01-29 17:52 ` Ionela Voinescu 2020-01-29 23:39 ` Valentin Schneider 2020-01-30 15:49 ` Ionela Voinescu 2020-01-30 16:11 ` Valentin Schneider
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=20200130182653.GA123407@ewhatever.cambridge.arm.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH v2 4/6] Documentation: arm64: document support for the AMU extension' \ /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
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).