lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 30 Mar 2022 16:59:19 -0700
From:   ira.weiny@...el.com
To:     Dan Williams <dan.j.williams@...el.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc:     Alison Schofield <alison.schofield@...el.com>,
        Vishal Verma <vishal.l.verma@...el.com>,
        Ira Weiny <ira.weiny@...el.com>,
        Ben Widawsky <ben.widawsky@...el.com>,
        linux-kernel@...r.kernel.org, linux-cxl@...r.kernel.org,
        linux-pci@...r.kernel.org
Subject: [PATCH V7 09/10] cxl/mem: Retry reading CDAT on failure

From: Ira Weiny <ira.weiny@...el.com>

The CDAT read may fail for a number of reasons but mainly it is possible
to get different parts of a valid state.  The checksum in the CDAT table
protects against this.

Now that the cdat data is validated issue a retries if the CDAT read
fails.  For now 5 retries are implemented.

Signed-off-by: Ira Weiny <ira.weiny@...el.com>

---
Changes from V6
	Move to pci.c
	Fix retries count
	Change to 5 retries

Changes from V5:
	New patch -- easy to push off or drop.
---
 drivers/cxl/pci.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index ddd6b705fd67..6205f4eba729 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -921,7 +921,7 @@ static void cxl_initialize_cdat_callbacks(struct cxl_dev_state *cxlds)
 	cxlds->cdat_read_table = cxl_cdat_read_table;
 }
 
-static int read_cdat_data(struct cxl_dev_state *cxlds)
+static int __read_cdat_data(struct cxl_dev_state *cxlds)
 {
 	struct device *dev = cxlds->dev;
 	size_t cdat_length;
@@ -943,6 +943,21 @@ static int read_cdat_data(struct cxl_dev_state *cxlds)
 	return ret;
 }
 
+static void read_cdat_data(struct cxl_dev_state *cxlds)
+{
+	int retries = 5;
+	int rc;
+
+	while (retries--) {
+		rc = __read_cdat_data(cxlds);
+		if (!rc)
+			break;
+		dev_err(cxlds->dev,
+			"CDAT data read error rc=%d (retries %d)\n",
+			rc, retries);
+	}
+}
+
 static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	struct cxl_register_map map;
@@ -1016,9 +1031,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	cxl_initialize_cdat_callbacks(cxlds);
 
 	/* Cache the data early to ensure is_visible() works */
-	rc = read_cdat_data(cxlds);
-	if (rc)
-		dev_err(&pdev->dev, "CDAT data read error (%d)\n", rc);
+	read_cdat_data(cxlds);
 
 	rc = cxl_dvsec_ranges(cxlds);
 	if (rc)
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ