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 87324C433EF for ; Fri, 26 Nov 2021 21:52:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEA316B0075; Fri, 26 Nov 2021 16:52:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C98006B0078; Fri, 26 Nov 2021 16:52:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B13E66B007B; Fri, 26 Nov 2021 16:52:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id 9F6AF6B0075 for ; Fri, 26 Nov 2021 16:52:36 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5043282CDEBF for ; Fri, 26 Nov 2021 21:52:26 +0000 (UTC) X-FDA: 78852430692.26.DB00A81 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf05.hostedemail.com (Postfix) with ESMTP id A2A16508BB88 for ; Fri, 26 Nov 2021 21:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=go92kDNk8htS9RciSYEL5olMCBjzci3dlAvsk/icQJ8=; b=mZp5Z8vaGZJK8cG0vOg3h2MB3A 6HAWjKLwhiRVFzFswrhpyL3h1pBw19hVrCf8CftPE5f7YhZ+URYPboMAlTyg4EuJ9OdI1N9D+Y2l/ KeOoXkvEwW8ultlrRPuA6TvNSKCftl/GZ/5QgNK63dDgLHQITYNcwDUqV2/v8b9v0e06FpLKIz1DN oAXE+/+BNDitd+raU5VeXBVzmLS8LgyPjEihPmndfuojQf7rtu5cjKWPOwhKBMI2PIhIygxuK3+A+ wHPXJnCYKrKViMJ6tmin8nXapVnXicQXMFHn8ZTMQgtN7MUhEMQtSgS+aYF0Y1ArFAsYMhR1N9E3L 4j2AnYtw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqj8h-00CITn-2X; Fri, 26 Nov 2021 21:52:16 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A8E873000DD; Fri, 26 Nov 2021 22:52:13 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8BBD82DC6C83F; Fri, 26 Nov 2021 22:52:13 +0100 (CET) Date: Fri, 26 Nov 2021 22:52:13 +0100 From: Peter Zijlstra To: Thomas Gleixner 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 Message-ID: References: <20211122211327.5931-1-posk@google.com> <20211122211327.5931-4-posk@google.com> <20211124211927.GG721624@worktop.programming.kicks-ass.net> <877dcuhbbe.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877dcuhbbe.ffs@tglx> X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A2A16508BB88 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=mZp5Z8va; dmarc=none; spf=none (imf05.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org X-Stat-Signature: mt4dxa48ci78frnzmbbsgz9haz3ckjio X-HE-Tag: 1637963537-570189 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 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 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. But yeah, not being able to sleep on it ruins the party.