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 X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81503C433DF for ; Tue, 28 Jul 2020 20:57:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DBB520714 for ; Tue, 28 Jul 2020 20:57:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sdPm3Ndt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729193AbgG1U5M (ORCPT ); Tue, 28 Jul 2020 16:57:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728202AbgG1U5K (ORCPT ); Tue, 28 Jul 2020 16:57:10 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8691AC061794; Tue, 28 Jul 2020 13:57:10 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id x12so7481560qtp.1; Tue, 28 Jul 2020 13:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1yMXU7EUKMHdsvH7lxAwoxCrPaR32XiwKJGHLWTSuNU=; b=sdPm3Ndt2+q1V6uWLmFekiouxlxUukz1wDUIfraNAYzs30GhV65xEyvMzHJRBihduI HmxZMZz+s7H6zj3aeCeC2/tE4mQ4TjpREqpEfyzSuA1brjWmHqCxCq2Qm16RQeJAAQJX JhwJP+TgQZ5G1yChTvtIOwGCx+x3rgOwq3v8NtofCCtg80EIA4V/OnncHdy2wCaeOGiY BvQ0wO2xNspwnrmZCcPqHZGVKH/DBKZharqcfop9rNwQ2MuuEAMqpXZWjC3iX6sS9QHI K436UPZhOIbD4lwwIs1F8/LSDc5g3r4B0tnewAEcmoTksanOGy4qGHTlkn0wvlS4W8lI H+EQ== 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-language :content-transfer-encoding; bh=1yMXU7EUKMHdsvH7lxAwoxCrPaR32XiwKJGHLWTSuNU=; b=Nhid3/JsxrtYM8MLHLJR1BfILl4TRXzyUR0J7s+n8y3yu/rpiedrU7nimtvLZXQlzU egCZUXGME8CSlKlMeU08olztQlDkzgEJ1OsjMgCR5KnL+ZXGw3TnwJpcAyISbSvNvyo5 xOZdvbof9+ABESO7bxcYL748Ypl75BEHqmMoYDIUCHjBY4AHpf8tvd4ZEjtKDD1axWdd j7Ffwnxd78nVm2KhdO+gEGpQVu+UGtkm3dqhOOXvzjT278nYwmzs8LaIPgumFzPXQiEu KkOLbYeA16nWZf10hsYerq/tHqO/krek0y3Gz20tjCtEE7DEUxBth0HDGdemFdzFD8dd dE5g== X-Gm-Message-State: AOAM5335CIzR79u1OaXJ1ArKulPntW6q9ucnz/TlmB90CHNoablwVxnY iqQ2P9l+epDpUuR/AWjA4Ys= X-Google-Smtp-Source: ABdhPJxzdv8TPmKbqDuUUlm0LGyjTWA5VeiTvrejO3QJvbuHOL6J/tB0JkWL7zWiuc/Akugi/+cReA== X-Received: by 2002:ac8:a41:: with SMTP id f1mr26896254qti.89.1595969829786; Tue, 28 Jul 2020 13:57:09 -0700 (PDT) Received: from ?IPv6:2601:284:8202:10b0:c842:646d:48fc:f7aa? ([2601:284:8202:10b0:c842:646d:48fc:f7aa]) by smtp.googlemail.com with ESMTPSA id n68sm24641164qkd.89.2020.07.28.13.57.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Jul 2020 13:57:08 -0700 (PDT) Subject: Re: [PATCH] bpf: Add bpf_ktime_get_real_ns To: Andrii Nakryiko , =?UTF-8?Q?Maciej_=c5=bbenczykowski?= Cc: bimmy.pujari@intel.com, bpf , Networking , mchehab@kernel.org, Alexei Starovoitov , Daniel Borkmann , Martin Lau , ashkan.nikravesh@intel.com References: <20200727233431.4103-1-bimmy.pujari@intel.com> From: David Ahern Message-ID: <9e9ca486-f6f5-2301-8850-8f53429b160e@gmail.com> Date: Tue, 28 Jul 2020 14:57:07 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 7/28/20 12:28 PM, Andrii Nakryiko wrote: > In some, yes, which also means that in some other they can't. So I'm > still worried about misuses of REALCLOCK, within (internal daemons > within the company) our outside (BCC tools and alike) of data centers. > Especially if people will start using it to measure elapsed time > between events. I'd rather not have to explain over and over again > that REALCLOCK is not for measuring passage of time. Why is documenting the type of clock and its limitations not sufficient? Users are going to make mistakes and use of gettimeofday to measure time differences is a common one for userspace code. That should not define or limit the ability to correctly and most directly do something in bpf. I have a patch to export local_clock as bpf_ktime_get_fast_ns. It too can be abused given that it has limitations (can not be used across CPUs and does not correlate to any exported clock), but it too has important use cases (twice as fast as bpf_ktime_get_ns and useful for per-cpu delta-time needs). Users have to know what they are doing; making mistakes is part of learning. Proper documentation is all you can do.