[tor-bugs] #7572 [Tor]: Make relay crypto run on multiple CPU cores

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Dec 2 03:25:39 UTC 2015


#7572: Make relay crypto run on multiple CPU cores
-----------------------+------------------------------
 Reporter:  nickm      |          Owner:  andrea
     Type:  defect     |         Status:  new
 Priority:  High       |      Milestone:  Tor: 0.2.???
Component:  Tor        |        Version:
 Severity:  Normal     |     Resolution:
 Keywords:  tor-relay  |  Actual Points:
Parent ID:  #1749      |         Points:
  Sponsor:             |
-----------------------+------------------------------
Changes (by jsturgix):

 * severity:   => Normal


Comment:

 I attempted to partially address this ticket, but could use additional
 insight from someone more experienced with Tor.  I am learning the Tor
 daemon code, but I understand the cell crypto is done (primarily) in
 relay_crypt() for middle relays and circuit_package_relay_cell() for exit
 relays.  My changes ONLY address the relay_crypt() case.  I realize my
 code is not up to Tor project coding standards, but so far, I've been
 focused on learning the Tor code base and trying to get this to work.

 I've been developing and testing on Linux and branched from
 tags/tor-0.2.7.5.  My github branch can be found here:
 https://github.com/sturgix/tor/tree/tor-0.2.7.5-multithreaded

 In general, I refactored circuit_receive_relay_cell() in relay.c
 (which calls relay_crypt() and eventually the AES crypt routines) to use
 the workqueue.c infrastructure similar to cpuworker.c.

 When the refactored code runs in single threaded mode, all seems good in
 limited tests.  Once I activate the thread pool and start sending it work
 with threadpool_queue_work(), it Bootstraps 100% okay and runs for several
 minutes before crashing on cells it doesn't handle properly.  It seems to
 pass several cells successfully, but then crashes on the bandwidth
 test(?).

 In my branch, commit 842edc9 shows my refactored, single threaded version.
 Commit 940d1bd
  shows my attempt at pushing relay_crypt() into a thread pool of 1.

 In a separate post, I'll write up some explanations of what I was trying
 to do.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7572#comment:10>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list