Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1866513ybd; Sun, 23 Jun 2019 18:44:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnqa6eBlnB790fmtBn8Br3LD5VcUwJebpHpEQSX/Ux7O90IcJEJ2meSofIu0RgQxCSAtyf X-Received: by 2002:a63:7e43:: with SMTP id o3mr30764302pgn.450.1561340646693; Sun, 23 Jun 2019 18:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561340646; cv=none; d=google.com; s=arc-20160816; b=WSzLH2uHqh14EtYNKtJ1p+yQ60jRmUo/NmOq1b9Qw2Svoqz3/O5ANjX1/loYn6WSUE tk8zEwJnWv+TGAtlVbE/RrLlE+WPyypglqoKe9UchN8QYpL8Ub3yg83SqvOo44mSSGrA 3mv3k9BGIn1tM2prlvTBLuUiCIEdUlfJyiRFxfoWx/+adiqsmflzfWwAKK9HZMpDvq97 AnWB9eB5BzUshp00K2gtyZJPA69EwHn82xe/sff81SflwoCxb8nSFEBWjiuV/kaGtGMC 8NSDUwYHsnnbzy/RgMVaH6dQ9D0jpXnqtuaRpDDMoFn4J8lz4cFbT8tE/RudoMKP9moP z0kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=JCXMBZ4jwUQ64qsoesWTGpB3WEjAXkb75kfS12UJltI=; b=HZXoiG9z33nUcJjLiU7JK5Bl3ywBasjYDqF3YdYWMGeTOpk4jk1frJulX7aKGfZ/p6 +J9CUON64oo5OAdzkjHgFsAcHHUwIAYm9HSntVixdcISuil2LjH9tpbP/JLbKnhOIU74 4v38X5Os7txmXqv3Yt8QRIaO1TokJSUDL3i95YXit+nb6aUA5VN0BCGakKAt6+1t8aBo plUX63BhQ29IcoMFnWddsqcildI5nKKAINJnBC3PDy8NH4nrkTRPsQML2wl38Y9HLYZZ ZF085qaQZjEW8CITF7RhQugXH7ftCPH7OOztz5wA+TQpra/xrUaCgBKXT4k+9WhbBmis TXBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019061801 header.b=ykk+mrqD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si8927338pgl.192.2019.06.23.18.43.51; Sun, 23 Jun 2019 18:44:06 -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; dkim=pass header.i=@zytor.com header.s=2019061801 header.b=ykk+mrqD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726379AbfFXBkw (ORCPT + 99 others); Sun, 23 Jun 2019 21:40:52 -0400 Received: from terminus.zytor.com ([198.137.202.136]:51211 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbfFXBkv (ORCPT ); Sun, 23 Jun 2019 21:40:51 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x5NNvYO52860613 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 23 Jun 2019 16:57:34 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x5NNvYO52860613 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019061801; t=1561334255; bh=JCXMBZ4jwUQ64qsoesWTGpB3WEjAXkb75kfS12UJltI=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=ykk+mrqD2cJpX9IxNd+wcKHq2YcKd6fGEKyiyPhD+7WG9e1KQzQsQFE30eOIdhk1n 7BZoDQVX0mmJYZY0mhtwoHln2ViZrfVQjqwe6wgQfiA4PnenKlcluIiGIOtMFZ2EPu ZHm0BJLpFSQbjV/3N8k6PaNDBlHrR+bpyDIzDJfU8OBbKrmJw3AyDqgMbp45zJjPUg eM815F7Liz/2LE4vjJ8c1BgHfNabfH9gF8fBmoqzPZLHO61A9XZezHHl85URZR7BL3 Zl5iV00bcAzSdBnOWoM36NdOms9/O5cSllZVndw12cTgxAWQt6i9Khw0gnxcS1rCfw FdrLCxHo+/WNg== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x5NNvYgw2860610; Sun, 23 Jun 2019 16:57:34 -0700 Date: Sun, 23 Jun 2019 16:57:34 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Andy Lutomirski Message-ID: Cc: torvalds@linux-foundation.org, luto@kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org, bp@alien8.de, peterz@infradead.org, hpa@zytor.com, tglx@linutronix.de Reply-To: mingo@kernel.org, bp@alien8.de, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, luto@kernel.org, tglx@linutronix.de, hpa@zytor.com, peterz@infradead.org In-Reply-To: <6920c5188f8658001af1fc56fd35b815706d300c.1561241273.git.luto@kernel.org> References: <6920c5188f8658001af1fc56fd35b815706d300c.1561241273.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/vdso] x86/vdso: Give the [ph]vclock_page declarations real types Git-Commit-ID: ecf9db3d1f1a8fd2c335148891c3b044e9ce0628 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_03_06,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: ecf9db3d1f1a8fd2c335148891c3b044e9ce0628 Gitweb: https://git.kernel.org/tip/ecf9db3d1f1a8fd2c335148891c3b044e9ce0628 Author: Andy Lutomirski AuthorDate: Sat, 22 Jun 2019 15:08:18 -0700 Committer: Thomas Gleixner CommitDate: Mon, 24 Jun 2019 01:21:31 +0200 x86/vdso: Give the [ph]vclock_page declarations real types Clean up the vDSO code a bit by giving pvclock_page and hvclock_page their actual types instead of u8[PAGE_SIZE]. This shouldn't materially affect the generated code. Heavily based on a patch from Linus. [ tglx: Adapted to the unified VDSO code ] Co-developed-by: Linus Torvalds Signed-off-by: Linus Torvalds Signed-off-by: Andy Lutomirski Signed-off-by: Thomas Gleixner Cc: Borislav Petkov Cc: Peter Zijlstra Link: https://lkml.kernel.org/r/6920c5188f8658001af1fc56fd35b815706d300c.1561241273.git.luto@kernel.org --- arch/x86/include/asm/vdso/gettimeofday.h | 36 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/vdso/gettimeofday.h b/arch/x86/include/asm/vdso/gettimeofday.h index f92752d6cbcf..5b63f1f78a1f 100644 --- a/arch/x86/include/asm/vdso/gettimeofday.h +++ b/arch/x86/include/asm/vdso/gettimeofday.h @@ -26,13 +26,33 @@ #define VDSO_HAS_CLOCK_GETRES 1 +/* + * Declare the memory-mapped vclock data pages. These come from hypervisors. + * If we ever reintroduce something like direct access to an MMIO clock like + * the HPET again, it will go here as well. + * + * A load from any of these pages will segfault if the clock in question is + * disabled, so appropriate compiler barriers and checks need to be used + * to prevent stray loads. + * + * These declarations MUST NOT be const. The compiler will assume that + * an extern const variable has genuinely constant contents, and the + * resulting code won't work, since the whole point is that these pages + * change over time, possibly while we're accessing them. + */ + #ifdef CONFIG_PARAVIRT_CLOCK -extern u8 pvclock_page[PAGE_SIZE] +/* + * This is the vCPU 0 pvclock page. We only use pvclock from the vDSO + * if the hypervisor tells us that all vCPUs can get valid data from the + * vCPU 0 page. + */ +extern struct pvclock_vsyscall_time_info pvclock_page __attribute__((visibility("hidden"))); #endif #ifdef CONFIG_HYPERV_TSCPAGE -extern u8 hvclock_page[PAGE_SIZE] +extern struct ms_hyperv_tsc_page hvclock_page __attribute__((visibility("hidden"))); #endif @@ -131,14 +151,9 @@ clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) #endif #ifdef CONFIG_PARAVIRT_CLOCK -static const struct pvclock_vsyscall_time_info *get_pvti0(void) -{ - return (const struct pvclock_vsyscall_time_info *)&pvclock_page; -} - static u64 vread_pvclock(void) { - const struct pvclock_vcpu_time_info *pvti = &get_pvti0()->pvti; + const struct pvclock_vcpu_time_info *pvti = &pvclock_page.pvti; u32 version; u64 ret; @@ -180,10 +195,7 @@ static u64 vread_pvclock(void) #ifdef CONFIG_HYPERV_TSCPAGE static u64 vread_hvclock(void) { - const struct ms_hyperv_tsc_page *tsc_pg = - (const struct ms_hyperv_tsc_page *)&hvclock_page; - - return hv_read_tsc_page(tsc_pg); + return hv_read_tsc_page(&hvclock_page); } #endif