rds_rdma: don't assume infiniband device is PCI
Subsystems (3)
PATCH RESEND 1/1 rds_rdma: don't assume infiniband device is PCI
RDS code assumes that the struct ib_device dma_device member, which is a pointer, points to a struct device embedded in a struct pci_dev.
This is not the case for ehca, for example, which is a OF driver, and makes dma_device point to a struct device embedded in a struct platform_device.
This will make the system crash when rds_rdma is loaded in a system with ehca, since it will try to access the bus member of a non-existent struct pci_dev.
The only reason rds_rdma uses the struct pci_dev is to get the NUMA node the device is attached to. Using dev_to_node for that is much better, since it won't assume which bus the infiniband is attached to.
---
Hi, Venkat.
This patch is still not applied. Can you give your Ack?
Regards.
Cascardo.
--- net/rds/ib.h | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
net/rds/ib.h +1 -2
@@ -186,8 +186,7 @@ struct rds_ib_device {struct work_struct free_work; }; -#define pcidev_to_node (pcidev) pcibus_to_node(pcidev->bus) -#define ibdev_to_node (ibdev) pcidev_to_node(to_pci_dev(ibdev->dma_device)) +#define ibdev_to_node (ibdev) dev_to_node(ibdev->dma_device)#define rdsibdev_to_node (rdsibdev) ibdev_to_node(rdsibdev->dev)/* bits for i_ack_flags */
Signature · 1 line
1.7.4.4
Quoted 15 lines · Thadeu Lima de Souza Cascardo
RDS code assumes that the struct
ib_devicedma_devicemember, which is a pointer, points to a struct device embedded in a structpci_dev.This is not the case for ehca, for example, which is a OF driver, and makes
dma_devicepoint to a struct device embedded in a structplatform_device.This will make the system crash when
rds_rdmais loaded in a system with ehca, since it will try to access the bus member of a non-existent structpci_dev.The only reason
rds_rdmauses the structpci_devis to get the NUMA node the device is attached to. Usingdev_to_nodefor that is much better, since it won't assume which bus the infiniband is attached to.
Quoted 6 lines
Signed-off-by Thadeu Lima de Souza Cascardo<[email protected]>Cc Venkat Venkatsubra<[email protected]>---
From: Venkat Venkatsubra <[email protected]>
Date: Mon, 28 May 2012 15:15:18 -0500
Quoted 19 lines · Thadeu Lima de Souza Cascardo
Quoted 18 lines
RDS code assumes that the struct
ib_devicedma_devicemember, which is a
pointer, points to a struct device embedded in a structpci_dev.This is not the case for ehca, for example, which is a OF driver, and makes
dma_devicepoint to a struct device embedded in a structplatform_device.This will make the system crash when
rds_rdmais loaded in a system with ehca, since it will try to access the bus member of a non-existent
structpci_dev.The only reason
rds_rdmauses the structpci_devis to get the NUMA node
the device is attached to. Usingdev_to_nodefor that is much better, since it won't assume which bus the infiniband is attached to.
Quoted 8 lines
Quoted 7 lines
Signed-off-by: Thadeu Lima de Souza Cascardo<[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Venkat Venkatsubra<[email protected]>
---
Applied.