Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtio uses shiftleft/shiftright to tag packets #1034

Merged
merged 6 commits into from
Nov 7, 2016

Conversation

wingo
Copy link
Contributor

@wingo wingo commented Oct 14, 2016

This builds on #1032 and uses shiftleft/shiftright in the virtio-net driver to tag and untag packets. It also switches guest snabb applications to use direct descriptors.

Instead of memmoving a packet's data around this patch instead moves
around the packet pointer itself.

The only performance testing I did was "snabb lwaftr bench", where it
appears to be neutral-to-slight-win.  I am hoping that the Hydra/R
scientists can help me out on this one.

This change to the packet structure does have a knock-on effect, in
two significant ways.  One is that the shiftleft, shiftright, and
prepend functions now return a new packet pointer and silently corrupt
the old one (because probably they shifted around the data but still
had to update the new "length" pointer).  That's somewhat OK though.

The problem comes in the datagram library, which sometimes wants to
work on a user-supplied packet.  The sequence was:

  local dgram = datagram:new(pkt)
  dgram:push(....)
  dgram:free()
  ...
  foo(pkt)

This pattern is no longer valid :(  The reason is that the datagram
methods that mutate a packet often do so by packet.prepend().  The
datagram library updates its internal packet pointer, but the external
one that was initially passed in is no longer valid.  So much of this
patch is visiting (hopefully) all of the uses/users and updating them.
Instead of defining duplicate versions of structs in virtq_driver.lua,
just use the C headers.
Use direct descriptors, and use packet.shift to add and remove virtio headers.
@wingo
Copy link
Contributor Author

wingo commented Oct 14, 2016

stats will be here: https://hydra.snabb.co/build/659075

@wingo
Copy link
Contributor Author

wingo commented Oct 17, 2016

@lukego wdyt about this one? Only affects Snabb guests, not DPDK or other guests. There is no corresponding change for the host because the choice of descriptor layout is up to the guest, not the host. The PR is hard to read though because it includes earlier patches from #1032; perhaps just look at the last two commits.

Nicola Larosa and @domenkozar are working on getting lwaftr tests into Hydra but I think we don't yet have them wired up. Still, obvious improvement I think, simplifying the code and giving us twice the descriptor count.

@wingo
Copy link
Contributor Author

wingo commented Oct 19, 2016

ping :)

@lukego
Copy link
Member

lukego commented Oct 19, 2016

I suggest workflow of @eugeneia or @kbara being upstream for this and then sending it onwards to me for rubber-stamping. I have no strong feelings on this module - wasn't involved in the development - and have no access to test cases for it either.

@kbara
Copy link
Contributor

kbara commented Oct 19, 2016

It looks like a solid win on iperf results. On the three 'l2fwd by configuration' graphs, it looks like it may be slightly worse; I can't tell eyeballing it if that is significant.

Interestingly, 2.1.0 noind is still bimodal.

@kbara
Copy link
Contributor

kbara commented Oct 19, 2016

I'd be willing to upstream it, if @lukego is happy with an Igalian upstreaming for an Igalian.

@wingo
Copy link
Contributor Author

wingo commented Oct 19, 2016

That linked perf analysis includes the result of #1032. Let me see if I find a new one.

@lukego
Copy link
Member

lukego commented Oct 19, 2016

Oh, or. perhaps I have misunderstood this change. Is this changing the device side of virtio-net? I will look more closely now...

@wingo
Copy link
Contributor Author

wingo commented Oct 19, 2016

This is changing the driver side of virtio-net.

@kbara
Copy link
Contributor

kbara commented Oct 19, 2016

It changes src/lib/virtio/virtq_driver.lua

@lukego
Copy link
Member

lukego commented Oct 19, 2016

OK. In that case I prefer not to be upstream as per ^^^ and I don't think this code has any coverage in existing Hydra tests (which currently always runs DPDK inside the guest and never Snabb).

@kbara Sure but virtq_device is the code being exercised by CI i.e. the device (hypervisor/snabbnfv) side.

@wingo
Copy link
Contributor Author

wingo commented Oct 19, 2016

@kbara there is no up-to-date perf thing. however it will not show on the graphs because #736 hasn't landed; we don't have any automated tests with snabb guests AFAIU, neither integration nor benchmarking :(

@lukego
Copy link
Member

lukego commented Oct 19, 2016

(The ideal would be to add a Hydra case that runs Snabb inside the VM in addition to DPDK. This should be fairly straightforward FWIW.)

@lukego
Copy link
Member

lukego commented Oct 19, 2016

(i.e. it would be an extension of the existing l2fwd benchmark that we run on Hydra but it would run with a different VM image i.e. one that runs the Snabb-based l2fwd instead of the DPDK-based one.)

@wingo
Copy link
Contributor Author

wingo commented Oct 19, 2016

I verrrrry much understand not wanting to land something without CI, but I think the right thing to do here is just merge this so we can merge the lwaftr. Merging it does not make the situation worse and this is the code that we are shipping and we are the only users of this code, and in parallel @dpino has #736 open and Domen and Nicola are working on getting hydra+lwaftr+qemu+... working too, so things are on the right track IMO. @kbara wdyt?

@kbara kbara self-assigned this Oct 19, 2016
@kbara
Copy link
Contributor

kbara commented Oct 19, 2016

Looks like @lukego has thumbed up it. I'm ok with that workflow, with the caveat that I think we really need to do our best to have test coverage of it in the next ~2 weeks, before the next release is cut.

@kbara
Copy link
Contributor

kbara commented Oct 19, 2016

I've reviewed it. LGTM, @wingo . As per out of band discussion, please merge this to wingo-next, since you'll need it there for the lwaftr merge and there's no point putting it in two maintainer-next branches. :)

@eugeneia
Copy link
Member

Slightly off-topic...

we are the only users of this code

There have been two instances of students asking for help with virtio_net on snabb-devel (latest instance: https://groups.google.com/forum/#!topic/snabb-devel/8eLfuiKksjY ). Sadly, I couldn’t help them because I have never used virtio_net and neither have a way to test it. Since there seems to heightened interest in this, I think it would be very valuable to make virtio_net a first class Snabb citizen like vhost_user, and integration with the l2fwd benchmark would go a long way!

@wingo wingo added the merged label Oct 21, 2016
@eugeneia eugeneia merged commit a5541e5 into snabbco:master Nov 7, 2016
@wingo wingo deleted the virtio-packet-shift branch June 5, 2017 13:00
lukego pushed a commit to lukego/snabb that referenced this pull request Mar 22, 2018
Load potentially 64-bit values using mov64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants