Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Jason Xing
Tue, 20 Oct 2026 06:34
Re: [PATCH] udp: Add noinline_for_tracing annotation for udp{,_v6}_send_skb()
Author: Jason Xing
Date: Tue, 20 Oct 2026 06:34
Date: Tue, 20 Oct 2026 06:34
79 lines
14873 bytes
14873 bytes
On Tue, Oct 20, 2026 at 7:08 AM Josh Don <joshdon@google.com> wrote:
>
> We hook udp_send_skb() and udp_v6_send_skb() using BPF fentry programs
> to monitor UDP transmits. Both functions are static and have two
> callers: udp{,v6}_sendmsg() and udp{,_v6}_push_pending_frames().
>
> After an FDO profile update, udp_v6_send_skb() is now inlined into
> udpv6_sendmsg(), while an out-of-line copy remains for
> udp_v6_push_pending_frames(). The fentry program still attaches
> successfully, but it is silently bypassed for all uncorked sends.
>
> To address this, make both functions noinline explicitly for tracing,
> as was done for tcp_drop_reason() in commit dbd5e2e79ed8 ("net: tcp:
> Add noinline_for_tracing annotation for tcp_drop_reason()").
>
> Assisted-by: LLM
> Signed-off-by: Josh Don <joshdon@google.com>
I actually mentioned this thing a few times before. The original
thread was from Breno who tried to apply a similar change for tcp
sendmsg. The fact is until now we don't guarantee those functions
should be kept noinline like how uAPI works just for BPF prog. What I
suggested was to select a series of functions in one Doc so that we
could tell people those functions should be noinline or whatever else
just for tracing in a soft way?
Otherwise people would argue there are more functions that should be
done in the same way because they internally trace it.
Willem, Kuniyuki, any thoughts?
Thanks,
Jason
> ---
> net/ipv4/udp.c | 4 ++--
> net/ipv6/udp.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index b090bd1f59e86..487c8cc8ab206 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -1110,8 +1110,8 @@ void udp_set_csum(bool nocheck, struct sk_buff *skb,
> }
> EXPORT_SYMBOL(udp_set_csum);
>
> -static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,
> - struct inet_cork *cork)
> +noinline_for_tracing static int
> +udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, struct inet_cork *cork)
> {
> struct sock *sk = skb->sk;
> int offset, len, datalen;
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index 93478d1ad5769..fe92538835176 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -1366,8 +1366,8 @@ static void udp6_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
> * Sending
> */
>
> -static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,
> - struct inet_cork *cork)
> +noinline_for_tracing static int
> +udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6, struct inet_cork *cork)
> {
> struct sock *sk = skb->sk;
> int offset, len, datalen;
> --
> 2.56.0.212.g129ede20d9-goog
>
>
Re: [PATCH] udp: Add noinline_for_tracing annotation for udp{,_v6}_send_skb()
Author: Willem de Bruijn
Date: Tue, 20 Oct 2026 13:50
Date: Tue, 20 Oct 2026 13:50
44 lines
12870 bytes
12870 bytes
Jason Xing wrote:
> On Tue, Oct 20, 2026 at 7:08 AM Josh Don <joshdon@google.com> wrote:
> >
> > We hook udp_send_skb() and udp_v6_send_skb() using BPF fentry programs
> > to monitor UDP transmits. Both functions are static and have two
> > callers: udp{,v6}_sendmsg() and udp{,_v6}_push_pending_frames().
> >
> > After an FDO profile update, udp_v6_send_skb() is now inlined into
> > udpv6_sendmsg(), while an out-of-line copy remains for
> > udp_v6_push_pending_frames(). The fentry program still attaches
> > successfully, but it is silently bypassed for all uncorked sends.
> >
> > To address this, make both functions noinline explicitly for tracing,
> > as was done for tcp_drop_reason() in commit dbd5e2e79ed8 ("net: tcp:
> > Add noinline_for_tracing annotation for tcp_drop_reason()").
> >
> > Assisted-by: LLM
> > Signed-off-by: Josh Don <joshdon@google.com>
>
> I actually mentioned this thing a few times before. The original
> thread was from Breno who tried to apply a similar change for tcp
> sendmsg. The fact is until now we don't guarantee those functions
> should be kept noinline like how uAPI works just for BPF prog. What I
> suggested was to select a series of functions in one Doc so that we
> could tell people those functions should be noinline or whatever else
> just for tracing in a soft way?
>
> Otherwise people would argue there are more functions that should be
> done in the same way because they internally trace it.
>
> Willem, Kuniyuki, any thoughts?
We'll have to review hooks on a case-by-case basis for performance
impact.
If possible, it's preferable to select hooks that cannot be inlined.
Over limiting what the compiler is allowed to do.
Re: [PATCH] udp: Add noinline_for_tracing annotation for udp{,_v6}_send_skb()
Author: Jason Xing
Date: Wed, 21 Oct 2026 03:29
Date: Wed, 21 Oct 2026 03:29
49 lines
14252 bytes
14252 bytes
On Tue, Oct 20, 2026 at 9:50 PM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> Jason Xing wrote:
> > On Tue, Oct 20, 2026 at 7:08 AM Josh Don <joshdon@google.com> wrote:
> > >
> > > We hook udp_send_skb() and udp_v6_send_skb() using BPF fentry programs
> > > to monitor UDP transmits. Both functions are static and have two
> > > callers: udp{,v6}_sendmsg() and udp{,_v6}_push_pending_frames().
> > >
> > > After an FDO profile update, udp_v6_send_skb() is now inlined into
> > > udpv6_sendmsg(), while an out-of-line copy remains for
> > > udp_v6_push_pending_frames(). The fentry program still attaches
> > > successfully, but it is silently bypassed for all uncorked sends.
> > >
> > > To address this, make both functions noinline explicitly for tracing,
> > > as was done for tcp_drop_reason() in commit dbd5e2e79ed8 ("net: tcp:
> > > Add noinline_for_tracing annotation for tcp_drop_reason()").
> > >
> > > Assisted-by: LLM
> > > Signed-off-by: Josh Don <joshdon@google.com>
> >
> > I actually mentioned this thing a few times before. The original
> > thread was from Breno who tried to apply a similar change for tcp
> > sendmsg. The fact is until now we don't guarantee those functions
> > should be kept noinline like how uAPI works just for BPF prog. What I
> > suggested was to select a series of functions in one Doc so that we
> > could tell people those functions should be noinline or whatever else
> > just for tracing in a soft way?
> >
> > Otherwise people would argue there are more functions that should be
> > done in the same way because they internally trace it.
> >
> > Willem, Kuniyuki, any thoughts?
>
> We'll have to review hooks on a case-by-case basis for performance
> impact.
>
> If possible, it's preferable to select hooks that cannot be inlined.
> Over limiting what the compiler is allowed to do.
I will initiate a standalone discussion via the mailing list with a
list of samples/functions as you suggested.
Thanks,
Jason
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads