Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp359004imm; Mon, 1 Oct 2018 11:02:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV61pE+h6Kb5TMuSFqiFeZ+7qN0qLQEwmqcLFSLZeYP2lYwkY0v8XPdbgWiq8oXQyLEBRX3I+ X-Received: by 2002:a62:c288:: with SMTP id w8-v6mr12561034pfk.92.1538416970854; Mon, 01 Oct 2018 11:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538416970; cv=none; d=google.com; s=arc-20160816; b=Z7fCzH8HgI4DNEstXLcVdvHJKFT1xVNp4mNzUA+f+8A60KwJnoM6BwOaVh2e14WPmx 46zU5jeHrGCcldt24xVK6jS9T+jZQW9HDYiH6sOmdnHHTdWK12ml4OQM8xYoSvja+yKJ 32dfASzj6VZIjRiB2fTkno0/PBKOBruUeSgMRZuC83pWSRTLuobD469JsvP691ZN2GwP epWRmLiLHSOU51z7nppOnU8u/sq4RGKfxa09OzJCtmlfYHUWFbvMfN5LBm7LvAKzX2JY ESe5wPslvpRUOJ9vnHVZi3zpFpkXxa0MhZ53R0vnfGyikAI1a2xfC20OQIeKSMezO0/H 2hxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7vaA2MA8EQ1d2Vcn1d4fxUkppIy3o0RYXj7Io3jPUYw=; b=WPMzws+TMTEV5joCF9fcClGor7MgxMUFVddUjRwaDM1D0rkzWvl9bykPI217oynokR fbEqfqdi7klaohqniGzfw6EyHQU12JU5fI5yYR1V2a3RRWyRV7KamV8xrPX9nOF9bXlS /kEYw7xc4Hk+AKYlgOgBhftrh1hRElBhgtG+Z+NLy8gA3zPXRrEhcwFxDpIXynrftxnc U5dkkxWUTdge6BlLSp9mhw2lVztDrlE72hs5oHEKQEZbBl16tKgUzrFCvwD5HthkpqOb Jio6yEH2Vt7eChB6VX7k3DQFqKv1SbBOOTobfvNclIRGtQiGzSmxA23r5itT3/Zc7yqy /R3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=JAPp+6tP; 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=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y9-v6si12885398pfn.128.2018.10.01.11.02.34; Mon, 01 Oct 2018 11:02:50 -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=@android.com header.s=20161025 header.b=JAPp+6tP; 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=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726715AbeJBAkW (ORCPT + 99 others); Mon, 1 Oct 2018 20:40:22 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43836 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbeJBAkV (ORCPT ); Mon, 1 Oct 2018 20:40:21 -0400 Received: by mail-pg1-f196.google.com with SMTP id 80-v6so2059026pgh.10 for ; Mon, 01 Oct 2018 11:01:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7vaA2MA8EQ1d2Vcn1d4fxUkppIy3o0RYXj7Io3jPUYw=; b=JAPp+6tPtdnSk7VyFz78LpsVxKwjQs9mSL/bf7A1eDSRYG9otVaO8+16CaBlLtVAmk jD2XB1DmYUtPLZUQXkYaM3yxpYNsPEWCsrcJyrgR7xCNvQvh6wn5deCjABE/AHxf6RT1 7T/r71+oSqsR2ras5m0zdH13SQdnNoFpzofZDw3CZeSlxZn20EUMYNQ404oOJ6EU8/UY OQlD7ymz2/7aJMwyE8S/KYRF+MQdmhH+JQLCiCQMYeP0xc5/zuu/pj8lhi2CGOy6QOtz r7IAJLe/wLelhr9jjZAGzn6/dSu57EGoHDbUkZDMVeBRFSu4eNcWm3xnkv1Gotmqpp+F hG4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7vaA2MA8EQ1d2Vcn1d4fxUkppIy3o0RYXj7Io3jPUYw=; b=BQpjX34ur6oGZJd9eChKn5IAtBXE3rEqwGvjgquUXl2zQO3fTG4FDr3OXxQ4Lgf9yA Bu1b/0ntWxqciWqBQa5yOhnVa0S4Yj9hW9bMYr7mM6m5myWNA89oLWaOnNuAeu+pZMmP c30YYi61VYHzclj94jDDUmKzayL5e7rYNpRnX6iIOsfotR5AQGagbe5hsO0/lODukGaE Uu2qjqOo0oxLinc7TPwTsdRuPBCu3C3wJGkq3ItEez122lXgOwXNElweJtJtXN0REpSN eoqF9KtK0G15duYYrMrySxmnrMIqwAPNDDIixFLuyvb3F3o+7XQ6PHsJQ6BvnKNIT+O7 L8Bg== X-Gm-Message-State: ABuFfoi5jCS+1zaSXPW0LhG2WXxFHPBW7Nra701xi/9FJ5tZWslcqnQA YEoUoisUZOXlU1Wyc3SotCNCX3JN188= X-Received: by 2002:a17:902:b598:: with SMTP id a24-v6mr5870438pls.40.1538416883414; Mon, 01 Oct 2018 11:01:23 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1612:b4fb:6752:f21f:3502]) by smtp.gmail.com with ESMTPSA id d186-v6sm24469261pfg.173.2018.10.01.11.01.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Oct 2018 11:01:22 -0700 (PDT) From: Mark Salyzyn To: linux-kernel@vger.kernel.org Cc: Mark Salyzyn , James Morse , Russell King , Catalin Marinas , Will Deacon , Andy Lutomirski , Dmitry Safonov , John Stultz , Mark Rutland , Laura Abbott , Kees Cook , Ard Biesheuvel , Andy Gross , Kevin Brodsky , Andrew Pinski , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Jeremy Linton , android-kernel@android.com, "Paul E. McKenney" , Ingo Molnar Subject: RESEND [PATCH v5 08/12] arm: vdso: Add ARCH_CLOCK_FIXED_MASK Date: Mon, 1 Oct 2018 10:58:28 -0700 Message-Id: <20181001175845.168430-9-salyzyn@android.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181001175845.168430-1-salyzyn@android.com> References: <20181001175845.168430-1-salyzyn@android.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Take an effort to recode the arm64 vdso code from assembler to C previously submitted by Andrew Pinski , rework it for use in both arm and arm64, overlapping any optimizations for each architecture. But instead of landing it in arm64, land the result into lib/vdso and unify both implementations to simplify future maintenance. Add ARCH_CLOCK_FIXED_MASK as an efficiency since arm64 has no purpose for cs_mask vdso_data variable. Signed-off-by: Mark Salyzyn Tested-by: Mark Salyzyn Cc: James Morse Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Andy Lutomirski Cc: Dmitry Safonov Cc: John Stultz Cc: Mark Rutland Cc: Laura Abbott Cc: Kees Cook Cc: Ard Biesheuvel Cc: Andy Gross Cc: Kevin Brodsky Cc: Andrew Pinski Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: Jeremy Linton Cc: android-kernel@android.com v4: - New in series, split off from earlier. v5: - rebase --- arch/arm/vdso/vgettimeofday.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm/vdso/vgettimeofday.c b/arch/arm/vdso/vgettimeofday.c index a354586f8a65..3005479efbe8 100644 --- a/arch/arm/vdso/vgettimeofday.c +++ b/arch/arm/vdso/vgettimeofday.c @@ -128,7 +128,11 @@ static notrace int do_realtime(const struct vdso_data *vd, struct timespec *ts) { u32 seq, mult, shift; u64 nsec, cycle_last; +#ifdef ARCH_CLOCK_FIXED_MASK + static const u64 mask = ARCH_CLOCK_FIXED_MASK; +#else u64 mask; +#endif vdso_xtime_clock_sec_t sec; do { @@ -141,7 +145,9 @@ static notrace int do_realtime(const struct vdso_data *vd, struct timespec *ts) mult = vd->cs_mono_mult; shift = vd->cs_shift; +#ifndef ARCH_CLOCK_FIXED_MASK mask = vd->cs_mask; +#endif sec = vd->xtime_clock_sec; nsec = vd->xtime_clock_snsec; @@ -161,7 +167,11 @@ static notrace int do_monotonic(const struct vdso_data *vd, struct timespec *ts) { u32 seq, mult, shift; u64 nsec, cycle_last; +#ifdef ARCH_CLOCK_FIXED_MASK + static const u64 mask = ARCH_CLOCK_FIXED_MASK; +#else u64 mask; +#endif vdso_wtm_clock_nsec_t wtm_nsec; __kernel_time_t sec; @@ -175,7 +185,9 @@ static notrace int do_monotonic(const struct vdso_data *vd, struct timespec *ts) mult = vd->cs_mono_mult; shift = vd->cs_shift; +#ifndef ARCH_CLOCK_FIXED_MASK mask = vd->cs_mask; +#endif sec = vd->xtime_clock_sec; nsec = vd->xtime_clock_snsec; @@ -200,7 +212,11 @@ static notrace int do_monotonic_raw(const struct vdso_data *vd, { u32 seq, mult, shift; u64 nsec, cycle_last; +#ifdef ARCH_CLOCK_FIXED_MASK + static const u64 mask = ARCH_CLOCK_FIXED_MASK; +#else u64 mask; +#endif vdso_raw_time_sec_t sec; do { @@ -213,7 +229,9 @@ static notrace int do_monotonic_raw(const struct vdso_data *vd, mult = vd->cs_raw_mult; shift = vd->cs_shift; +#ifndef ARCH_CLOCK_FIXED_MASK mask = vd->cs_mask; +#endif sec = vd->raw_time_sec; nsec = vd->raw_time_nsec; -- 2.19.0.605.g01d371f741-goog