* [PATCH]PCIE AER: PCI access remove spinlock protection in aer_inject
@ 2010-01-28 16:34 Youquan,Song
2010-01-29 0:13 ` Andrew Patterson
0 siblings, 1 reply; 2+ messages in thread
From: Youquan,Song @ 2010-01-28 16:34 UTC (permalink / raw)
To: jbarnes; +Cc: andi, ying.huang, youquan.song, linux-kernel, linux-pci
Move the PCI configuration access code out of the spin_lock protection because
pci_read_aer already includes spin_lock protection which will replace the PCI
access method if have aer error injected.
Signed-off-by: Youquan, Song <youquan.song@intel.com>
---
diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
index 8c30a95..953a0b9 100644
--- a/drivers/pci/pcie/aer/aer_inject.c
+++ b/drivers/pci/pcie/aer/aer_inject.c
@@ -357,6 +357,22 @@ static int aer_inject(struct aer_error_inj *einj)
goto out_put;
}
+ pci_read_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK, &mask);
+ if (einj->cor_status && !(einj->cor_status & ~mask)) {
+ ret = -EINVAL;
+ printk(KERN_WARNING "The correctable error(s) is masked "
+ "by device\n");
+ goto out_put;
+ }
+
+ pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK, &mask);
+ if (einj->uncor_status && !(einj->uncor_status & ~mask)) {
+ ret = -EINVAL;
+ printk(KERN_WARNING "The uncorrectable error(s) is masked "
+ "by device\n");
+ goto out_put;
+ }
+
spin_lock_irqsave(&inject_lock, flags);
err = __find_aer_error_by_dev(dev);
@@ -374,24 +390,6 @@ static int aer_inject(struct aer_error_inj *einj)
err->header_log2 = einj->header_log2;
err->header_log3 = einj->header_log3;
- pci_read_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK, &mask);
- if (einj->cor_status && !(einj->cor_status & ~mask)) {
- ret = -EINVAL;
- printk(KERN_WARNING "The correctable error(s) is masked "
- "by device\n");
- spin_unlock_irqrestore(&inject_lock, flags);
- goto out_put;
- }
-
- pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK, &mask);
- if (einj->uncor_status && !(einj->uncor_status & ~mask)) {
- ret = -EINVAL;
- printk(KERN_WARNING "The uncorrectable error(s) is masked "
- "by device\n");
- spin_unlock_irqrestore(&inject_lock, flags);
- goto out_put;
- }
-
rperr = __find_aer_error_by_dev(rpdev);
if (!rperr) {
rperr = rperr_alloc;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH]PCIE AER: PCI access remove spinlock protection in aer_inject
2010-01-28 16:34 [PATCH]PCIE AER: PCI access remove spinlock protection in aer_inject Youquan,Song
@ 2010-01-29 0:13 ` Andrew Patterson
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Patterson @ 2010-01-29 0:13 UTC (permalink / raw)
To: Youquan,Song
Cc: jbarnes, andi, ying.huang, youquan.song, linux-kernel, linux-pci
On Thu, 2010-01-28 at 11:34 -0500, Youquan,Song wrote:
> Move the PCI configuration access code out of the spin_lock protection because
> pci_read_aer already includes spin_lock protection which will replace the PCI
> access method if have aer error injected.
>
> Signed-off-by: Youquan, Song <youquan.song@intel.com>
> ---
>
I posted a similar patch on the linux-pci mailing list -- details at:
http://www.spinics.net/lists/linux-pci/msg07609.html
This version has already been accepted in the linux-pci tree. I should
have cc'd lkml.
Andrew
>
> diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
> index 8c30a95..953a0b9 100644
> --- a/drivers/pci/pcie/aer/aer_inject.c
> +++ b/drivers/pci/pcie/aer/aer_inject.c
> @@ -357,6 +357,22 @@ static int aer_inject(struct aer_error_inj *einj)
> goto out_put;
> }
>
> + pci_read_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK, &mask);
> + if (einj->cor_status && !(einj->cor_status & ~mask)) {
> + ret = -EINVAL;
> + printk(KERN_WARNING "The correctable error(s) is masked "
> + "by device\n");
> + goto out_put;
> + }
> +
> + pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK, &mask);
> + if (einj->uncor_status && !(einj->uncor_status & ~mask)) {
> + ret = -EINVAL;
> + printk(KERN_WARNING "The uncorrectable error(s) is masked "
> + "by device\n");
> + goto out_put;
> + }
> +
> spin_lock_irqsave(&inject_lock, flags);
>
> err = __find_aer_error_by_dev(dev);
> @@ -374,24 +390,6 @@ static int aer_inject(struct aer_error_inj *einj)
> err->header_log2 = einj->header_log2;
> err->header_log3 = einj->header_log3;
>
> - pci_read_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK, &mask);
> - if (einj->cor_status && !(einj->cor_status & ~mask)) {
> - ret = -EINVAL;
> - printk(KERN_WARNING "The correctable error(s) is masked "
> - "by device\n");
> - spin_unlock_irqrestore(&inject_lock, flags);
> - goto out_put;
> - }
> -
> - pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK, &mask);
> - if (einj->uncor_status && !(einj->uncor_status & ~mask)) {
> - ret = -EINVAL;
> - printk(KERN_WARNING "The uncorrectable error(s) is masked "
> - "by device\n");
> - spin_unlock_irqrestore(&inject_lock, flags);
> - goto out_put;
> - }
> -
> rperr = __find_aer_error_by_dev(rpdev);
> if (!rperr) {
> rperr = rperr_alloc;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Andrew Patterson
Hewlett-Packard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-29 0:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-28 16:34 [PATCH]PCIE AER: PCI access remove spinlock protection in aer_inject Youquan,Song
2010-01-29 0:13 ` Andrew Patterson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox