lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <4AF44A05.4060701@novell.com>
Date: Fri, 06 Nov 2009 11:08:37 -0500
From: Gregory Haskins <ghaskins@...ell.com>
To: David Miller <davem@...emloft.net>
CC: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
"alacrityvm-devel@...ts.sourceforge.net"
<alacrityvm-devel@...ts.sourceforge.net>
Subject: Re: [RFC PATCH] net: add dataref destructor to sk_buff
David Miller wrote:
> From: Gregory Haskins <ghaskins@...ell.com>
> Date: Fri, 02 Oct 2009 10:20:00 -0400
>
>> The following is an RFC for an attempt at addressing a zero-copy solution.
>>
>> To be perfectly honest, I have no idea if this is the best solution, or if
>> there is truly a problem with skb->destructor that requires an alternate
>> mechanism. What I do know is that this patch seems to work, and I would
>> like to see some kind of solution available upstream. So I thought I would
>> send my hack out as at least a point of discussion. FWIW: This has been
>> tested heavily in my rig and is technically suitable for inclusion after
>> review as is, if that is decided to be the optimal path forward here.
>>
>> Thanks for your review and consideration,
>
> I have no fundamental objections, but when you submit this for
> real can you show the code that uses it so we can get a better
> idea about things?
>
> Thanks.
Absolutely. I am not sure if this content would be appropriate for the
patch header, so I will just reply to your request here. If you would
like to see the patch resubmitted with the following in the header, let
me know.
The way we use this today is in the venet driver as part of the
AlacrityVM hypervisor. We therefore have a guest and host environment,
where the guest builds fully formed L2 frames, and the host generally
acts as a conduit for passing those frames to a real physical device
(such as through a soft-bridge, etc). We would like to do this without
requiring copies for certain classes of packets (i.e. packets larger
than a threshold). However we have to be smart about how we do this
since the guest technically "owns" the pages, and therefore needs
io-completion events to properly signify when pages are actually freed.
The way this all looks today is (I hope this doesn't get mangled):
----------------------------------------------------------------------
| guest | host |
----------------------------------------------------------------------
| stack | venet | venetdev | phydev |
----------------------------------------------------------------------
| alloc_skb() |
| dev_xmit() |
| -> queue_tx(sg) |
| -> dequeue_rx(sg) |
| alloc_pskb() |
| map_sg(sg)->pskb |
| loop(get_page()) |
| skb->release = cb |
| -> dev_xmit() |
| |
| txc_isr() <- |
| kfree_skb() |
| skb->release() |
| cb() <- |
| queue_event(sg) |
| txc_isr() <- |
| kfree_skb() |
| loop(put_page())|
----------------------------------------------------------------------
And here is the actual code in action
(kernel/vbus/devices/venet/device.c) from the alacrityvm.git tree
http://git.kernel.org/?p=linux/kernel/git/ghaskins/alacrityvm/linux-2.6.git;a=blob;f=kernel/vbus/devices/venet/device.c;h=d49ba7fa9f70cbb7e61c366d52d4c316d15f8b73;hb=HEAD
Line 587 is the "dequeue_rx()" operation from the diagram. Line 627 is
where we map in the guests pages to a scatterlist. Line 649 is where we
update the skb_shinfo->frags with the mapping. And finally, Line 677 is
where I register a callback for when the skb is released.
Line 853 is the callback that the stack invokes when the phydev finally
frees the packet. You can see that line 863 then sends an
transmit-complete event back up to the guest.
If this is not what you were looking for, please let me know. If this
looks acceptable to you, please consider the original patch for
inclusion at the next convenient merge window.
Thanks David!
-Greg
Download attachment "signature.asc" of type "application/pgp-signature" (268 bytes)
Powered by blists - more mailing lists