lkml.org 
[lkml]   [2005]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] pci: Block config access during BIST (resend)
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?

> Granted, for the specific usage scenario in ipr, where I am using this
> to block config space over BIST, I use a pci config write to start BIST,
> which would end up being a point of synchronization, but that seems a
> bit non-obvious and limits how the patch can be used by others...

Yes, agreed.

grant
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-09-03 21:36    [W:0.119 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site