Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1192514lqz; Sun, 31 Mar 2024 19:28:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUhDPJhAF7zDsrSRRKIb0ETxK+jUhQMkI49kU9XGH2Mu1cUnalS0LmGLR+9X8Wtbp3dT3CKPNuqS76LvKBiMP2R2YoJADNOq88Wfi/yaA== X-Google-Smtp-Source: AGHT+IHmLPW/tchIjnmg3ux5uEhNK1UIPzFk9mHL/hsqBxIWPtxsJGpUXgD0ILnidW2LQoClPZeg X-Received: by 2002:ad4:4e50:0:b0:696:6712:66a0 with SMTP id eb16-20020ad44e50000000b00696671266a0mr8309395qvb.61.1711938525670; Sun, 31 Mar 2024 19:28:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711938525; cv=pass; d=google.com; s=arc-20160816; b=J95QYMKMmsXvb2FWzyJKLxqu6lUgxpdrmf6/KbEdkorSbab9MyPZc70ns9Olm9lk3I lsEJWv/2f7rjgpLnVYi4knagfabUtMVk2qQinsRc6HP0u72cI1tFx/EBr8UWrm3X9qbF 0Qvo/8C9QVsshvIav5GB+TuBZstFiSIXeclJ0rDzN7onFAtyR1n3041QwuwKcMNAafx9 H0gnPFUnRrumTUu7A+sNrKRcQfRW6oU/nTb8QdcCgn1clX8fHPtbOYPgQkDibB0vfHZG 0IpTXUkgMuQaW7CNz7sE0uO6b8oNSxAZD68u6e559qisO1zxZ2Gyc/qxV9D3TARbj7TZ VSTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=IXMeLoImPZ33R4zJ3SWpn56WCPhsxXC6Los6ajh1i8M=; fh=6rlha9Dke0rMSKcugWBfpUl6kfopnORQyjeuOiAPWG8=; b=gF9AiBVJPqAKAq2KedQejL+V4NnSRU1QT8pKJ5xtOnQw5PrS3MwBZsIck7qNbbqH8L vpF08x+1gyfCbk+VpcXmRbrAO03agHRcnHYRd7xa80Ym4ZNaQlBqfsjlOnsDsk39MwHy +Q39KL2ctnKVkc5/PgVmF/ZI0eqU1CoJxIteBQH3tn1PVPZUR7w7JVyENKNuvbmIpp/Q zN6Xn9k07zzlhh9Tp54VPoaHZu7KTHEj+XYLJ2hqLlZkrNxn4QgzKuvvqwFkRlC5/9py 9ihWf7IQrmVsVo3hdIYStQS29MHGMQ4RQ52p7HFK17if2GMdPlUp4STYAeA4o9a4JB33 r7rA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=P9LU1I5j; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-126412-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126412-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e17-20020a056214163100b006968335710esi8269280qvw.404.2024.03.31.19.28.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 19:28:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126412-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=P9LU1I5j; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-126412-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126412-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5744F1C20AB5 for ; Mon, 1 Apr 2024 02:28:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E4CA74C94; Mon, 1 Apr 2024 02:28:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="P9LU1I5j" Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71F7E138A for ; Mon, 1 Apr 2024 02:28:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711938511; cv=none; b=VPpf0s+QoM3nJ/kj01JOr5wrobxTXbNcRmbbHCkuT78IF8BWxqqTDtqDr+OblyWNNGXlkaZNjYuXrLHSxlaIGchkd5iP6tVXrh5HHFDP9bjCTmN+a1RaJEISCb1NQpLsw9mePMpNyDpuM88y3wusXIsv+nzza1AP8VfQdeprjHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711938511; c=relaxed/simple; bh=lKYTnWKj8aFybgNfcmvkcPZSxsoRl/ozkQQU3rEQW/s=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Xznt+sXoiEs5xVdFGUUUkAPA089fmBKUsWAybdva2yStRkf0l5u6wZWKUGBF1sMPjYbwCnsr+hhsDarTTStlviEt7+jlUK/VhWo5GpqiU8uG1KWRLSGaetB3j0U+/SJle/CW2Yq8WvWwwd2LqRPivMjVycR75dtO5VnGKHsK6kc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=P9LU1I5j; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-5bdbe2de25fso2682681a12.3 for ; Sun, 31 Mar 2024 19:28:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1711938509; x=1712543309; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IXMeLoImPZ33R4zJ3SWpn56WCPhsxXC6Los6ajh1i8M=; b=P9LU1I5jukjBMKO1LqMu6jlbfGHWLyHQxqQEbnkNnlfzzWygJn8dddUXQxUiTYGYJk pIU80nb/2WZVl3/N78k9aRjLZDKKH6J8167B9QXy68cqQHfQubEORLoFjlDhJVM7VM3B 6Na+rY+eTZa0JSAL6z3h7R/HVgj9AeTdTOE8/TY6IYzAzKStiN8pUlJs4+N6Qa/6A3ya 7EDlKJEIHYKWInZL5oH0u5OH7XiI1OuKJWLwWhynNDiDm4rNYpwWeBGxtyJngpicWEL+ 88rxTY76vW1XtH7NDjlmMxvBnSri98lhy/GpFpqlgYW5itg2Oxs+cqcpgtblJ2t/vYuY YDog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711938509; x=1712543309; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IXMeLoImPZ33R4zJ3SWpn56WCPhsxXC6Los6ajh1i8M=; b=q5rbdTLP3knvGr/JIhtZe2YEmxEhlr3r36N1GuHN5pIrDjgpa84kf5RoSMOy2OZHcA fThdCHgD/kw668ySHvG1UiTRbF/QUivsoH09FJgcAqa2GM/TTTNqpf+pMnJTzUer2cJ8 mvy3Pys9NQYE6UjC/2gaKyofunetQqsU0mRAXehuzhmCfaWqMZQFcCUVwz7Y5YPYyFXE Q0zuN61X1xJ1+3ORdb5r+qCwZZjwfsyQsmoyA8IjG5tipDiE7umpaQ94RO5R0xvcvFMe 02K0KJdEiW++obc244kG5bMPmhiOojbdu3bxFIKDkeLnGq21+JW+hqaKbrdLEkXmlf6N fTIg== X-Forwarded-Encrypted: i=1; AJvYcCXOJjgEI1jn43b6wraT3HYZZDxRIfgTUNmyoQ487Qnbhw3pJKQiGdXkQ4Mf9vugWwnlfhS3+G5okxsgYcpdcG9E4wyB5aoLjLKKhjwS X-Gm-Message-State: AOJu0YynsEiqZHM+PXtCqhRlI/6dKJ3nSO/AlxWUxPnEr7vRPdZXUDLv lDOKYheUUd2M5OyvC53og1dKosjviripfaQvKpuc1YPuPkSp/SxsZI7zNJux/rWJwm7vyrzzBJp bRu1jyBWSUMxCYFFoG1tF6SWXPqFHod0DfxQKwQ== X-Received: by 2002:a05:6a20:550a:b0:1a3:6a74:2e6a with SMTP id ko10-20020a056a20550a00b001a36a742e6amr8586402pzb.14.1711938508724; Sun, 31 Mar 2024 19:28:28 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240311093526.1010158-1-dongmenglong.8@bytedance.com> <20240311093526.1010158-2-dongmenglong.8@bytedance.com> <20240328111330.194dcbe5@gandalf.local.home> <20240330153722.65104301@gandalf.local.home> In-Reply-To: <20240330153722.65104301@gandalf.local.home> From: =?UTF-8?B?5qKm6b6Z6JGj?= Date: Mon, 1 Apr 2024 10:28:17 +0800 Message-ID: Subject: Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args To: Steven Rostedt Cc: Alexei Starovoitov , Jiri Olsa , Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Eddy Z , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "David S. Miller" , David Ahern , Dave Hansen , X86 ML , Mathieu Desnoyers , Quentin Monnet , bpf , linux-arm-kernel , LKML , linux-riscv , linux-s390 , Network Development , linux-trace-kernel@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , linux-stm32@st-md-mailman.stormreply.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Mar 31, 2024 at 3:34=E2=80=AFAM Steven Rostedt wrote: > > On Sat, 30 Mar 2024 11:18:29 +0800 > =E6=A2=A6=E9=BE=99=E8=91=A3 wrote: > > > > If you really want to have thousands of functions, why not just regis= ter it > > > with ftrace itself. It will give you the arguments via the ftrace_reg= s > > > structure. Can't you just register a program as the callback? > > > > > > > Ennn...I don't understand. The main purpose for > > me to use TRACING is: > > > > 1. we can directly access the memory, which is more > > efficient. > > I'm not sure what you mean by the above. Access what memory? > We need to use the helper of bpf_probe_read_kernel when we read "skb->sk" in kprobe, and the "skb" is the 1st arg in ip_rcv(). And we can directly read "skb->sk" in tracing, which is more efficient. Isn't it? > > 2. we can obtain the function args in FEXIT, which > > kretprobe can't do it. And this is the main reason. > > I didn't mention kretprobe. If you need access to the exit of the functio= n, > you can use Masami's fgraph update. > > fentry -> ftrace_trampoline -> your_code > > For fgraph: > > fentry -> ftrace_trampoline -> fgraph [sets up return call] -> your_entr= y_code > > function ret -> fgraph_ret_handler -> your_exit_code > > And you will be able to pass data from the entry to the exit code, > including parameters. Yeah, the fgraph sounds like a nice solution to my problem. I'll have a try on it. Thanks! Menglong Dong > > -- Steve > >