Skip to contentSkip to conversation

PCIe AER: reject aer inject if hardware mask error reporting

PATCH Superseded Youquan,Song 4 participants 6 messages Dec 11, 2009 – Jan 4, 2010 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCIe AER: reject aer inject if hardware mask error reporting

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.

---

drivers/pci/pcie/aer/aer_inject.c +17 -1
index ad77f0c..fa2bc22 100644
@@ -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;
#1 lore raw
Quoted 16 lines · Youquan,Song

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.

---

drivers/pci/pcie/aer/aer_inject.c +0 -0
index ad77f0c..fa2bc22 100644

drivers/pci/pcie/aer/aer_inject.c static int aer_inject(struct aer_error_inj *einj) · line 308

Quoted 8 lines
drivers/pci/pcie/aer/aer_inject.c +1 -1
@@ -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.

drivers/pci/pcie/aer/aer_inject.c static int aer_inject(struct aer_error_inj *einj) · line 360

Quoted 8 lines
drivers/pci/pcie/aer/aer_inject.c +4 -0
@@ -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"

drivers/pci/pcie/aer/aer_inject.c static int aer_inject(struct aer_error_inj *einj) · line 368

Quoted 8 lines
drivers/pci/pcie/aer/aer_inject.c +8 -0
+		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

drivers/pci/pcie/aer/aer_inject.c static int aer_inject(struct aer_error_inj *einj) · line 364

Quoted 4 lines
drivers/pci/pcie/aer/aer_inject.c +4 -0
+		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.

Quoted 8 lines
drivers/pci/pcie/aer/aer_inject.c +0 -1
 	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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Andrew Patterson
Hewlett-Packard
#2 lore raw

PATCH RESEND 1/1 PCIe AER: reject aer inject if hardware mask error reporting

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.

---

drivers/pci/pcie/aer/aer_inject.c +19 -1
index 7fcd533..d002cd9 100644
@@ -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;
Acked-by on v1 1/1
#3 lore raw
Quoted 9 lines · Youquan,Song

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.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
Applied
#4 lore raw
In reply to Youquan,Song
Quoted 10 lines · On Thu, 17 Dec 2009 08:22:48 -0500 "Youquan,Song"…

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.

---

Applied this to my for-linus branch, thanks.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#5 lore raw
In reply to Andrew Patterson

Hi Andrew,

I have udpate and sent the patch according to your comments.

Quoted 3 lines
Quoted 1 line

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.

Quoted 10 lines

drivers/pci/pcie/aer/aer_inject.c static int aer_inject(struct aer_error_inj *einj) · line 360

Quoted 5 lines
drivers/pci/pcie/aer/aer_inject.c +4 -0
+	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.

Quoted 4 lines

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