• Andrew Morton's avatar
    [PATCH] random: SMP locking · fbf6dda7
    Andrew Morton authored
    From: Oliver Xymoron <oxymoron@waste.org>
    
    This patch adds locking for SMP. Apparently Willy never managed to
    revive his laptop with his version so I revived mine.
    
    The batch pool is copied as a block to avoid long lock hold times
    while mixing it into the primary pool. 
    
    Two locks are added:
    
    gobal batch_lock
       batch_entropy_store can be called from any context, and typically from
       interrupts -> spin_lock_irqsave
    
       batch_entropy_process is called called via schedule_delayed_work and
       runs in process context -> spin_lock_irq
    
    entropy_store.lock
       the mixing process is too expensive to be called from an interrupt
       context and the basic worker function extract_entropy can sleep, so
       all this stuff can be under a normal spin_lock
    fbf6dda7
random.c 72.3 KB