linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: catalin.marinas@arm.com, will.deacon@arm.com,
	Andrew Morton <akpm@linux-foundation.org>,
	rppt@linux.vnet.ibm.com, Michal Hocko <mhocko@suse.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	andrew.murray@arm.com, james.morse@arm.com, sboyd@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 1/1] arm64: Early boot time stamps
Date: Tue, 20 Nov 2018 14:55:23 +0000	[thread overview]
Message-ID: <01ae5979-9bcd-dd59-adda-efbf69f388ca@arm.com> (raw)
In-Reply-To: <CA+CK2bAKcdZRRMwhcQ0QnBJ3_6bg=zhaeM7v74f+QFwkw9h17A@mail.gmail.com>

On 20/11/2018 14:40, Pavel Tatashin wrote:
>>> +static __init void sched_clock_early_init(void)
>>> +{
>>> +     u64 freq = arch_timer_get_cntfrq();
>>> +     u64 (*read_time)(void) = arch_counter_get_cntvct;
>>
>> We already have arch_timer_read_counter which is exposed from
>> arm_arch_timer.h.
> 
> OK
> 
>>
>>> +
>>> +     /* Early clock is available only on platforms with known freqs */
>>
>> This comment is misleading. It should read something like:
>>
>>         /*
>>          * 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.
>>          */
>>
> 
> OK
> 
>>> +     if (!freq)
>>> +             return;
>>> +
>>> +     sched_clock_register(read_time, BITS_PER_LONG, freq);
>>
>> This doesn't seem right. The counter has an architected minimum of 56
>> bits, and you can't assume that it is going to be more than that.
> 
> Yeah, I saw 56 is used in arm_arch_timer.c, but I could not find where
> this minimum is defined in aarch64 specs. I will change it to 56.

See D10.1.2 (The system counter) in the ARM ARM[1], which says:

<quote>
The Generic Timer provides a system counter with the following
specification:
Width	At least 56 bits wide.
	The value returned by any 64-bit read of the counter is
	zero-extended to 64 bits.
</quote>

This is not AArch64-specific though, and 32bit systems implementing the
generic timers have the exact same requirements.

> I will send v2 soon.

Please wait a bit and give others a chance to review this too.

Thanks,

	M.

[1] https://static.docs.arm.com/ddi0487/da/DDI0487D_a_armv8_arm.pdf
-- 
Jazz is not dead. It just smells funny...

  parent reply	other threads:[~2018-11-20 14:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19 21:44 [PATCH v1 0/1] Early boot time stamps for arm64 Pavel Tatashin
2018-11-19 21:44 ` [PATCH v1 1/1] arm64: Early boot time stamps Pavel Tatashin
2018-11-20 11:29   ` Marc Zyngier
2018-11-20 14:40     ` Pavel Tatashin
2018-11-20 14:53       ` Andrew Murray
2018-11-20 14:55       ` Marc Zyngier [this message]
2018-11-20 15:03         ` 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=01ae5979-9bcd-dd59-adda-efbf69f388ca@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;
as well as URLs for NNTP newsgroup(s).