From patchwork Thu Feb 29 05:28:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fuyuanli X-Patchwork-Id: 208203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp189853dyb; Wed, 28 Feb 2024 21:33:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUO2SF37lbVgDUfPXwF0JRzioqkEXyg1fwnBcNHhpzxzOHGpqZhgDLrqSOQczNRF2uUmC/9x4jKCmLHyxqNSgWER62nFA== X-Google-Smtp-Source: AGHT+IGAZvyhU9n0tWQperYASr+nRenpLhJPvFFO7bLY91eCdWvrTjdUQiHXY01UgMfCh02tCBUF X-Received: by 2002:a05:6a20:2d2b:b0:1a0:ee90:7790 with SMTP id g43-20020a056a202d2b00b001a0ee907790mr1949110pzl.48.1709184805153; Wed, 28 Feb 2024 21:33:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709184805; cv=pass; d=google.com; s=arc-20160816; b=B9lrwxW9k8HPf+poXjQYqXaJeBh3YTSYPtJegffYVPIC40UaQVk8znFbG/SbKIwa91 ssakmEDjycQ6s3CtSQ5DNLyNAMIOkBKgidfO+NvYZVi8uclNLtqIoqsiMMxJclf59NuK reMpdi7aDubvgniGip3NRsjXM+XXkP3I2XUFUd3vJgPM9ciSrqitlckd52do+byTJ7O9 C/UKyCRNJMTpY2aYE2DBQ/1JlaD5ZVEIKuUYQvIJp5CUtlZTuLS5V0L783wJI0A32Wsw hvJlZn6E3/l2WV2OO3kLUDfMgCj2TiBPel+8GFn3+Z+BLxO7fjoua99+2lr6Nmnr/P/2 fEzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:mail-followup-to:message-id :subject:cc:to:from:date; bh=1y3NbHbN/Q+kTuZDOa64OiUMHdPHvo+tGVuBNLqBR2k=; fh=PzlfWFuqr39r26hAaJSu9bLCWZ8jjyqVIfcsgs7ZVyQ=; b=LvkuubCFMbXO++COsFjK4au8ewkIfD1GsmVOgJE2JDeU/MPTC1usUoUY0OVASgx3rW Uh7PQBcG1Lptc0IZY60wrY6Qt5YAZ59Fj/ENSlPOFHUo4F/Cb1JsCOndYbT0aGsHRCn9 y3TpsgMp+bTF7adgCJEo5i319z0T+dJ0+K5hjdRU1/QVBiroy6aqM4627rFRZhWYGJ/a fT0jEnhIka/zJNmlZ/WcCyw2RzRML4px8IGypoaXAjoZIZYgGuR7luyaxDLGIDDtCcmN lsEwDs7Y88msLaHAoVWiktPjINP9Ph6Ws7/BPtZN/GY33OCcgKPubKmJtMU4TAuQwJgQ em8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=didiglobal.com dmarc=pass fromdomain=didiglobal.com); spf=pass (google.com: domain of linux-kernel+bounces-86136-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86136-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=didiglobal.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q1-20020a170902dac100b001d958b8d593si639683plx.399.2024.02.28.21.33.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 21:33:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86136-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=didiglobal.com dmarc=pass fromdomain=didiglobal.com); spf=pass (google.com: domain of linux-kernel+bounces-86136-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86136-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=didiglobal.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 32500B24CBD for ; Thu, 29 Feb 2024 05:32:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D24883BBF0; Thu, 29 Feb 2024 05:31:47 +0000 (UTC) Received: from mx9.didiglobal.com (mx9.didiglobal.com [111.202.70.124]) by smtp.subspace.kernel.org (Postfix) with SMTP id 192CA3A28D; Thu, 29 Feb 2024 05:31:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.202.70.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709184706; cv=none; b=PFI/jDW9ISHqKRptjXoJM8KIjP1JlKhuClsm8yuP2Eh/KZgExR7eamvN9QWvkXfcvAx8ZHy6SfMSZ82/qa6XC94Ybnlpudowz3ECF5bmCBfoEdO68F7UtnMH8MPBVCCTXhyPlsrAOUi58wwmfyhC6/4pdMiJPD4SX2jVqY7+8ZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709184706; c=relaxed/simple; bh=ItNNI5PI2/YfqekAfeRz73Do4tEfWpAAJlwE9t9osO4=; h=Date:From:To:CC:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=l5a/Y35iPu3p5DXLRl7KueenygWiVQnbUFUtbhBjFgcw8sijHxMmrdCwKI+6zEv95js3+xDuIfOUxS/JXEX/tXD3Eybxs+dKoK62+rd4ssFYWLJ1R6L7jKi1JIafpXBSxkgQCokGDq8EWr8ZLHQ+bQhqxePG0MwAmPaEnw7ZcpE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=didiglobal.com; spf=pass smtp.mailfrom=didiglobal.com; arc=none smtp.client-ip=111.202.70.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=didiglobal.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=didiglobal.com Received: from mail.didiglobal.com (unknown [10.79.65.12]) by mx9.didiglobal.com (MailData Gateway V2.8.8) with ESMTPS id 6D60D1875C42A1; Thu, 29 Feb 2024 13:28:31 +0800 (CST) Received: from didi-ThinkCentre-M920t-N000 (10.79.64.101) by ZJY02-ACTMBX-02.didichuxing.com (10.79.65.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 29 Feb 2024 13:28:30 +0800 Date: Thu, 29 Feb 2024 13:28:22 +0800 X-MD-Sfrom: fuyuanli@didiglobal.com X-MD-SrcIP: 10.79.65.12 From: fuyuanli To: CC: , , , , , , Subject: [PATCH] tcp: Add skb addr and sock addr to arguments of tracepoint tcp_probe. Message-ID: <20240229052813.GA23899@didi-ThinkCentre-M920t-N000> Mail-Followup-To: edumazet@google.com, rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, fuyuanli@didiglobal.com Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: ZJY02-PUBMBX-01.didichuxing.com (10.79.65.31) To ZJY02-ACTMBX-02.didichuxing.com (10.79.65.12) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792210166180874815 X-GMAIL-MSGID: 1792210166180874815 It is useful to expose skb addr and sock addr to user in tracepoint tcp_probe, so that we can get more information while monitoring receiving of tcp data, by ebpf or other ways. For example, we need to identify a packet by seq and end_seq when calculate transmit latency between lay 2 and lay 4 by ebpf, but which is not available in tcp_probe, so we can only use kprobe hooking tcp_rcv_esatblised to get them. But we can use tcp_probe directly if skb addr and sock addr are available, which is more efficient. Signed-off-by: fuyuanli --- include/trace/events/tcp.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h index 7b1ddffa3dfc..096c15f64b92 100644 --- a/include/trace/events/tcp.h +++ b/include/trace/events/tcp.h @@ -258,6 +258,8 @@ TRACE_EVENT(tcp_probe, __field(__u32, srtt) __field(__u32, rcv_wnd) __field(__u64, sock_cookie) + __field(const void *, skbaddr) + __field(const void *, skaddr) ), TP_fast_assign( @@ -285,6 +287,9 @@ TRACE_EVENT(tcp_probe, __entry->ssthresh = tcp_current_ssthresh(sk); __entry->srtt = tp->srtt_us >> 3; __entry->sock_cookie = sock_gen_cookie(sk); + + __entry->skbaddr = skb; + __entry->skaddr = sk; ), TP_printk("family=%s src=%pISpc dest=%pISpc mark=%#x data_len=%d snd_nxt=%#x snd_una=%#x snd_cwnd=%u ssthresh=%u snd_wnd=%u srtt=%u rcv_wnd=%u sock_cookie=%llx",