From 11f0e89710ebea7d1086cbe9ab1270c96677f1dc Mon Sep 17 00:00:00 2001 From: "Michael J. Ruhl" Date: Mon, 18 Dec 2017 19:57:21 -0800 Subject: IB/{hfi1, qib}: Fix a concurrency issue with device name in logging The get_unit_name() function crafts a string based on the device name and the device unit number. It then stores this in a static variable. This has concurrency issues as can be seen with this log: hfi1 0000:02:00.0: hfi1_1: read_idle_message: read idle message 0x203 hfi1 0000:01:00.0: hfi1_1: read_idle_message: read idle message 0x203 The PCI device ID (0000:02:00.0 vs. 0000:01:00.0) is correct for the message, but the device string hfi1_1 is incorrect (it should be hfi1_0 for the second log message). Remove get_unit_name() function. Instead, use the rvt accessor rvt_get_ibdev_name() to get the IB name string. Clean up any hfi1_early_xx calls that can now use the new path. QIB has the same (qib_get_unit_name()) issue. Updating as necessary. Remove qib_get_unit_name() function. Update log message that has redundant device name. Reviewed-by: Mike Marciniszyn Signed-off-by: Michael J. Ruhl Signed-off-by: Dennis Dalessandro Signed-off-by: Doug Ledford --- drivers/infiniband/hw/qib/qib.h | 7 +++---- drivers/infiniband/hw/qib/qib_driver.c | 8 -------- drivers/infiniband/hw/qib/qib_eeprom.c | 3 +-- 3 files changed, 4 insertions(+), 14 deletions(-) (limited to 'drivers/infiniband/hw/qib') diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h index 34c5254b803d..0235f76bbc72 100644 --- a/drivers/infiniband/hw/qib/qib.h +++ b/drivers/infiniband/hw/qib/qib.h @@ -1428,7 +1428,6 @@ u64 qib_sps_ints(void); */ dma_addr_t qib_map_page(struct pci_dev *, struct page *, unsigned long, size_t, int); -const char *qib_get_unit_name(int unit); struct pci_dev *qib_get_pci_dev(struct rvt_dev_info *rdi); /* @@ -1487,15 +1486,15 @@ extern struct mutex qib_mutex; #define qib_dev_err(dd, fmt, ...) \ dev_err(&(dd)->pcidev->dev, "%s: " fmt, \ - qib_get_unit_name((dd)->unit), ##__VA_ARGS__) + rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__) #define qib_dev_warn(dd, fmt, ...) \ dev_warn(&(dd)->pcidev->dev, "%s: " fmt, \ - qib_get_unit_name((dd)->unit), ##__VA_ARGS__) + rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__) #define qib_dev_porterr(dd, port, fmt, ...) \ dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \ - qib_get_unit_name((dd)->unit), (dd)->unit, (port), \ + rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), (dd)->unit, (port), \ ##__VA_ARGS__) #define qib_devinfo(pcidev, fmt, ...) \ diff --git a/drivers/infiniband/hw/qib/qib_driver.c b/drivers/infiniband/hw/qib/qib_driver.c index 9b13680836be..3117cc5f2a9a 100644 --- a/drivers/infiniband/hw/qib/qib_driver.c +++ b/drivers/infiniband/hw/qib/qib_driver.c @@ -81,14 +81,6 @@ MODULE_DESCRIPTION("Intel IB driver"); struct qlogic_ib_stats qib_stats; -const char *qib_get_unit_name(int unit) -{ - static char iname[16]; - - snprintf(iname, sizeof(iname), "infinipath%u", unit); - return iname; -} - struct pci_dev *qib_get_pci_dev(struct rvt_dev_info *rdi) { struct qib_ibdev *ibdev = container_of(rdi, struct qib_ibdev, rdi); diff --git a/drivers/infiniband/hw/qib/qib_eeprom.c b/drivers/infiniband/hw/qib/qib_eeprom.c index 33a2e74c8495..5838b3bf34b9 100644 --- a/drivers/infiniband/hw/qib/qib_eeprom.c +++ b/drivers/infiniband/hw/qib/qib_eeprom.c @@ -163,8 +163,7 @@ void qib_get_eeprom_info(struct qib_devdata *dd) if (bguid[6] == 0xff) { if (bguid[5] == 0xff) { qib_dev_err(dd, - "Can't set %s GUID from base, wraps to OUI!\n", - qib_get_unit_name(t)); + "Can't set GUID from base, wraps to OUI!\n"); dd->base_guid = 0; goto bail; } -- cgit