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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 604F4C433EF for ; Wed, 20 Apr 2022 12:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376871AbiDTMzx (ORCPT ); Wed, 20 Apr 2022 08:55:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233931AbiDTMzx (ORCPT ); Wed, 20 Apr 2022 08:55:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F20833E1A; Wed, 20 Apr 2022 05:53:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 224DBB81EEB; Wed, 20 Apr 2022 12:53:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90E3CC385A1; Wed, 20 Apr 2022 12:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650459184; bh=QIM/aydJjFoGCSHbzCqxueIZW063tAPoMj10MjY/4a8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=apVzFx6m4Zqgr4EyJ/a/snLw9kTCfUU1QJr7O0rTXk8GxR/FErdnnmx+LIfAkJKJO 6N0gxtE0xKMXQYLiCeJLwu9b2GXJ6HWFSjjin7YPwscYxdU7Trp+NiZgx+IODFmrIh ZT1LbMCMohtADTBOgxSc7RyDZL6bBWa4JyR2O3Kfw0FB5BZF9q96ycrDW12cK8WUAZ fd9nkW0NiBFpyk665Hc1e1uMKbYdWH0c0bUkFMvIl1x/se6IGtr+LsSPjH/9jnt4f9 ZeeWeluuqyRZ0weAqiRgyqKlR3PAsXBDrWUVkyIN5JhKwP6EKFB4URHClHMehRbkiq 5u8HIV8cr/uNg== Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 6EEF72D1C15; Wed, 20 Apr 2022 14:53:01 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: xiangxia.m.yue@gmail.com, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: Tonghao Zhang , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Jiri Olsa , Dave Marchevsky , Kuniyuki Iwashima , Joanne Koong , Geliang Tang , "David S. Miller" , Jakub Kicinski , Eric Dumazet Subject: Re: [net-next v1] bpf: add bpf_ktime_get_real_ns helper In-Reply-To: <20220420122307.5290-1-xiangxia.m.yue@gmail.com> References: <20220420122307.5290-1-xiangxia.m.yue@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett Date: Wed, 20 Apr 2022 14:53:01 +0200 Message-ID: <878rrzj4r6.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org xiangxia.m.yue@gmail.com writes: > From: Tonghao Zhang > > This patch introduce a new bpf_ktime_get_real_ns helper, which may > help us to measure the skb latency in the ingress/forwarding path: > > HW/SW[1] -> ip_rcv/tcp_rcv_established -> tcp_recvmsg_locked/tcp_update_recv_tstamps > > * Insert BPF kprobe into ip_rcv/tcp_rcv_established invoking this helper. > Then we can inspect how long time elapsed since HW/SW. > * If inserting BPF kprobe tcp_update_recv_tstamps invoked by tcp_recvmsg, > we can measure how much latency skb in tcp receive queue. The reason for > this can be application fetch the TCP messages too late. Why not just use one of the existing ktime helpers and also add a BPF probe to set the initial timestamp instead of relying on skb->tstamp? -Toke