From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B38F0C433F5 for ; Mon, 29 Nov 2021 22:07:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 23FB46B006C; Mon, 29 Nov 2021 17:07:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EF646B0072; Mon, 29 Nov 2021 17:07:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B8736B0073; Mon, 29 Nov 2021 17:07:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id F2FD16B006C for ; Mon, 29 Nov 2021 17:07:21 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B5AF781472FA for ; Mon, 29 Nov 2021 22:07:11 +0000 (UTC) X-FDA: 78863354220.14.7FFBA90 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf14.hostedemail.com (Postfix) with ESMTP id DC28460019B0 for ; Mon, 29 Nov 2021 22:07:09 +0000 (UTC) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1638223628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VcafwLYNhrJW69eNQHQrd8QPnmKaRMfcifi134FHleo=; b=GOTYhVTNavk2gbi2z4w0aj7RZLTtB51Vn6HS2AkfHQBvSdlXjaw2nTY3Q10BeaOgdaM2fC 60B7Kcz48QZt/jLbaNe31k5qRrQEswosZtHKXKLFaGp3Iyenw+HMgiUtAi7GxVYYpbf2It gQyAfDGs6MYCFy+wXxOe7VWRJb+lEj9f42gkbPaBz/KSOIG9tk5n/2CsAnI4ioHasSBUJk 3QW8U7aNPxFhkBt0xP/EoiqixiI+VbuqF9MD7sP4R5UwsPAoFUGwF7f6slYeXS8CJJR/4p Mxmkx9Y5GMcoOe/KSRVJDunNM4TXf3CYGclZsgpN0Nk0LdGMT1hFp8DFe6fJMA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1638223628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VcafwLYNhrJW69eNQHQrd8QPnmKaRMfcifi134FHleo=; b=J8KSx28OF9ucEAH1adFsORwKLCXgLyojfURVqr79bv+Z9NC7wkp6asUN0QEJkygkzykBj2 U8Mom8g3SxKVnzDA== To: Peter Zijlstra Cc: Peter Oskolkov , Ingo Molnar , Andrew Morton , Dave Hansen , Andy Lutomirski , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Paul Turner , Ben Segall , Peter Oskolkov , Andrei Vagin , Jann Horn , Thierry Delisle Subject: Re: [PATCH v0.9.1 3/6] sched/umcg: implement UMCG syscalls In-Reply-To: References: <20211122211327.5931-1-posk@google.com> <20211122211327.5931-4-posk@google.com> <20211124211927.GG721624@worktop.programming.kicks-ass.net> <877dcuhbbe.ffs@tglx> Date: Mon, 29 Nov 2021 23:07:07 +0100 Message-ID: <87r1ayd3as.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Stat-Signature: hgwu14urs5fa6i1ap3znxj5okfruiu9n X-Rspamd-Queue-Id: DC28460019B0 X-Rspamd-Server: rspam07 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=GOTYhVTN; dkim=pass header.d=linutronix.de header.s=2020e header.b=J8KSx28O; spf=pass (imf14.hostedemail.com: domain of tglx@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=tglx@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de X-HE-Tag: 1638223629-52103 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Nov 26 2021 at 22:52, Peter Zijlstra wrote: > On Fri, Nov 26, 2021 at 10:11:17PM +0100, Thomas Gleixner wrote: >> On Wed, Nov 24 2021 at 22:19, Peter Zijlstra wrote: >> > On Mon, Nov 22, 2021 at 01:13:24PM -0800, Peter Oskolkov wrote: >> > >> >> + * Timestamp: a 46-bit CLOCK_MONOTONIC timestamp, at 16ns resolution. >> > >> >> +static int umcg_update_state(u64 __user *state_ts, u64 *expected, u64 desired, >> >> + bool may_fault) >> >> +{ >> >> + u64 curr_ts = (*expected) >> (64 - UMCG_STATE_TIMESTAMP_BITS); >> >> + u64 next_ts = ktime_get_ns() >> UMCG_STATE_TIMESTAMP_GRANULARITY; >> > >> > I'm still very hesitant to use ktime (fear the HPET); but I suppose it >> > makes sense to use a time base that's accessible to userspace. Was >> > MONOTONIC_RAW considered? >> >> MONOTONIC_RAW is not really useful as you can't sleep on it and it won't >> solve the HPET crap either. > > But it's ns are of equal size to sched_clock(), if both share TSC IIRC. > Whereas MONOTONIC, being subject to ntp rate stuff, has differently > sized ns. The size is the same, i.e. 1 bit per nanosecond :) > The only time that's relevant though is when you're going to mix these > timestamps with CLOCK_THREAD_CPUTIME_ID, which might just be > interesting. Uuurg. If you want to go towards CLOCK_THREAD_CPUTIME_ID, that's going to be really nasty. Actually you can sleep on that clock, but that's a completely different universe. If anything like that is desired then we need to rewrite that posix CPU timer muck completely with all the bells and whistels and race conditions attached to it. *Shudder* Thanks, tglx