Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1211757yba; Sun, 14 Apr 2019 03:54:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2sZ/RvB2Xyt+R6PZxJu/H/WueLQs8EARvVwEkRvGZ70bkKMOv/F08tuc10jeTmAAYO923 X-Received: by 2002:a63:2b03:: with SMTP id r3mr63311038pgr.105.1555239265461; Sun, 14 Apr 2019 03:54:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555239265; cv=none; d=google.com; s=arc-20160816; b=Vxk1qC7zzAXRxyUGGZHs3FcR+AxH0Wp7d3iMSQu9Z8MDLL/vQ3GqPPg30BFGMHiO/G Suz8RDYN23tbwfQlPXhwYwjrVAPTTVHYhrqv/nHSdkq01X1neJDllPaW8pyICN4bzeh8 5SZXrjpCbRNIkXidWocYvdDb07lQyRfgLgCRzy64FAylFeAZcZDgffTqd41hcBT35kuG p0nhT4ZQNwgqtmVuwuHWbzcmI47dB1FhOZOnVwf9Hyi97k3xCKRaNb6AgHfn1AmH3/1b GiK1TQF0wveCteZZO/RWGXFFB0Qmx45NinuIDeALTceeSJ6UXkx0fATHJR8aM8ISYGvr cABA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=SoiMOYyv5nuJk4UAnOBJUnQnK0lPBTiUKRsqTgxSLpI=; b=PR11fk5zrKNxlOamhDNZCmzaeeuLo9Dm2ZNvLRLZbitkAAqorTBh5J/Kys6mb2cme/ bLO0rOlJJ6mbJyQgngLBLGep3r6eMDRPRVk8djlFKMYIVHolWVGP70Qh2zENClxGbLC9 uIoRNvr6YiD8uQCTrWahd82+Z1/H5lBBr3O9yg+1Obb0D51V65wV5MbKMuanKQipXbbX iDh0righrtZZ3xRK9F+zVwE6gvTQdzbQIvy6m63F5p0nUMIjFb9UFvpsQjsiS/HTyr0a KruWYkRzTI6HFgeWdPzRd/oMOVR0fnTXLOuJZrDJeArIuaSOrnpca/PmlG0y277HjICF k0ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si33656731plt.119.2019.04.14.03.54.08; Sun, 14 Apr 2019 03:54:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726331AbfDNKxh (ORCPT + 99 others); Sun, 14 Apr 2019 06:53:37 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:42576 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbfDNKxg (ORCPT ); Sun, 14 Apr 2019 06:53:36 -0400 Received: from pd9ef12d2.dip0.t-ipconnect.de ([217.239.18.210] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hFclR-0001QF-Ig; Sun, 14 Apr 2019 12:53:33 +0200 Date: Sun, 14 Apr 2019 12:53:32 +0200 (CEST) From: Thomas Gleixner To: Huw Davies cc: linux kernel , Andy Lutomirski , Vincenzo Frascino Subject: Re: [PATCH 2/3] x86/vdso: Allow clock specific mult and shift values In-Reply-To: <20190411101205.10006-3-huw@codeweavers.com> Message-ID: References: <20190411101205.10006-1-huw@codeweavers.com> <20190411101205.10006-3-huw@codeweavers.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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