Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp521296imm; Mon, 1 Oct 2018 13:53:32 -0700 (PDT) X-Google-Smtp-Source: ACcGV637synD57RS4f6fb1EKCaY9GMeIM0tmKZlvfbMz+UppF1Cqa9I6uF897RjFKWzZ+0QTvWsH X-Received: by 2002:a63:9712:: with SMTP id n18-v6mr11716305pge.69.1538427211972; Mon, 01 Oct 2018 13:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538427211; cv=none; d=google.com; s=arc-20160816; b=WCwSBov8gvVppl36eUy4FdCY6khdt6bFvfiphV1x+t53ofwkE9lRRoTbevWue76f7V T2SM6VBJzthmWSWvTsp+gfKp1HzS90i/C4vE/Z+ZpVd48YSCMnJ40D2aIGUS1vwmicFh SuESSY3tn4RJJEXiQVMLRb+gesRE6Ypg+ioAkCkQUWUE1WhkFKpqGixd4zloB7YEO8Gr MDDPo30ybKRKOxMNFklBd0Y3ajV4mvOSNfva0F343kx7YiYwKSIwf50C3G4ACzw37P1y bNImoqSc8XqgQBLANxzo5fWhoKpbojLmcz6YOcKJR6lDW4kbkxH9mPl9PFBHO15F6pk7 /QtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=1/uGZS4YF78Ac48mO2JvM1evD2kYx7ReQr0abHmspHI=; b=Gb+yXvhLbPBxonriT4LSNZaF+vW4i3/eSJFDdAcwoK9DnzPu6EUfSdgeamOYPz74wh 1gzy7y39YNva2KbW/pzvGM5AcOZfjOG5gVX4KVdYglZ15QMyKy4KJYtZX7giEhQhKdIc dK0TkzmIL77XykUmfHRBV567k0tTAa/rl3Oqu5Ql+v6ZW9hSYKxwLIMbGcdqjnZdet6y Je3onLzRjfNGvaHdZfWzbVAW4bbWsSh9GcK+kT6i5+2JnQtp18SwnraGJ3RTPY9gnNUw yseOuv9ymzOXDb8n5g8+Ss3Npna6MQmvL5hWsBTm8nj5gsP1F2M/yYvH4ErqH8+e6Ans coxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=MUlhMBma; 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 j20-v6si3487479pgh.535.2018.10.01.13.53.16; Mon, 01 Oct 2018 13:53:31 -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=MUlhMBma; 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 S1726391AbeJBDc0 (ORCPT + 99 others); Mon, 1 Oct 2018 23:32:26 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:40043 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726149AbeJBDc0 (ORCPT ); Mon, 1 Oct 2018 23:32:26 -0400 Received: by mail-pg1-f193.google.com with SMTP id n31-v6so10292828pgm.7 for ; Mon, 01 Oct 2018 13:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=1/uGZS4YF78Ac48mO2JvM1evD2kYx7ReQr0abHmspHI=; b=MUlhMBmaGDtVYyV19TVP2R7o6e281hJIrgSdX28oqC4bXYm6FzFmgUqzMeRbD6fJp2 A38v8Hb7NUSBQQNPoDmCAMVtKiQ7LoSXcaiV9TxyUyKm6taHhRv7IDfPsFUj0COePVVy /60srjmcOTq9poZR6PnjnZLnL2w9ackTy/TlTc96s8fhmyYsatfkW9nF4DB8SB7QEmEi fCHkWFEAR1+n9RaicS2ggLTpU6AmpMfzwYy+eIn5DxhHiBtWis4lRIGWaWJEgMoHAKRu eWg4QaVYi9pB5rqFjs9txGXz6TVq0FW4IlZ2/HToN0sPT7HQN+8VKiZBt9qq1t3xI6Wl Y9zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=1/uGZS4YF78Ac48mO2JvM1evD2kYx7ReQr0abHmspHI=; b=OQ0e5Df/DSTmxJjlU1MXssXSnLFpqPR6W8oO8y4iAdgJh3fuspo6Pr67jSca4RKbM8 J+BV2OB0flgDaftqqCF60tjnOBrpGby0ZedF9stTPvrwJnNAyQwfTSMlt1sHHhFcoMfC uqj9gM2QCzHPyoH6Gzrd8o6r0iFJ3Ag+k1L/Qj7HO8gPBb7sr9B7KovU58wpHYMHqWYH 4GAwvooGoHGfH6uHmzdO760Nb5NlJmLfTSIiT7ZaztT8ycuYqHAr7T2Icrtxss4A1pkN XEi4nxGT6fs4OxD530vEzJcFi/WSP/uwgC6xH+BpxR/5lKFRjsUKA/pM0NgF6Af0ywdZ on4g== X-Gm-Message-State: ABuFfoi/MZnpNIM+EDg78E8OwdWVbfNJ2rTiX6lHwI2WNXsc1aAROEHz N+gMkXeQQkJlC0GYbezFjoA843PWM6Y= X-Received: by 2002:a63:db44:: with SMTP id x4-v6mr11778928pgi.285.1538427168107; Mon, 01 Oct 2018 13:52:48 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1612:b4fb:6752:f21f:3502]) by smtp.googlemail.com with ESMTPSA id z3-v6sm18184120pfm.150.2018.10.01.13.52.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Oct 2018 13:52:47 -0700 (PDT) Subject: Re: RESEND [PATCH v6 11/12] lib: vdso: Add support for CLOCK_BOOTTIME To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, 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 , linux-arm-kernel@lists.infradead.org, Jeremy Linton , android-kernel@android.com, Jinbum Park , Ingo Molnar , "Paul E. McKenney" References: <20181001175845.168430-1-salyzyn@android.com> <20181001175845.168430-12-salyzyn@android.com> From: Mark Salyzyn Message-ID: Date: Mon, 1 Oct 2018 13:52:32 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/01/2018 11:15 AM, Thomas Gleixner wrote: > On Mon, 1 Oct 2018, Mark Salyzyn wrote: >> >> +static notrace int do_boottime(const struct vdso_data *vd, struct timespec *ts) >> +{ >> + u32 seq, mult, shift; >> + u64 nsec, cycle_last; >> + vdso_wtm_clock_nsec_t wtm_nsec; >> + >> + /* open coding timespec_add_ns to save a ts->tv_nsec = 0 */ >> + ts->tv_sec = sec + __iter_div_u64_rem(nsec, NSEC_PER_SEC, &nsec); >> + ts->tv_nsec = nsec; >> + >> + return 0; >> +} >> + > Instead of adding yet another copy of the same code you might want to look > at the rework I did for the x86 vdso in order to support CLOCK_TAI w/o > running into the issue of the clock switch case being compiled into a jump > table and then the compile asking for retpoline. > > http://lkml.kernel.org/r/20180917124533.329334911@linutronix.de > > Thanks, > > tglx Great idea. Thanks! The point of the first 12 patches is to _align_ the arm code to match the assembler for arm64 exactly 1:1. Then switch arm64 assembler to use the _same_ code in 'C' as a library. No performance degradation. Next extend the vdso framework on arm64 to _also_ use that library for vDSO32 (arm32 compat on 64-bit). At this point we achieve a 0.4% power reduction on Android. At that point, we would be ready for a rework that fixes all three (ARM vDSO, ARM64 vDSO and ARM64 vDSO32) to get the compiler to handle the switch statement better. One step at a time. -- Mark