From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE08D18D656 for ; Wed, 7 May 2025 03:37:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746589047; cv=none; b=lv+QzeyMcNi/FgBsciYw8ApEztnQATgogi4oIZK8qGXAzN+ZiOKpy0llrreCZVxmktib/O6fER52J2xsge3uUui6jtQ5XZOkZzJMhWjm71ccF434HxY3jS9sI6QH7qN/fCC88m2Nd65YrPlf0SDWNMOwwu04W3vOE0am9UwN9rI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746589047; c=relaxed/simple; bh=Ii2HsbsJCi+o1eq0rP0UpxufBNOzNtLUmYan93+sP2g=; h=MIME-Version:Date:Content-Type:From:Message-ID:Subject:To:Cc: In-Reply-To:References; b=EPiXPjMfEbutLwkYjdLxfOG8u96nNUA5rli/OQ+Zuqe9POWRJo4G4t/k9fZiZhtrOtXPdvhaFkJmi3i6B/PtaOs1YHzGkfw+B50sj8MO0OnSuhINce5Z5/baEwJeg11Z4VKo0BrmwG78E7WStRdk4zCjkqmswGeUYwjSANkgehA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=t8fcsH4n; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="t8fcsH4n" Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1746589043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IOssk0YASQZK9VWKknBMj0km7yOvtPSfKPB8Te1c8xg=; b=t8fcsH4ncz3hp4xC8IN8nYQxChcrR/9K7LXfLj5pSoCyMwqDfK0zkrDcD4dgBhDdFU32+V OYLw8RFVkTH4rqkZ6eVerBlUINPBNGJJULrzKvPye4zPmVJCx8mSdHFx5UJUFv4ICUDMfs ka7pWGMieySXEoO4RrQPC7xViWVdBoY= Date: Wed, 07 May 2025 03:37:21 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Jiayuan Chen" Message-ID: <9c311d9944fa57cec75e06cde94496d782fe4980@linux.dev> TLS-Required: No Subject: Re: [RESEND PATCH bpf-next v4 1/2] bpf, sockmap: Introduce tracing capability for sockmap To: "Martin KaFai Lau" , "Jakub Sitnicki" , "John Fastabend" Cc: "Cong Wang" , "Steven Rostedt" , "Alexei Starovoitov" , "Daniel Borkmann" , "Andrii Nakryiko" , "Eduard Zingerman" , "Song Liu" , "Yonghong Song" , "KP Singh" , "Stanislav Fomichev" , "Hao Luo" , "Jiri Olsa" , "Masami Hiramatsu" , "Mathieu Desnoyers" , "David S. Miller" , "Eric Dumazet" , "Jakub Kicinski" , "Paolo Abeni" , "Simon Horman" , "Jesper Dangaard Brouer" , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-trace-kernel@vger.kernel.org In-Reply-To: References: <20250506025131.136929-1-jiayuan.chen@linux.dev> X-Migadu-Flow: FLOW_OUT May 7, 2025 at 04:24, "Martin KaFai Lau" wrote: >=20 >=20On 5/5/25 7:51 PM, Jiayuan Chen wrote: >=20 >=20>=20 >=20> Sockmap has the same high-performance forwarding capability as XDP,= but > >=20 >=20> operates at Layer 7. > >=20 >=20> Introduce tracing capability for sockmap, to trace the execution r= esults > >=20 >=20> of BPF programs without modifying the programs themselves, similar= to > >=20 >=20> the existing trace_xdp_redirect{_map}. > >=20 >=20 > There were advancements in bpf tracing since the trace_xdp_xxx addition= s. >=20 >=20Have you considered the fexit bpf prog and why it is not sufficient ? >=20 1.This=20patchset prints a large amount of information (e.g. inode ID, et= c.), some of which require kernel-internal helpers to access. These helpers ar= e not currently available as kfuncs, making it difficult to implement equivalent functionality with fentry/fexit. 2. skb->_sk_redir implicitly stores both a redir action and the socket ad= dress in a single field. Decoding this structure in fentry/fexit would require duplicating kernel-internal logic in BPF programs. This creates maintenan= ce risks, as any future changes to the kernel's internal representation woul= d necessitate corresponding updates to the BPF programs. 3. Similar to the debate between using built-in tracepoints vs kprobes/fe= ntry, each approach has its tradeoffs. The key advantage of a built-in tracepoi= nt is seamless integration with existing tools like perf and bpftrace, which na= tively support tracepoint-based tracing. For example, simply executing 'perf trace -e 'sockmap:*' ./producer' could provide sufficient visibilit= y without custom BPF programs.