Page MenuHomeFreeBSD

hyperv/hn: Improve sending performance
ClosedPublic

Authored by sepherosa_gmail.com on Jan 26 2016, 3:26 AM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 30 2024, 1:37 AM
Unknown Object (File)
Apr 30 2024, 1:32 AM
Unknown Object (File)
Feb 14 2024, 5:44 PM
Unknown Object (File)
Jan 18 2024, 3:36 AM
Unknown Object (File)
Jan 15 2024, 3:52 AM
Unknown Object (File)
Dec 20 2023, 12:33 AM
Unknown Object (File)
Sep 11 2023, 4:55 AM
Unknown Object (File)
Jun 20 2023, 3:12 AM
Subscribers

Details

Summary
  • Avoid main lock contention by trylock for if_start, if that fails, schedule TX taskqueue for if_start
  • Don't do direct sending if the packet to be sent is large, e.g. TSO packet.

This change gives me stable 9.1Gbps TCP sending performance w/ TSO over a 10Gbe directly connected network (the performance fluctuated between 4Gbps and 9Gbps before this commit). It also improves non-TSO TCP sending performance a lot.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sepherosa_gmail.com retitled this revision from to hyperv/hn: Improve sending performance.
sepherosa_gmail.com updated this object.
sepherosa_gmail.com edited the test plan for this revision. (Show Details)
adrian edited edge metadata.
This revision is now accepted and ready to land.Jan 26 2016, 3:32 AM

Out of curiosity, those 9.1Gbps are with a debug kernel or a non-debug one?

Out of curiosity, those 9.1Gbps are with a debug kernel or a non-debug one?

Kernel w/o WITNESS, but w/ INVARIANTS. Make options has DEBUG=-g.

sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
399 ↗(On Diff #12702)

Do you really need to use the _fast versions of the taskqueue? This is only needed if you are adding tasks from a fast interrupt filter (ie: not a handler) or already holding a spinlock.

sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
399 ↗(On Diff #12702)

I believe the taskq contention could be high, since many threads will try enqing start task. And well, I don't think it hurts to use a fast taskqueue here.

royger edited edge metadata.
royger added inline comments.
sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
399 ↗(On Diff #12702)

Yes, I think it's fine, just was curios because I wasn't able to spot it using any fast interrupt handlers.

IMHO, it is also worth keeping into account that on virtualized systems there's a great chance that not all vCPUs run concurrently (depending on whether the hypervisor implements gang-scheduling), so spinlocks can introduce quite a lot of contention because the holder of the spinlock might not be scheduled, and another vCPU might be spinning to get a hold of the lock.

sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
399 ↗(On Diff #12702)

It is an interesting point of view; I will note it :). I am also going to experiment some other ways, which may not cause contentions at all on driver tx lock or taskqueue lock.

This revision was automatically updated to reflect the committed changes.