• Jens Axboe's avatar
    lib/percpu_counter.c: fix bad percpu counter state during suspend · 743660fd
    Jens Axboe authored
    commit e39435ce upstream.
    
    I got a bug report yesterday from Laszlo Ersek in which he states that
    his kvm instance fails to suspend.  Laszlo bisected it down to this
    commit 1cf7e9c6 ("virtio_blk: blk-mq support") where virtio-blk is
    converted to use the blk-mq infrastructure.
    
    After digging a bit, it became clear that the issue was with the queue
    drain.  blk-mq tracks queue usage in a percpu counter, which is
    incremented on request alloc and decremented when the request is freed.
    The initial hunt was for an inconsistency in blk-mq, but everything
    seemed fine.  In fact, the counter only returned crazy values when
    suspend was in progress.
    
    When a CPU is unplugged, the percpu counters merges that CPU state with
    the general state.  blk-mq takes care to register a hotcpu notifier with
    the appropriate priority, so we know it runs after the percpu counter
    notifier.  However, the percpu counter notifier only merg...
    743660fd
percpu_counter.c 5.13 KB