From: Marc Zyngier <marc.zyngier@arm.com>
To: Pavel Tatashin <pasha.tatashin@soleen.com>,
catalin.marinas@arm.com, will.deacon@arm.com,
akpm@linux-foundation.org, rppt@linux.vnet.ibm.com,
mhocko@suse.com, ard.biesheuvel@linaro.org,
andrew.murray@arm.com, james.morse@arm.com, sboyd@kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/3] arm64: Early boot time stamps
Date: Thu, 3 Jan 2019 10:51:53 +0000 [thread overview]
Message-ID: <9fe670d4-d799-c05f-297e-437eda1d2072@arm.com> (raw)
In-Reply-To: <20181226164509.22916-4-pasha.tatashin@soleen.com>
Hi Pavel,
On 26/12/2018 16:45, Pavel Tatashin wrote:
> Allow printk time stamps/sched_clock() to be available from the early
> boot.
>
> Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
> ---
> arch/arm64/kernel/setup.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index 4b0e1231625c..28126facc4ed 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -40,6 +40,7 @@
> #include <linux/efi.h>
> #include <linux/psci.h>
> #include <linux/sched/task.h>
> +#include <linux/sched_clock.h>
> #include <linux/mm.h>
>
> #include <asm/acpi.h>
> @@ -279,8 +280,32 @@ arch_initcall(reserve_memblock_reserved_regions);
>
> u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
>
> +/*
> + * Get time stamps available early in boot, useful to identify boot time issues
> + * from the early boot.
> + */
> +static __init void sched_clock_early_init(void)
> +{
> + u64 (*read_time)(void) = arch_counter_get_cntvct;
> + u64 freq = arch_timer_get_cntfrq();
> +
> + /*
> + * The arm64 boot protocol mandates that CNTFRQ_EL0 reflects
> + * the timer frequency. To avoid breakage on misconfigured
> + * systems, do not register the early sched_clock if the
> + * programmed value if zero. Other random values will just
> + * result in random output.
> + */
> + if (!freq)
> + return;
> +
> + sched_clock_register(read_time, ARCH_TIMER_NBITS, freq);
> +}
> +
> void __init setup_arch(char **cmdline_p)
> {
> + sched_clock_early_init();
> +
> init_mm.start_code = (unsigned long) _text;
> init_mm.end_code = (unsigned long) _etext;
> init_mm.end_data = (unsigned long) _edata;
>
I still think this approach is flawed. You provide the kernel with a
potentially broken sched_clock that may jump back and forth until the
workaround kicks in. Nobody expects this.
Instead, I'd suggest you allow for a something other than local_clock()
to be used for the time stamping until a properly working sched_clock
gets registered.
This way, you'll only impact the timestamps when running on a broken system.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2019-01-03 10:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-26 16:45 [PATCH v3 0/3] Early boot time stamps for arm64 Pavel Tatashin
2018-12-26 16:45 ` [PATCH v3 1/3] arm_arch_timer: add macro for timer nbits Pavel Tatashin
2018-12-26 16:45 ` [PATCH v3 2/3] arm64: vdso: Use ARCH_TIMER_NBITS to calculate mask Pavel Tatashin
2018-12-26 16:45 ` [PATCH v3 3/3] arm64: Early boot time stamps Pavel Tatashin
2019-01-03 10:51 ` Marc Zyngier [this message]
2019-01-03 19:58 ` Pavel Tatashin
2019-01-04 15:39 ` Marc Zyngier
2019-01-04 16:23 ` Pavel Tatashin
2019-01-04 16:49 ` Marc Zyngier
2019-01-04 20:54 ` Pavel Tatashin
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=9fe670d4-d799-c05f-297e-437eda1d2072@arm.com \
--to=marc.zyngier@arm.com \
--cc=akpm@linux-foundation.org \
--cc=andrew.murray@arm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=pasha.tatashin@soleen.com \
--cc=rppt@linux.vnet.ibm.com \
--cc=sboyd@kernel.org \
--cc=will.deacon@arm.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
all inboxes | Powered by JetHome®