public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]PCIe AER: reject aer inject if hardware mask error reporting
@ 2009-12-11 23:48 Youquan,Song
  2009-12-15  0:29 ` Andrew Patterson
  0 siblings, 1 reply; 6+ messages in thread
From: Youquan,Song @ 2009-12-11 23:48 UTC (permalink / raw)
  To: jbarnes; +Cc: andi, ying.huang, kent.liu, youquan.song, linux-kernel, linux-pci

Correcteable/Uncorrectable Error Mask Register are used by PCIe AER driver 
which will controls the reporting of idividual errors to PCIe RC via PCIe
error messages. 

If hardware masks special error reporting to RC, the aer_inject driver should
 not inject aer error.

Signed-off-by: Youquan, Song <youquan.song@intel.com>
Acked-by: Ying, Huang <ying.huang@intel.com>
---

diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
index ad77f0c..fa2bc22 100644
--- a/drivers/pci/pcie/aer/aer_inject.c
+++ b/drivers/pci/pcie/aer/aer_inject.c
@@ -302,7 +302,7 @@ static int aer_inject(struct aer_error_inj *einj)
 	unsigned long flags;
 	unsigned int devfn = PCI_DEVFN(einj->dev, einj->fn);
 	int pos_cap_err, rp_pos_cap_err;
-	u32 sever;
+	u32 sever, mask;
 	int ret = 0;
 
 	dev = pci_get_bus_and_slot(einj->bus, devfn);
@@ -354,6 +354,22 @@ 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 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 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] 6+ messages in thread

* Re: [PATCH]PCIe AER: reject aer inject if hardware mask error reporting
  2009-12-11 23:48 [PATCH]PCIe AER: reject aer inject if hardware mask error reporting Youquan,Song
@ 2009-12-15  0:29 ` Andrew Patterson
  2009-12-17 13:22   ` [Resend PATCH]PCIe " Youquan,Song
  2009-12-17 13:34   ` [PATCH]PCIe " Youquan,Song
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Patterson @ 2009-12-15  0:29 UTC (permalink / raw)
  To: Youquan,Song
  Cc: jbarnes, andi, ying.huang, kent.liu, youquan.song, linux-kernel,
	linux-pci

On Fri, 2009-12-11 at 18:48 -0500, Youquan,Song wrote:
> Correcteable/Uncorrectable Error Mask Register are used by PCIe AER driver 
> which will controls the reporting of idividual errors to PCIe RC via PCIe
> error messages. 
> 
> If hardware masks special error reporting to RC, the aer_inject driver should
>  not inject aer error.
> 
> Signed-off-by: Youquan, Song <youquan.song@intel.com>
> Acked-by: Ying, Huang <ying.huang@intel.com>
> ---
> 
> diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
> index ad77f0c..fa2bc22 100644
> --- a/drivers/pci/pcie/aer/aer_inject.c
> +++ b/drivers/pci/pcie/aer/aer_inject.c
> @@ -302,7 +302,7 @@ static int aer_inject(struct aer_error_inj *einj)
>  	unsigned long flags;
>  	unsigned int devfn = PCI_DEVFN(einj->dev, einj->fn);
>  	int pos_cap_err, rp_pos_cap_err;
> -	u32 sever;
> +	u32 sever, mask;
>  	int ret = 0;
>  
>  	dev = pci_get_bus_and_slot(einj->bus, devfn);

This does not apply.  Please respin against latest linux-2.6 or pci-2.6.

> @@ -354,6 +354,22 @@ 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 is masked by device\n");

You can inject multiple correctable errors with the aer-inject user-land
tool, so perhaps this should be re-worded as:

"The correctable error(s) are masked by the 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 is masked by device\n");

Same as above

> +		spin_unlock_irqrestore(&inject_lock, flags);
> +		goto out_put;
> +	}
> +

You can also simultaneously inject correctable and uncorrectable errors,
so I don't particularly like returning errors here.  Perhaps you should
just print the warning message out and just not inject the masked
errors.

>  	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] 6+ messages in thread

* Re: [Resend PATCH]PCIe AER: reject aer inject if hardware mask error reporting
  2009-12-17 13:22   ` [Resend PATCH]PCIe " Youquan,Song
@ 2009-12-17  8:43     ` Andi Kleen
  2010-01-04 23:53     ` Jesse Barnes
  1 sibling, 0 replies; 6+ messages in thread
From: Andi Kleen @ 2009-12-17  8:43 UTC (permalink / raw)
  To: Youquan,Song
  Cc: jbarnes, andrew.patterson, andi, ying.huang, kent.liu,
	youquan.song, linux-kernel, linux-pci

On Thu, Dec 17, 2009 at 08:22:48AM -0500, Youquan,Song wrote:
> Correcteable/Uncorrectable Error Mask Register are used by PCIe AER driver 
> which will controls the reporting of idividual errors to PCIe RC via PCIe
> error messages. 
> 
> If hardware masks special error reporting to RC, the aer_inject driver should
>  not inject aer error.
> 
> Signed-off-by: Youquan, Song <youquan.song@intel.com>
> Acked-by: Ying, Huang <ying.huang@intel.com>

Acked-by: Andi Kleen <ak@linux.intel.com>

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Resend PATCH]PCIe AER: reject aer inject if hardware mask error reporting
  2009-12-15  0:29 ` Andrew Patterson
@ 2009-12-17 13:22   ` Youquan,Song
  2009-12-17  8:43     ` Andi Kleen
  2010-01-04 23:53     ` Jesse Barnes
  2009-12-17 13:34   ` [PATCH]PCIe " Youquan,Song
  1 sibling, 2 replies; 6+ messages in thread
From: Youquan,Song @ 2009-12-17 13:22 UTC (permalink / raw)
  To: jbarnes
  Cc: andrew.patterson, andi, ying.huang, kent.liu, youquan.song,
	linux-kernel, linux-pci

Correcteable/Uncorrectable Error Mask Register are used by PCIe AER driver 
which will controls the reporting of idividual errors to PCIe RC via PCIe
error messages. 

If hardware masks special error reporting to RC, the aer_inject driver should
 not inject aer error.

Signed-off-by: Youquan, Song <youquan.song@intel.com>
Acked-by: Ying, Huang <ying.huang@intel.com>
---


diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
index 7fcd533..d002cd9 100644
--- a/drivers/pci/pcie/aer/aer_inject.c
+++ b/drivers/pci/pcie/aer/aer_inject.c
@@ -321,7 +321,7 @@ static int aer_inject(struct aer_error_inj *einj)
 	unsigned long flags;
 	unsigned int devfn = PCI_DEVFN(einj->dev, einj->fn);
 	int pos_cap_err, rp_pos_cap_err;
-	u32 sever;
+	u32 sever, mask;
 	int ret = 0;
 
 	dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn);
@@ -374,6 +374,24 @@ 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] 6+ messages in thread

* Re: [PATCH]PCIe AER: reject aer inject if hardware mask error reporting
  2009-12-15  0:29 ` Andrew Patterson
  2009-12-17 13:22   ` [Resend PATCH]PCIe " Youquan,Song
@ 2009-12-17 13:34   ` Youquan,Song
  1 sibling, 0 replies; 6+ messages in thread
From: Youquan,Song @ 2009-12-17 13:34 UTC (permalink / raw)
  To: Andrew Patterson
  Cc: Youquan,Song, jbarnes, andi, ying.huang, kent.liu, youquan.song,
	linux-kernel, linux-pci

Hi Andrew,

I have udpate and sent the patch according to your comments.
 
> >  	dev = pci_get_bus_and_slot(einj->bus, devfn);
> 
> This does not apply.  Please respin against latest linux-2.6 or pci-2.6.
Yes, it is true that it is udapted at 32 final. Thanks.

> >  
> > +	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 is masked by device\n");
> 
> You can inject multiple correctable errors with the aer-inject user-land
> tool, so perhaps this should be re-worded as:
> 
> "The correctable error(s) are masked by the device\n"
Yes. it is update.

> You can also simultaneously inject correctable and uncorrectable errors,
> so I don't particularly like returning errors here.  Perhaps you should
> just print the warning message out and just not inject the masked
> errors.
I do not agree with you at this point. If the hardware is not support
some error reporting, it need direct report this information to user
who use aer_inject userspace tool. He need change the his inject
configuration file, rather than kernel report him successful inject
AER but no any useful information at console or dmesg output. 

Anyway, In my mind, it should not be very important issue to stop this patch
 go to mainline. 

Thanks.

-Youquan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Resend PATCH]PCIe AER: reject aer inject if hardware mask error reporting
  2009-12-17 13:22   ` [Resend PATCH]PCIe " Youquan,Song
  2009-12-17  8:43     ` Andi Kleen
@ 2010-01-04 23:53     ` Jesse Barnes
  1 sibling, 0 replies; 6+ messages in thread
From: Jesse Barnes @ 2010-01-04 23:53 UTC (permalink / raw)
  To: Youquan,Song
  Cc: andrew.patterson, andi, ying.huang, kent.liu, youquan.song,
	linux-kernel, linux-pci

On Thu, 17 Dec 2009 08:22:48 -0500
"Youquan,Song" <youquan.song@linux.intel.com> wrote:

> Correcteable/Uncorrectable Error Mask Register are used by PCIe AER
> driver which will controls the reporting of idividual errors to PCIe
> RC via PCIe error messages. 
> 
> If hardware masks special error reporting to RC, the aer_inject
> driver should not inject aer error.
> 
> Signed-off-by: Youquan, Song <youquan.song@intel.com>
> Acked-by: Ying, Huang <ying.huang@intel.com>
> ---

Applied this to my for-linus branch, thanks.

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-01-04 23:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-11 23:48 [PATCH]PCIe AER: reject aer inject if hardware mask error reporting Youquan,Song
2009-12-15  0:29 ` Andrew Patterson
2009-12-17 13:22   ` [Resend PATCH]PCIe " Youquan,Song
2009-12-17  8:43     ` Andi Kleen
2010-01-04 23:53     ` Jesse Barnes
2009-12-17 13:34   ` [PATCH]PCIe " Youquan,Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox