Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys/dev/pci



Module Name:    src
Committed By:   knakahara
Date:           Fri Feb 17 11:57:26 UTC 2017

Modified Files:
        src/sys/dev/pci: if_wm.c

Log Message:
rxq_ptr must be updated holding rxq_lock consistent with the Rx processing.

In previous implementation, wm_rxeof() temporarily unlock rxq->rxq_lock to
call if_percpuq_enqueue(), and then re-lock rxq->rxq_lock to update
rxq->rxq_ptr. So, if multiple CPUs share the same rxq, there is race e.g.
    - CPU A: lock rxq->rxq_lock
    - CPU A: Rx processing include increment local variable "i"
    - CPU A: unlock rxq->rxq_lock
    - CPU A: call if_percpuq_enqueue()
    - CPU B: lock rxq->rxq_lock
    - CPU B: Rx processing include increment local variable "i"
    - CPU B: unlock rxq->rxq_lock
    - CPU B: call if_percpuq_enqueue()
    - CPU B: lock rxq->rxq_lock
    - CPU B: update rxq->rxq_ptr, that is, set CPU B's local "i" to rxq->rxq_ptr
    - CPU B: unlock rxq->rxq_lock
    - CPU A: lock rxq->rxq_lock
    - CPU A: update rxq->rxq_ptr, that is, set CPU A's local "i" to rxq->rxq_ptr
    - CPU A: unlock rxq->rxq_lock


To generate a diff of this commit:
cvs rdiff -u -r1.482 -r1.483 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index