summaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | tor-netdoc: Remove redundant `IntroPointDesc` struct.Gabriela Moldovan2023-08-233-33/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit replaces `tor_netdoc::hsdesc::inner::IntroPointDesc` with the (almost identical) `tor_netdoc::hsdesc::IntroPointDesc`. The only difference between the two structs is that `inner::IntroPointDesc` wraps a `Vec<LinkSpec>` instead of a `Vec<EncodedLinkSpec>`. Since `EncodedLinkSpec` can be derived from `LinkSpec` (and vice-versa), and since `hsdesc::inner::IntroPointDesc` never made it in our public API, this commit also removes `hsdesc::inner::IntroPointDesc` in favour of `hsdesc::IntroPointDesc`.
* | | | | ipt establisher API: pass a struct to new() (fmt)Ian Jackson2023-08-231-6/+2
| | | | | | | | | | | | | | | | | | | | One of rustfmt's changes here is wrong. Whatever.
* | | | | ipt establisher API: pass a struct to new()Ian Jackson2023-08-232-20/+47
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now new() only has a reasonable number of arguments and removes some repetition in the mocking arrangements in the IPT Manager. This is the minimum amount that needs to be done in the commit that touches both the IPT Establisher and the Manager.
* | | | Merge branch 'hashx-bench' into 'main'Ian Jackson2023-08-231-38/+63
|\ \ \ \ | | |_|/ | |/| | | | | | | | | | hashx_cachegrind: factor out some common stuff in benchmarks See merge request tpo/core/arti!1529
| * | | hashx_cachegrind: Fix black_box locationIan Jackson2023-08-231-2/+2
| | | |
| * | | hashx_cachegrind: Make mk_c_equix not shuffle the HashXIan Jackson2023-08-231-8/+8
| | | |
| * | | hashx_cachegrind: Make mk_rust not shuffle the HashXBuilderIan Jackson2023-08-231-10/+9
| | | |
| * | | hashx_cachegrind: Introduce C_HASHX_OK aliasIan Jackson2023-08-231-2/+5
| | | |
| * | | hashx_cachegrind: Introduce bench_loop helper macroIan Jackson2023-08-231-24/+29
| | | | | | | | | | | | | | | | | | | | The macro generates similar but not identical code. There are new bindings.
| * | | hashx_cachegrind: Introduce u32be helper functionIan Jackson2023-08-231-4/+11
| | | | | | | | | | | | | | | | This is going to be more obviously useful in a moment.
| * | | hashx_cachegrind: Introduce mk_c_equix helper macroIan Jackson2023-08-231-4/+9
| | | | | | | | | | | | | | | | The macro generates precisely the existing code.
| * | | hashx_cachegrind: Introduce mk_rust helper macroIan Jackson2023-08-231-8/+14
| | |/ | |/| | | | | | | The macro generates precisely the existing code.
* | | Merge branch 'ipt-m' into 'main'Ian Jackson2023-08-2310-6/+1470
|\ \ \ | |/ / |/| | | | | | | | About half of an IPT Manager See merge request tpo/core/arti!1523
| * | tor-hsservice: Add a TODO for breaking up the big functionIan Jackson2023-08-231-0/+2
| | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1523#note_2934367
| * | tor-hsservice: timeout_track: Add some TODOsIan Jackson2023-08-231-0/+3
| | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1523#note_2934299
| * | tor-hsservice: ipt-m: Add a TODO about code motionIan Jackson2023-08-231-0/+2
| | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1523#note_2934300
| * | tor-hsservice: ipt-m: tests: Fix wrong commentIan Jackson2023-08-231-1/+1
| | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1523#note_2934298
| * | Fix doc formatting.gabi-2502023-08-231-1/+1
| | |
| * | tor-hsservice: About half of an IPT ManagerIan Jackson2023-08-235-2/+799
| | | | | | | | | | | | There are many TODOs and no tests, but it does compile.
| * | tor-hsservice: Expose the ipt_establish and publish modulesIan Jackson2023-08-231-2/+2
| | | | | | | | | | | | | | | | | | I still think putting these in svc/ module doesn't make much sense. Anyway, we can leave them there for now, but I need to get at them from crate::ipt_establisher.
| * | tor-hsservice: Provide timeout tracking utilities - testsIan Jackson2023-08-232-2/+201
| | |
| * | tor-hsservice: Provide timeout tracking utilitiesIan Jackson2023-08-233-0/+434
| | | | | | | | | | | | | | | This module is perhaps rather more comprehensive than needed right now. But I found I kept wanting to change which bits of it I used.
| * | tor-rtmock: Relax Sync bound on spawned tasks in MockExecutorIan Jackson2023-08-232-2/+3
| | | | | | | | | | | | | | | Sync is actually otiose - and I'm about to have some test cases with futures that aren't Sync.
| * | tor-rtmock: Expose time_until_next_timeout on MockRuntimeIan Jackson2023-08-232-0/+26
| | |
* | | Merge branch 'hashx_perf' into 'main'Ian Jackson2023-08-2310-389/+388
|\ \ \ | |/ / |/| | | | | | | | hashx: Performance improvements for program generation See merge request tpo/core/arti!1524
| * | hashx: Use a boxed slice for Program storageMicah Elizabeth Scott2023-08-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a very small change that converts our Vec cheaply into a boxed slice during program generation. Program generation speed shows no changes, and there's no change when using compiled hashes, but is a surprisingly effective 10% speedup to interpreted hash execution. Signed-off-by: Micah Elizabeth Scott <[email protected]>
| * | hashx: Assembly buffer sizing and tidyingMicah Elizabeth Scott2023-08-213-34/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I was looking for ways to optimize out the many redundant capacity checks in the Assembler. I didn't find any promising approaches, but I also saw no evidence that it was an important bottleneck. (A simple unsafe fix didn't improve any important metrics) While I was in there, I tightened up the buffer size definitions for both x86_64 and aarch64, and added assertions to test the limits we set for the size of prologue, epilogue, and single instructions. I kept some of the inlining and data type tweaks, even though benchmarks show no difference. They seem like a step in the right direction, from the disassembly at least. Signed-off-by: Micah Elizabeth Scott <[email protected]>
| * | hashx: avoid surprising overhead of enum code() methodMicah Elizabeth Scott2023-08-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a very simple change that avoids a surprising performance pitfall: using the code() method on an enum from another crate caused a non-inlined function call in code where we otherwise expect a high level of compiler optimization. Replacing code() with a cast to u8 avoids this function call and allows more intensive optimization at the call site. Signed-off-by: Micah Elizabeth Scott <[email protected]>
| * | hashx: Rearrange destination register validator for performanceMicah Elizabeth Scott2023-08-212-12/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This hoists a few decisions out of the innermost portions of choose_dst_reg, by moving what we can out of dst_register_allowed. Wallclock time benchmarks: generate-interp improves, -6.0% Cachegrind benchmarks: generate_interp_1000x, -5.0% instructions, -11.6% L2 access, -6% RAM Signed-off-by: Micah Elizabeth Scott <[email protected]>
| * | hashx: New approach to avoid memcpy in ProgramMicah Elizabeth Scott2023-08-217-63/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I was trying to eliminate all the places where we copied a Program (about 4100 bytes) except for the one final copy into a Box; but that approach was proving too annoying. Even returning a Program via Result will cause multiple unnecessary copies that don't optimize out. This patch switches approaches, and instead allocates a Vec<Instruction> presized to the correct capacity. This allocation is made as early as possible and retained for the lifetime of the program if necessary. This means we'll never avoid a heap allocation, but we can always avoid extra copies and we don't need a separate Box for interpreted programs. Performance effects are subtle. Overall wallclock time doesn't change much. Cachegrind shows some accesses moving up from RAM to L2 cache. Using GDB to probe memcpy sizes shows that large (>1024b) memcpy are now totally gone in the generate-interp test. Signed-off-by: Micah Elizabeth Scott <[email protected]>
| * | hashx: Rewrite RegisterSet again to reduce CPU frontend stallsMicah Elizabeth Scott2023-08-216-210/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closer inspection of the CPU counters showed that the branching in RegisterSet::index() was a big problem, contributing to the overall CPU frontend stall bottleneck in program generation. This new version is less general, and closer to the appraoch used by the original C implementation. We store a sorted ArrayVec of in-set registers, and most operations construct the RegisterSet only once using a combined filter predicate. Choosing a register from a set is now cheaper in branches, instructions, and L1 cache space. We now very rarely manipulate an entire RegisterSet in any way other than by selecting a register randomly. (Just for the register R5 special case.) Wallclock time benchmarks: generate-interp improves, -7.0% generate-x86_64 improves, -7.2% Cachegrind benchmarks: generate_interp_1000x, more total instructions run but a large decrease in frontend cache misses. +4.6% instructions, +11% L1 accesses, -99% L2 access, -40% RAM access. generate_compiled_100x, +4.0% instructions, +9.4% L1 access. cache miss improvements: -57% L2 access, -25% RAM access. Signed-off-by: Micah Elizabeth Scott <[email protected]>
| * | hashx: new RegisterWriter format handles more cases transparentlyMicah Elizabeth Scott2023-08-213-99/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a special case in writer_pair_allowed for making add and subtract equivalent. This patch changes RegisterWriter's encoding, using per-opcode variants instead of per-format variants. The Add/Sub merge can now happen earlier, when RegisterWriter is constructed. Before and after RegisterWriter sizes are the same, at 8 bytes. This patch removes many uses of Option<RegisterWriter> in favor of using a new RegisterWriter::None default, and passes by value rather than by reference. Wallclock time benchmarks: generate-interp improves, -7.5% generate-x86_64 improves, -5.3% Cachegrind benchmarks: generate_interp_1000x, negligible change in total instructions, improvement in cache footprint: -22.8% L2 accesses Signed-off-by: Micah Elizabeth Scott <[email protected]>
* | | arti-client: Fix a couple more typos.Nick Mathewson2023-08-222-2/+2
| | | | | | | | | | | | I spotted these while I was working on something else.
* | | Use "typos-cli" to fix a bunch of typos.Nick Mathewson2023-08-224-4/+4
| | |
* | | arti::cfg tests: Use fold to make nightly clippy happierNick Mathewson2023-08-221-4/+5
| | |
* | | Resolve a pair of warnings about redundant closures.Nick Mathewson2023-08-222-3/+3
| | |
* | | Merge branch 'netdir-todo-2-take-2' into 'main'gabi-2502023-08-223-6/+186
|\ \ \ | | | | | | | | | | | | | | | | tor-netdir: Add separate functions for computing hsdirs for upload/download. See merge request tpo/core/arti!1518
| * | | tor-netdir: Use an owned HsBlindId instead of a reference.Gabriela Moldovan2023-08-222-5/+5
| | | | | | | | | | | | | | | | `HsBlindId` is `Copy`.
| * | | tor-netdir: Replace flat_map() with cartesian_product().Gabriela Moldovan2023-08-221-7/+2
| | | |
| * | | tor-netdir: Make `hs_dirs_upload` take an iterator instead of a slice (fmt).Gabriela Moldovan2023-08-221-4/+6
| | | |
| * | | tor-netdir: Make `hs_dirs_upload` take an iterator instead of a slice.Gabriela Moldovan2023-08-221-7/+10
| | | |
| * | | tor-netdir: Add TODO about making HsDirOp private.Gabriela Moldovan2023-08-221-0/+3
| | | | | | | | | | | | | | | | When `hs_dirs` is removed this won't n't need to be public anymore.
| * | | tor-hsclient: Use hs_dirs_download instead of the deprecated hs_dirs.Gabriela Moldovan2023-08-222-7/+6
| | | |
| * | | tor-netdir: Deprecate hs_dirs().Gabriela Moldovan2023-08-222-0/+3
| | | |
| * | | tor-netdir: Add separate functions for computing hsdirs for upload/download.Gabriela Moldovan2023-08-222-0/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hsdir selection algorithm for uploads and downloads is different enough to justify splitting `hs_dirs` into 2 different functions. More specifically, when selecting the relays to upload a service's descriptors to, the service's `hsids` need to be matched up with the correct `ring` (using the time period) before applying `select_nodes` to pick the replicas. This is not the case when downloading, because for downloads select relays from the current ring.
| * | | tor-netdir: Add private helpers for selecting hsdirs.Gabriela Moldovan2023-08-221-0/+72
| | |/ | |/| | | | | | | | | | | | | These will become useful when we split `hs_dirs()` into 2 separate functions (one for uploading/services, and another for downloading/clients).
* | | hss: Improve comments in IptEstablisher::drop.Nick Mathewson2023-08-221-2/+8
| | |
* | | hss: Allow IptEstablisher to start in Advertised mode.Nick Mathewson2023-08-221-18/+20
| | |
* | | hss: switch to select_biasedNick Mathewson2023-08-221-1/+1
| | |
* | | hss: change terminate oneshot to send "void".Nick Mathewson2023-08-222-7/+10
| | | | | | | | | | | | We don't actually want to distinguish drop from not-drop.