aboutsummaryrefslogtreecommitdiffstatshomepage
Commit message (Collapse)AuthorAgeFilesLines
* uint64_t and need_resched()tg/mpmc-benchmarkThomas Gschwantner2018-07-041-6/+8
|
* Disable preemption in produce()Thomas Gschwantner2018-06-251-1/+5
|
* BenchmarkThomas Gschwantner2018-06-223-10/+21
|
* mpmc_ptr_ring: add {,un}likely() annotationsThomas Gschwantner2018-06-221-3/+3
|
* mpmc_ptr_ring: use atomic_try_cmpxchg()Thomas Gschwantner2018-06-223-12/+37
|
* mpmc_ptr_ring: Fix a wordJonathan Neuschäfer2018-06-221-1/+1
| | | | Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
* selftest/mpmc_ring: Add more __init/__initdata annotationsJonathan Neuschäfer2018-06-221-3/+3
| | | | | The main function, mpmc_ring_selftest, is already marked with __init, but the callback functions and the ring pointer were not.
* selftest/mpmc_ring: Remove const qualifier from mpmc_ptr_ring_produce argumentJonathan Neuschäfer2018-06-221-1/+1
| | | | | | | | | | | mpmc_ptr_ring_produce takes a void*. This fixes the following warning: net/wireguard/selftest/mpmc_ring.h: In function ‘producer_function’: net/wireguard/selftest/mpmc_ring.h:43:38: warning: passing argument 2 of ‘mpmc_ptr_ring_produce’ disc] while (mpmc_ptr_ring_produce(ring, (const void *) count)) ^
* mpmc_ptr_ring: Include all necessary headersJonathan Neuschäfer2018-06-221-0/+11
| | | | | | | | | | | | | | | | | | | | mpmc_ptr_ring.h should include the headers that it needs explicitly. This commit adds the following: - <asm/barrier.h>: smp_rmb, smp_wmb, smp_mb__before_atomic - <linux/atomic.h>: atomic_t, atomic_read, atomic_set, atomic_cmpxchg, atomic_inc - <linux/cache.h>: ____cacheline_aligned_in_smp - <linux/compiler.h>: READ_ONCE, WRITE_ONCE - <linux/errno.h>: ENOMEM - <linux/log2.h>: is_power_of_2 - <linux/processor.h>: cpu_relax - <linux/slab.h>: kcalloc, kfree - <linux/stddef.h>: NULL I'm not sure if all of them are really needed because I wasn't about to provoke a compile error due to the missing includes. Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
* mpmc_ptr_ring: Fix some style detailsJonathan Neuschäfer2018-06-222-1/+2
|
* mpmc_ptr_ring: add selftestThomas Gschwantner2018-06-224-1/+125
|
* mpmc_ptr_ring: calculate mask once and store itThomas Gschwantner2018-06-221-3/+5
|
* mpmc_ptr_ring: use unsigned int instead of size_tThomas Gschwantner2018-06-221-10/+10
| | | | | | | | For producers/consumers we use atomic_t which is really int, so size_t could either be too large, wasting memory, or too small (unlikely). For size, we also want to be using unsigned int, since the mask that we derive from it is ANDed with producer/consumer.
* mpmc_ptr_ring: add include guardThomas Gschwantner2018-06-221-0/+6
|
* mpmc_ptr_ring: Switch to smp_[rw]mb()Jonathan Neuschäfer2018-06-221-8/+8
| | | | | | | | | | | | | | From https://www.kernel.org/doc/Documentation/memory-barriers.txt: > SMP memory barriers are reduced to compiler barriers on uniprocessor > compiled systems because it is assumed that a CPU will appear to be > self-consistent, and will order overlapping accesses correctly with > respect to itself. Since we only order CPU memory accesses with the memory barriers in mpmc_ptr_ring.h, smp_[rw]mb() should be sufficient. Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
* messages: Ensure that there are more queue slots than CPUsJonathan Neuschäfer2018-06-222-1/+9
| | | | | | | I'm not completely sure about this. It also doesn't fix all the errors: sometimes the test suite reports that it fails to send packets.
* mpmc_ptr_ring: Place producer_head and producer_tail in the same cachelineJonathan Neuschäfer2018-06-221-5/+3
| | | | | They are updated together, so it doesn't make much sense to keep them separate in the cache.
* mpmc_ptr_ring: Use atomic_t instead of atomic_long_tJonathan Neuschäfer2018-06-221-20/+20
| | | | The index range doesn't get large enough to warrant 64-bit indices.
* mpmc_ptr_ring: Eliminate false sharing in struct mpmc_ptr_ringJonathan Neuschäfer2018-06-221-3/+3
|
* mpmc_ptr_ring: Reduce the memory barrier usageJonathan Neuschäfer2018-06-221-26/+22
|
* mpmc_ptr_ring: Fix the remaining crashJonathan Neuschäfer2018-06-221-2/+2
|
* [WIP] Implement a lock-free MPMC ring bufferJonathan Neuschäfer2018-06-226-13/+225
| | | | | | | | TODO: actually use the right memory barriers in the right places TODO: eliminate false sharing between mpmc_ptr_ring members TODO: reconsider atomic_long_t vs. atomic_t, vs. the type of size in _init() TODO: sprinkle likely/unlikely on some branches FIXME: it still crashes
* tools: fix misspelling of strchrnul in commentJonathan Neuschäfer2018-06-221-1/+1
| | | | Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
* manpages: eliminate whitespace at the end of the lineJonathan Neuschäfer2018-06-222-26/+26
| | | | | | This eliminates a few style warnings from "mandoc -T lint src/tools/wg*.8". Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
* global: fix a few typosJonathan Neuschäfer2018-06-222-2/+2
| | | | Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
* simd: add missing headerJason A. Donenfeld2018-06-221-0/+1
| | | | Suggested-by: Shlomi Steinberg <shlomi@shlomisteinberg.com>
* poly1305: give linker the correct constant data section sizeJason A. Donenfeld2018-06-221-1/+1
| | | | | | Otherwise these constants will be merged wrong or excluded, and we'll wind up with wrong calculations. While bfd (the normal kernel linker) doesn't seem to mind, recent versions of gold do bad things.
* main: test poly1305 before chacha20poly1305Jason A. Donenfeld2018-06-221-1/+1
| | | | | | Since chacha20poly1305 relies on the correctness of poly1305, it's useful to have a failing poly1305 test first, to better pinpoint what's happening.
* receive: don't toggle bhJason A. Donenfeld2018-06-221-6/+0
| | | | | | | This had a bad performance impact. We'll probably need to revisit this later, but for now, let's not introduce a regression. Reported-by: Lonnie Abelbeck <lonnie@abelbeck.com>
* version: bump snapshot0.0.20180620Jason A. Donenfeld2018-06-202-2/+2
|
* poly1305: add missing string.h headerJason A. Donenfeld2018-06-201-0/+1
| | | | Reported-by: Peter Korsgaard <peter@korsgaard.com>
* compat: use stabler lkml linksJason A. Donenfeld2018-06-191-2/+2
| | | | | | This will redirect to whichever archive kernel.org thinks is best. Suggested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
* ratelimiter: do not allow concurrent init and uninitJason A. Donenfeld2018-06-191-0/+6
|
* ratelimiter: mitigate reference underflowJason A. Donenfeld2018-06-192-1/+3
|
* receive: drop handshake packets if rng is not initializedJason A. Donenfeld2018-06-192-2/+55
| | | | Otherwise it's too easy to trigger cookie reply messages.
* noise: wait for crng before taking locksJason A. Donenfeld2018-06-181-0/+10
| | | | | | | Otherwise, get_random_bytes_wait gets called from curve25519_generate_secret, and at the same time, a user might use the wg(8) utility, which then wants to grab a read lock for what we're write locking.
* netlink: maintain static_identity lock over entire private key updateJason A. Donenfeld2018-06-183-6/+5
| | | | | We don't want the local private key to not correspond with a precomputed ss or precomputed cookie hash at any intermediate point.
* noise: take locks for ss precomputationJason A. Donenfeld2018-06-181-3/+9
| | | | | | | Usually this is called from handshake_init, where locking doesn't matter because nothing references it yet, but it's also called when changing the device private key, so it's probably a good thing to not process a handshake with a ss precomputation that's part old and part new.
* qemu: bump default kernelJason A. Donenfeld2018-06-171-1/+1
|
* wg-quick: android: don't forget to free compiled regexesJason A. Donenfeld2018-06-171-5/+6
|
* wg-quick: android: disable roaming to v6 networks when v4 is specifiedJason A. Donenfeld2018-06-171-1/+54
| | | | This works around an unfortunate bug in 464XLAT transitions.
* dns-hatchet: apply resolv.conf's selinux context to new resolv.confJason A. Donenfeld2018-06-171-0/+2
|
* simd: no need to restore fpu state when no preemptionJason A. Donenfeld2018-06-171-0/+2
|
* simd: encapsulate fpu amortization into nice functionsJason A. Donenfeld2018-06-177-71/+83
|
* queueing: re-enable preemption periodically to lower latencyJason A. Donenfeld2018-06-162-0/+18
|
* queueing: remove useless spinlocks on scJason A. Donenfeld2018-06-163-5/+1
| | | | Since these are the only consumers, there's no need for locking.
* tools: getentropy requires 10.12Jason A. Donenfeld2018-06-141-1/+7
|
* chacha20poly1305: use slow crypto on -rt kernels on arm tooJason A. Donenfeld2018-06-141-1/+1
|
* version: bump snapshot0.0.20180613Jason A. Donenfeld2018-06-132-2/+2
|
* chacha20poly1305: use slow crypto on -rt kernelsJason A. Donenfeld2018-06-131-1/+1
| | | | | | | | | | | | | | In rt kernels, spinlocks call schedule(), which means preemption can't be disabled. The FPU disables preemption. Hence, we can either restructure things to move the calls to kernel_fpu_begin/end to be really close to the actual crypto routines, or we can do the slower lazier solution of just not using the FPU at all on -rt kernels. This patch goes with the latter lazy solution. The reason why we don't place the calls to kernel_fpu_begin/end close to the crypto routines in the first place is that they're very expensive, as it usually involves a call to XSAVE. So on sane kernels, we benefit from only having to call it once.