On Mon, Nov 19, 2018 at 6:00 AM Anand H. Krishnan
<anandhkrish...@gmail.com> wrote:
>
> Hello,
>
> I tried the 4.19.2 kernel without success. You were probably right
> that skb_orphan
> is indeed called from somewhere in the receive path. I had an
> instrumented kernel
> and the following is what I see:

Thanks for verifying.

I was also able to reproduce it without veth by looping a packet
to another packet socket that delays reading from the socket.

A very preliminary patch is to mark the socket as zerocopy in
tpacket_fill_skb to trigger skb_copy_ubufs whenever the
packet gets cloned or enters the receive path:

@@ -2462,6 +2462,9 @@ static int tpacket_fill_skb(struct packet_sock
*po, struct sk_buff *skb,
        skb->tstamp = sockc->transmit_time;
        sock_tx_timestamp(&po->sk, sockc->tsflags, &skb_shinfo(skb)->tx_flags);
        skb_shinfo(skb)->destructor_arg = ph.raw;
+       skb_shinfo(skb)->tx_flags |= SKBTX_ZEROCOPY_FRAG;

This requires at the least a fixup in skb_zcopy_clear to handle this
special case and not call uarg->callback (because
skb_shinfo(skb)->destructor_arg is of a different type for
tpacket_snd). I'll share a patch to test when I have something
more concrete.

Reply via email to