Skip to contentSkip to conversation

mm/memblock: WARN_ON when nid differs from overlap region

PATCH In review Wei Yang 2 participants 7 messages Jul 8, 2015 – Jul 16, 2015

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 mm/memblock: WARN_ON when nid differs from overlap region

Each memblock_region has nid to indicates the Node ID of this range. For the overlap case, memblock_add_range() inserts the lower part and leave the upper part as indicated in the overlapped region.

If the nid of the new range differs from the overlapped region, the information recorded is not correct.

This patch adds a WARN_ON when the nid of the new range differs from the overlapped region.

---

I am not familiar with the lower level topology, maybe this case will not happen.

If current implementation is based on the assumption, that overlapped ranges' nid and flags are the same, I would suggest to add a comment to indicates this background.

If the assumption is not correct, I suggest to add a WARN_ON or BUG_ON to indicates this case.

---
 mm/memblock.c |    3 +++
 1 file changed, 3 insertions(+)
mm/memblock.c +3 -0
index 9318b56..09efe70 100644
@@ -540,6 +540,9 @@ repeat:
 		 * area, insert that portion.
 		 */
 		if (rbase > base) {
+#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
+			WARN_ON(nid != memblock_get_region_node(rgn));
+#endif
 			nr_new++;
 			if (insert)
 				memblock_insert_region(type, i++, base,
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 1/1
#1 lore raw
Quoted 32 lines · Wei Yang

Each memblock_region has nid to indicates the Node ID of this range. For the overlap case, memblock_add_range() inserts the lower part and leave the upper part as indicated in the overlapped region.

If the nid of the new range differs from the overlapped region, the information recorded is not correct.

This patch adds a WARN_ON when the nid of the new range differs from the overlapped region.

---

I am not familiar with the lower level topology, maybe this case will not happen.

If current implementation is based on the assumption, that overlapped ranges' nid and flags are the same, I would suggest to add a comment to indicates this background.

If the assumption is not correct, I suggest to add a WARN_ON or BUG_ON to indicates this case.

---
 mm/memblock.c |    3 +++
 1 file changed, 3 insertions(+)
mm/memblock.c +0 -0
index 9318b56..09efe70 100644

mm/memblock.c repeat: · line 548

Quoted 9 lines
mm/memblock.c +3 -0
@@ -540,6 +540,9 @@ repeat:
 		 * area, insert that portion.
 		 */
 		if (rbase > base) {
+#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
+			WARN_ON(nid != memblock_get_region_node(rgn));
+#endif
 			nr_new++;
 			if (insert)
 				memblock_insert_region(type, i++, base,

I think the assertion that nid should match memblock_get_region_node() of the overlapped region is correct. It only functionally makes a difference if insert == true, but I don't think there's harm in verifying it regardless.

I think your supplemental to the changelog suggests that you haven't seen this actually occur, but in the off chance that you have then it would be interesting to see it.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#2 lore raw
Quoted 49 lines · David Rientjes
Quoted 32 lines · Wei Yang

Each memblock_region has nid to indicates the Node ID of this range. For the overlap case, memblock_add_range() inserts the lower part and leave the upper part as indicated in the overlapped region.

If the nid of the new range differs from the overlapped region, the information recorded is not correct.

This patch adds a WARN_ON when the nid of the new range differs from the overlapped region.

---

I am not familiar with the lower level topology, maybe this case will not happen.

If current implementation is based on the assumption, that overlapped ranges' nid and flags are the same, I would suggest to add a comment to indicates this background.

If the assumption is not correct, I suggest to add a WARN_ON or BUG_ON to indicates this case.

---
 mm/memblock.c |    3 +++
 1 file changed, 3 insertions(+)
mm/memblock.c +0 -0
index 9318b56..09efe70 100644

mm/memblock.c repeat: · line 548

Quoted 9 lines
mm/memblock.c +3 -0
@@ -540,6 +540,9 @@ repeat:
 		 * area, insert that portion.
 		 */
 		if (rbase > base) {
+#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
+			WARN_ON(nid != memblock_get_region_node(rgn));
+#endif
 			nr_new++;
 			if (insert)
 				memblock_insert_region(type, i++, base,

I think the assertion that nid should match memblock_get_region_node() of the overlapped region is correct. It only functionally makes a difference if insert == true, but I don't think there's harm in verifying it regardless.

Quoted 5 lines

I think your supplemental to the changelog suggests that you haven't seen this actually occur, but in the off chance that you have then it would be interesting to see it.

Hi David,

Thanks for your comments.

Yes, I don't see this actually occur. This is a guard to indicates if the lower level hardware is not functioning well.

Also, as the supplemental in the change log mentioned, the flags of the overlapped region needs to be checked too. If you think this is proper, I would like to form a patch to have the assertion on the flags.

Signature · 8 lines
Richard Yang
Help you, Help me

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#3 lore raw

PATCH 1/1 mm/memblock: WARN_ON when flags differs from overlap region

In reply to Wei Yang

Each memblock_region has flags to indicates the Node ID of this range. For the overlap case, memblock_add_range() inserts the lower part and leave the upper part as indicated in the overlapped region.

If the flags of the new range differs from the overlapped region, the information recorded is not correct.

This patch adds a WARN_ON when the flags of the new range differs from the overlapped region.

---
 mm/memblock.c |    1 +
 1 file changed, 1 insertion(+)
mm/memblock.c +1 -0
index 95ce68c..bde61e8 100644
@@ -569,6 +569,7 @@ repeat:
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 			WARN_ON(nid != memblock_get_region_node(rgn));
 #endif
+			WARN_ON(flags != rgn->flags);
 			nr_new++;
 			if (insert)
 				memblock_insert_region(type, i++, base,
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw

Re: [PATCH] mm/memblock: WARN_ON when flags differs from overlap region

Quoted 4 lines · Wei Yang

Each memblock_region has flags to indicates the Node ID of this range. For the overlap case, memblock_add_range() inserts the lower part and leave the upper part as indicated in the overlapped region.

Memblock region flags do not specify node ids, so this is somewhat misleading.

Quoted 16 lines

If the flags of the new range differs from the overlapped region, the information recorded is not correct.

This patch adds a WARN_ON when the flags of the new range differs from the overlapped region.

---
 mm/memblock.c |    1 +
 1 file changed, 1 insertion(+)
mm/memblock.c +0 -0
index 95ce68c..bde61e8 100644

mm/memblock.c repeat: · line 575

Quoted 7 lines
mm/memblock.c +1 -0
@@ -569,6 +569,7 @@ repeat:
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 			WARN_ON(nid != memblock_get_region_node(rgn));
 #endif
+			WARN_ON(flags != rgn->flags);
 			nr_new++;
 			if (insert)
 				memblock_insert_region(type, i++, base,

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#5 lore raw

Re: [PATCH] mm/memblock: WARN_ON when flags differs from overlap region

Quoted 10 lines · David Rientjes
Quoted 4 lines · Wei Yang

Each memblock_region has flags to indicates the Node ID of this range. For the overlap case, memblock_add_range() inserts the lower part and leave the upper part as indicated in the overlapped region.

Memblock region flags do not specify node ids, so this is somewhat misleading.

Thanks for pointing out, the commit message is not correct.

It should be "type" instead of "Node ID".

Quoted 23 lines
Quoted 23 lines

If the flags of the new range differs from the overlapped region, the information recorded is not correct.

This patch adds a WARN_ON when the flags of the new range differs from the overlapped region.

---
 mm/memblock.c |    1 +
 1 file changed, 1 insertion(+)
mm/memblock.c +1 -0
index 95ce68c..bde61e8 100644
@@ -569,6 +569,7 @@ repeat:
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 			WARN_ON(nid != memblock_get_region_node(rgn));
 #endif
+			WARN_ON(flags != rgn->flags);
 			nr_new++;
 			if (insert)
 				memblock_insert_region(type, i++, base,
Signature · 8 lines
Richard Yang
Help you, Help me

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#6 lore raw

PATCH v2 1/1 mm/memblock: WARN_ON when flags differs from overlap region

In reply to David Rientjes

Each memblock_region has flags to indicates the type of this range. For the overlap case, memblock_add_range() inserts the lower part and leave the upper part as indicated in the overlapped region.

If the flags of the new range differs from the overlapped region, the information recorded is not correct.

This patch adds a WARN_ON when the flags of the new range differs from the overlapped region.

---
v2:
* change the commit log to be more accurate.

---
 mm/memblock.c |    1 +
 1 file changed, 1 insertion(+)
mm/memblock.c +1 -0
index 95ce68c..bde61e8 100644
@@ -569,6 +569,7 @@ repeat:
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 			WARN_ON(nid != memblock_get_region_node(rgn));
 #endif
+			WARN_ON(flags != rgn->flags);
 			nr_new++;
 			if (insert)
 				memblock_insert_region(type, i++, base,
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>