Grant Grundler wrote: > On Sat, Sep 03, 2005 at 06:37:52PM -0500, Brian King wrote: > ... > >>Without the locking, we introduce a race condition. >> >>CPU 0 CPU 1 >> >> pci_block_user_cfg_access >> pci_save_state >>pci_read_user_config_space >> check block_ucfg_access >> set block_ucfg_access >> other code that puts the device >> in a state such that it cannot >> handle read config i/o, such as >> running BIST. >> >> pci read config > > > Ok this is good example - I see what the problem is. > You could use the following sequence too then: > pci_block_user_cfg_access > pci_save_state > block_ucfg_access = 1 > mb() > while (spin_is_locked(&pci_lock)) > relax_cpu(); > > Think this is sufficient? That should work also. Here is an updated patch. -- Brian King eServer Storage I/O IBM Linux Technology Center