From: Thomas Gleixner <tglx@linutronix.de>
To: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: linux-kernel@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
luto@kernel.org, vincenzo.frascino@arm.com,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [RFC PATCH] powerpc/32: Switch VDSO to C implementation.
Date: Thu, 09 Jan 2020 15:05:44 +0100 [thread overview]
Message-ID: <87d0bslo7b.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <207cef10-3da8-6a52-139c-0620b21b64af@c-s.fr>
Christophe!
Christophe Leroy <christophe.leroy@c-s.fr> writes:
> In do_hres(), I see:
>
> cycles = __arch_get_hw_counter(vd->clock_mode);
> ns = vdso_ts->nsec;
> last = vd->cycle_last;
> if (unlikely((s64)cycles < 0))
> return -1;
>
> __arch_get_hw_counter() returns a u64 values. On the PPC, this is read
> from the timebase which is a 64 bits counter.
>
> Why returning -1 if (s64)cycles < 0 ? Does it means we have to mask out
> the most significant bit when reading the HW counter ?
Only if you expect the HW counter to reach a value which has bit 63
set. That'd require:
uptime counter frequency
~292 years 1GHz
~ 58 years 5GHz
assumed that the HW counter starts at 0 when the box is powered on.
The reason why this is implemented in this way is that
__arch_get_hw_counter() needs a way to express that the clocksource of
the moment is not suitable for VDSO so that the syscall fallback gets
invoked.
Sure we could have used a pointer for the value and a return value
indicating the validity, but given the required uptime the resulting
code overhead seemed to be not worth it. At least not for me as I'm not
planning to be around 58 years from now :)
Thanks,
tglx
next prev parent reply other threads:[~2020-01-09 14:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 12:53 [RFC PATCH] powerpc/32: Switch VDSO to C implementation Christophe Leroy
2019-10-21 21:29 ` Thomas Gleixner
2019-10-22 9:01 ` Christophe Leroy
2019-10-22 13:56 ` Christophe Leroy
2019-10-26 13:55 ` Andy Lutomirski
2019-10-26 15:54 ` Christophe Leroy
2019-10-26 15:53 ` Thomas Gleixner
2019-10-26 16:06 ` Christophe Leroy
2019-10-26 18:48 ` Thomas Gleixner
2019-10-26 23:06 ` Segher Boessenkool
2019-10-27 9:21 ` Christophe Leroy
2019-10-27 19:07 ` Segher Boessenkool
2019-12-20 18:24 ` Christophe Leroy
2020-01-09 14:05 ` Thomas Gleixner [this message]
2020-01-09 15:21 ` Christophe Leroy
2020-01-10 22:42 ` Thomas Gleixner
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=87d0bslo7b.fsf@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=luto@kernel.org \
--cc=paulus@samba.org \
--cc=vincenzo.frascino@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).