Skip to contentSkip to conversation

nvme: avoid crashes when node 0 is memoryless node.

PATCH New Masayoshi Mizuma 4 participants 5 messages Jun 20, 2016 – Jul 13, 2016 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: avoid crashes when node 0 is memoryless node.

When CONFIG_NUMA is enabled and node 0 is memoryless, the system crashes because nvme_probe() sets the device->numa_node to 0 by set_dev_node(&pdev->dev, 0), so it tries to allocate memory from node 0. To avoid the crash, we should change the 0 to first_memory_node.

Signed-off-by Masayoshi Mizuma <m.mizuma at jp.fujitsu.com>
---
 drivers/nvme/host/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pci.c +1 -1
index befac5b..a14d5e0 100644
@@ -1940,7 +1940,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	node = dev_to_node(&pdev->dev);
 	if (node == NUMA_NO_NODE)
-		set_dev_node(&pdev->dev, 0);
+		set_dev_node(&pdev->dev, first_memory_node);
 
 	dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, node);
 	if (!dev)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 nvme: avoid crashes when node 0 is memoryless node.

Quoted 6 lines · Masayoshi Mizuma

When CONFIG_NUMA is enabled and node 0 is memoryless, the system crashes because nvme_probe() sets the device->numa_node to 0 by set_dev_node(&pdev->dev, 0), so it tries to allocate memory from node 0. To avoid the crash, we should change the 0 to first_memory_node.

Signed-off-by Masayoshi Mizuma <m.mizuma at jp.fujitsu.com>
Reviewed-by Johannes Thumshirn <jthumshirn at suse.de>
Signature · 6 lines
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#2 lore raw

PATCH 1/1 nvme: avoid crashes when node 0 is memoryless node.

In reply to Masayoshi Mizuma
Quoted 6 lines · Masayoshi Mizuma

When CONFIG_NUMA is enabled and node 0 is memoryless, the system crashes because nvme_probe() sets the device->numa_node to 0 by set_dev_node(&pdev->dev, 0), so it tries to allocate memory from node 0. To avoid the crash, we should change the 0 to first_memory_node.

Signed-off-by Masayoshi Mizuma <m.mizuma at jp.fujitsu.com>

Thanks for the fix.

Reviewed-by Keith Busch <keith.busch at intel.com>
#3 lore raw

PATCH 1/1 nvme: avoid crashes when node 0 is memoryless node.

Keith and Johannes, thank you for reviewing!

Jens, please add this patch for 4.8.

- Masayoshi Mizuma

Quoted 17 lines · On Mon, 20 Jun 2016 11:44:39 -0400 Keith Busch wrote:
Quoted 6 lines · Masayoshi Mizuma

When CONFIG_NUMA is enabled and node 0 is memoryless, the system crashes because nvme_probe() sets the device->numa_node to 0 by set_dev_node(&pdev->dev, 0), so it tries to allocate memory from node 0. To avoid the crash, we should change the 0 to first_memory_node.

Signed-off-by Masayoshi Mizuma <m.mizuma at jp.fujitsu.com>

Thanks for the fix.

Reviewed-by Keith Busch <keith.busch at intel.com>

_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

#4 lore raw

PATCH 1/1 nvme: avoid crashes when node 0 is memoryless node.

Quoted 4 lines · Masayoshi Mizuma

Keith and Johannes, thank you for reviewing!

Jens, please add this patch for 4.8.

Added, thanks.

Signature · 1 line
Jens Axboe