From: Thomas Gleixner <tglx@linutronix.de>
To: Huw Davies <huw@codeweavers.com>
Cc: linux kernel <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@kernel.org>,
Vincenzo Frascino <vincenzo.frascino@arm.com>
Subject: Re: [PATCH 2/3] x86/vdso: Allow clock specific mult and shift values
Date: Sun, 14 Apr 2019 12:53:32 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1904141229380.4917@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20190411101205.10006-3-huw@codeweavers.com>
On Thu, 11 Apr 2019, Huw Davies wrote:
CC+: Vincenzo Frascino who is working on the generic VDSO.
> This will allow clocks with different mult and shift values,
> e.g. CLOCK_MONOTONIC_RAW, to be supported in the vDSO.
>
> The coarse clocks do not require these data so the values are not
> copied for these clocks.
>
> One could add potential new values of mult and shift alongside the
> existing values in struct vsyscall_gtod_data, but it seems more
> natural to group them with the actual clock data in the basetime array
> at the expense of a few more cycles in update_vsyscall().
The few cycles are one thing. Did you verify that this does not change the
cache layout for CLOCK_MONOTONIC and CLOCK_REALTIME? Let's look:
> struct vgtod_ts {
> u64 sec;
> u64 nsec;
> + u32 mult;
> + u32 shift;
> };
>
> #define VGTOD_BASES (CLOCK_TAI + 1)
> @@ -40,8 +42,6 @@ struct vsyscall_gtod_data {
>
> int vclock_mode;
> u64 cycle_last;
> - u32 mult;
> - u32 shift;
>
> struct vgtod_ts basetime[VGTOD_BASES];
The current state is:
struct vsyscall_gtod_data {
unsigned int seq; /* 0 4 */
int vclock_mode; /* 4 4 */
u64 cycle_last; /* 8 8 */
u64 mask; /* 16 8 */
u32 mult; /* 24 4 */
u32 shift; /* 28 4 */
struct vgtod_ts basetime[12]; /* 32 192 */
basetime[CLOCK_REALTIME] 32 .. 47
basetime[CLOCK_MONOTONIC] 48 .. 63
So with your change it looks like this:
struct vsyscall_gtod_data {
unsigned int seq; /* 0 4 */
int vclock_mode; /* 4 4 */
u64 cycle_last; /* 8 8 */
struct vgtod_ts basetime[12]; /* 16 288 */
which makes
basetime[CLOCK_REALTIME] 16 .. 39
basetime[CLOCK_MONOTONIC] 40 .. 63
So it stays in the same cache line, but as we move the VDSO to generic
code, the mask field needs to stay and this will make basetime[CLOCK_MONOTONIC]
overlap into the next cache line.
See https://lkml.kernel.org/r/alpine.DEB.2.21.1902231727060.1666@nanos.tec.linutronix.de
for an alternate solution to this problem, which avoids this and just gives
CLOCK_MONOTONIC_RAW a separate storage space alltogether.
Thanks,
tglx
next prev parent reply other threads:[~2019-04-14 10:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-11 10:12 [PATCH 0/3] x86/vdso: Add support for CLOCK_MONOTONIC_RAW in the vDSO Huw Davies
2019-04-11 10:12 ` [PATCH 1/3] x86/vdso: Remove unused 'mask' member Huw Davies
2019-04-14 10:36 ` Thomas Gleixner
2019-04-11 10:12 ` [PATCH 2/3] x86/vdso: Allow clock specific mult and shift values Huw Davies
2019-04-14 10:53 ` Thomas Gleixner [this message]
2019-04-15 9:30 ` Huw Davies
2019-04-15 9:51 ` Thomas Gleixner
2019-04-15 10:15 ` Vincenzo Frascino
2019-04-15 12:14 ` Huw Davies
2019-05-30 14:21 ` Vincenzo Frascino
2019-04-11 10:12 ` [PATCH 3/3] x86/vdso: Add support for CLOCK_MONOTONIC_RAW in the vDSO Huw Davies
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=alpine.DEB.2.21.1904141229380.4917@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=huw@codeweavers.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.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).