From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 58C4839FD4 for ; Thu, 5 Feb 2026 13:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770299160; cv=none; b=mkabA79F2SQuXfULDxMFcJ2OEG+woCM4eeEQYBBY8iBTHk1AomkqzUL2T169GiB1EJOc3Bl6ogxp5rZKf0jq2w6hchUwcclyK7pN1+Bc0ku2cIfGdqvOabFsK4NC+n2pvcoQOeN7FvRNwvXvQfcfR3JX85hIYMlhZBo8vx11xh4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770299160; c=relaxed/simple; bh=zntokVry81Mkk3OI0HoMyp2+zaPjjBCi0jfPMCHWqZg=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kewwldDMhGTu5tB/tgD6uCi4uify9HDcu2Bd14kHUDoJ3JmtCwxArp5zbtg359MXC4cZFvggOPmk1bMseRR3Mbmvzl5aXM7Xsh5YY822CAzYoHLcsfB3gpfuOTp39WItP8ai0BwiUMRE+Ngntl3Vb/ZdYoAyZPMTrXIvG482wwo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Bk+49ZGL; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bk+49ZGL" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-480142406b3so8077935e9.1 for ; Thu, 05 Feb 2026 05:46:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770299159; x=1770903959; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=lSe3DP+UKMA69sAOGcKJ9mzaLMcIBDtArPSidVC84FE=; b=Bk+49ZGLKHTgkFl2QDWCyWIuR5hjTfD/7J1/uqxl6AWiUu85+FZeEOc+BJJo+iBLmg +Z30KcZ03q/+CDTalS/vb2LlddsREhQkfKaKkO8CZs5g30iy38znfaT8JMc9uRRNUuaJ JiNTCrPfj+0ci8vSJvQrU3wxtLXPdS1YZ5TUoCyZtvPjUMcv+RRzHdcdOEhXr1q6dJnm dWgos2of80T7ehiCIqT5QIawYyp4363QcZelkIq8XeIitGblChpnkzYtLTknnUrmx0fh lseeeVrUQ/HA7+6IX+Ikrm2CCfUm9oC2MHU7ZgmeJtEl3OYTIKjV3KyvndCuZsruw7Xp 7wdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770299159; x=1770903959; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lSe3DP+UKMA69sAOGcKJ9mzaLMcIBDtArPSidVC84FE=; b=HDdlcF4vtF1epHRuBJb7Sp+4qY+2S5cvoz1/+JYYSfp6QOT5N7yTz1Q3WmPCVpFGdu ztZri7lgVbOSUZdlHOjM0+xlNf5Wv1rKNBvvLJRX6edFnwZzx1Nr3Z11abebDKlm29YK Gs+7dT6m2LczPOLDhxV6cM+izPqYoSbRGPdhnfBRnD2d3qrdr9Q4MojQULj2G3b0rxDt zXyzvg/2QvQvXXEzTfDc4PL4LiNtnzHE+0j9k7meVSkbD8g5HGJqKXg28JeG9OwR25kG /jtJ6RWqUT9NBEnN/H3euQmDLM0RDy7ddNYplF05R3K1fZsWOf6AKnwdvlewdBohtnHT cddw== X-Forwarded-Encrypted: i=1; AJvYcCULWOiuxJ+dm9hhciQDL+R+ku0Ep3ENUJ/KfaxC6korm520lMZ5NtjAiS7Qr6M9D+7zuJuELL4kevXJa3WG4fYr12M=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7mWcpHoFz1DYWCvyErkjNoaXv0eRUfW9GhmniOy9D1cJ7w/e5 ctahEGS/4tFN2ImGtmpf6KrYSpkBuAWutYjAsG3BFanGnUhuYxsIcbGt X-Gm-Gg: AZuq6aL4lbJTrCL0VmYjiffIeQ1lb8Whb8ou4FmgoL55t4PDA5hE4Wxe+SbNOpY9ZFZ OoBSC4BYnbPCoGKcwM/3Eib5AIl2paEmB6fPyEhLSBIDhsniizXuS/Je/ofaqyIwfqIUu30fkE2 NfLZaWa1xewn1VEAkWJIfuMDbJVMNcoSLS9hkPf6VYPIGMgQjHszA9qAwcLg50MZWXRktCjLnQQ 39jgipMcSLU/rSHfr/6HaNqv2uD42s3trxiiffa4WhChsRX/B0RXhSi3F2tfc1TEBGJOpUot4xU fIAbJWCmWvYkLIXQ+Hvq6e4hBFg1dN4JVEY7DP636RAVGCy5Ce5yXxe+U0MyV7G9aufrnqIfVQy DCRjVsRp8h/BboMgVfDAXL4TQGxc+LMYz9HMPjDaIQw4kIJRgBrmFNT1Ur89C X-Received: by 2002:a05:600c:1f08:b0:477:b642:9dc9 with SMTP id 5b1f17b1804b1-4830e993164mr89199165e9.28.1770299157801; Thu, 05 Feb 2026 05:45:57 -0800 (PST) Received: from krava ([2a02:8308:a00c:e200::b44f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48317d3f007sm87930895e9.9.2026.02.05.05.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 05:45:57 -0800 (PST) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Thu, 5 Feb 2026 14:45:55 +0100 To: Menglong Dong Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , Menglong Dong , Steven Rostedt , Mark Rutland Subject: Re: [RFC bpf-next 06/12] bpf: Add bpf_trampoline_multi_attach/detach functions Message-ID: References: <20260203093819.2105105-1-jolsa@kernel.org> <20260203093819.2105105-7-jolsa@kernel.org> <1945516.tdWV9SEqCh@7940hx> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1945516.tdWV9SEqCh@7940hx> On Thu, Feb 05, 2026 at 05:16:49PM +0800, Menglong Dong wrote: > On 2026/2/3 17:38 Jiri Olsa write: > > Adding bpf_trampoline_multi_attach/detach functions that allows > > to attach/detach multi tracing trampoline. > > > > The attachment is defined with bpf_program and array of BTF ids > > of functions to attach the bpf program to. > > > [...] > > @@ -367,7 +367,11 @@ static struct bpf_trampoline *bpf_trampoline_lookup(u64 key, unsigned long ip) > > head = &trampoline_ip_table[hash_64(tr->ip, TRAMPOLINE_HASH_BITS)]; > > hlist_add_head(&tr->hlist_ip, head); > > refcount_set(&tr->refcnt, 1); > > +#ifdef CONFIG_LOCKDEP > > + mutex_init_with_key(&tr->mutex, &__lockdep_no_track__); > > +#else > > mutex_init(&tr->mutex); > > +#endif > > for (i = 0; i < BPF_TRAMP_MAX; i++) > > INIT_HLIST_HEAD(&tr->progs_hlist[i]); > > out: > > @@ -1400,6 +1404,188 @@ int __weak arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, > > return -ENOTSUPP; > > } > > > > +#if defined(CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS) && defined(CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS) > > Hi, Jiri. It's great to see your tracing_multi link finally. It looks great ;) heya, thanks ;-) > > After analyzing a little deeper on the SINGLE_FTRACE_DIRECT_OPS, I > understand why it is only supported on x86_64 for now. It seems that > it's a little hard to implement it in the other arch, as we need to > restructure the implement of ftrace direct call. > > So do we need some more ftrace API here to make the tracing multi-link > independent from SINGLE_FTRACE_DIRECT_OPS? Otherwise, we can only > use it on x86_64. I tried to describe it in commit [2] changelog: At the moment we can enable this only on x86 arch, because arm relies on ftrace_ops object representing just single trampoline image (stored in ftrace_ops::direct_call). Archs that do not support this will continue to use *_ftrace_direct api. > > Have you ever tried to implement the SINGLE_FTRACE_DIRECT_OPS on arm64? > The direct call on arm64 is so complex, and I didn't work it out :/ yes, it seems to be difficult atm, Mark commented on that in [1], I don't know arm that good to be of much help in here, cc-ing Mark jirka [1] https://lore.kernel.org/bpf/aIyNOd18TRLu8EpY@J2N7QTR9R3/ [2] 424f6a361096 ("bpf,x86: Use single ftrace_ops for direct calls") > > Thanks! > Menglong Dong > > > + > > +struct fentry_multi_data { > > + struct ftrace_hash *unreg; > > + struct ftrace_hash *modify; > > + struct ftrace_hash *reg; > > +}; > > + > [...] > > > > > > > > > >