numa: check for busy memory backend
PATCH 1/1 numa: check for busy memory backend
..to prevent one memory backend from being used by more than one numa node.
--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)
numa.c +7 -0
@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); } +if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path); +g_free (path); +exit (1 ); + } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;
Signature · 1 line
1.9.3
Quoted 13 lines · On Wed, 25 Jun 2014 17:04:14 +0800 Hu Tao <[email protected]> wrote:
..to prevent one memory backend from being used by more than one numa node.
Signed-off-by Hu Tao <[email protected]>--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)numa.c +0
-0
numa.c void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, · line 286
Quoted 8 lines
numa.c +5
-0@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); } +if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path); +g_free (path); +exit (1 );
s/1/EXIT_FAILURE/ please
Quoted 5 lines
numa.c +2
-0+ } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;
Quoted 19 lines · Igor Mammedov
Quoted 16 lines · On Wed, 25 Jun 2014 17:04:14 +0800 Hu Tao <[email protected]> wrote:
..to prevent one memory backend from being used by more than one numa node.
Signed-off-by Hu Tao <[email protected]>--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)numa.c +0
-0@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); }
Quoted 6 lines
numa.c void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, · line 286
Quoted 5 lines
numa.c +5
-0+if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path); +g_free (path); +exit (1 );s/1/EXIT_FAILURE/ please
I count >600 instances of exit() with a numeric argument (not counting some 50 sys.exit() in Python code), but less than 40 using EXIT_SUCCESS or EXIT_FAILURE.
The abstraction provided by EXIT_SUCCESS / EXIT_FAILURE is basically worthless anyway.
Quoted 6 lines
Quoted 6 lines
numa.c +2
-0+ } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;
Quoted 2 lines · Hu Tao
..to prevent one memory backend from being used by more than one numa node.
Thanks, but please always make the msg content self-contained so it can be understood without the subject.
E.g. here, just drop "..to".
Are you sure we want this? Is there a chance sharing a backend can be useful?
Igor, what's your take?
Quoted 26 lines
Signed-off-by Hu Tao <[email protected]>--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)numa.c +7
-0@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); } +if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path); +g_free (path); +exit (1 ); + } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;Signature · 1 line
1.9.3
Quoted 10 lines · Michael S. Tsirkin
Quoted 2 lines · Hu Tao
..to prevent one memory backend from being used by more than one numa node.
Thanks, but please always make the msg content self-contained so it can be understood without the subject.
E.g. here, just drop "..to".Are you sure we want this? Is there a chance sharing a backend can be useful?
This patch is actually a bug fix. Even if we will want backend sharing, we can do it after.
Quoted 29 lines
Igor, what's your take?
Quoted 26 lines
Signed-off-by Hu Tao <[email protected]>--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)numa.c +7
-0@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); } +if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path); +g_free (path); +exit (1 ); + } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;Signature · 1 line
1.9.3
Quoted 5 lines · Hu Tao
Quoted 4 lines · Michael S. Tsirkin
Quoted 2 lines · Hu Tao
..to prevent one memory backend from being used by more than one numa node.
Quoted 8 lines
Quoted 6 lines
Thanks, but please always make the msg content self-contained so it can be understood without the subject.
E.g. here, just drop "..to".Are you sure we want this? Is there a chance sharing a backend can be useful?
This patch is actually a bug fix.
It is? What is the bug and how to reproduce it?
I am not sure we should write a ton of code to validate qemu configuration, as long as qemu does not assert.
Quoted 2 lines
Even if we will want backend sharing, we
can do it after.
By reverting this patch? So why merge it?
Quoted 29 lines
Quoted 29 lines
Igor, what's your take?
Quoted 26 lines
Signed-off-by Hu Tao <[email protected]>--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)numa.c +7
-0@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); } +if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path); +g_free (path); +exit (1 ); + } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;Signature · 1 line
1.9.3
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Hu Tao
Quoted 8 lines · Michael S. Tsirkin
Quoted 2 lines · Hu Tao
..to prevent one memory backend from being used by more than one numa node.
Thanks, but please always make the msg content self-contained so it can be understood without the subject.
E.g. here, just drop "..to".
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Are you sure we want this? Is there a chance sharing a backend can be useful?
This patch is actually a bug fix.
It is? What is the bug and how to reproduce it?
If user specifies the same memory backend for two numa nodes:
./x86_64-softmmu/qemu-system-x86_64 -hda /home/data/libvirt-images/f18.img -m 512M \
-qmp unix:/tmp/m,server,nowait -monitor stdio -enable-kvm \
-object memory-backend-ram,size=256M,id=ram0 \
-numa node,nodeid=0,memdev=ram0 \
-numa node,nodeid=1,memdev=ram0
Quoted 2 lines
I am not sure we should write a ton of code to validate qemu configuration, as long as qemu does not assert.
It seems qemu does not provide a way to disable assert currently. Even if I removed asserts on the code path in my test, there is another problem that it hits an infinite in render_memory_region().
Quoted 5 lines
Quoted 3 lines
Even if we will want backend sharing, we
can do it after.By reverting this patch? So why merge it?
The point is qemu doesn't fire a bug no matter what user inputs.
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Igor, what's your take?
Quoted 26 lines
Signed-off-by Hu Tao <[email protected]>--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)numa.c +7
-0@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); } +if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path); +g_free (path); +exit (1 ); + } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;Signature · 1 line
1.9.3
Quoted 26 lines · Hu Tao
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Hu Tao
Quoted 8 lines · Michael S. Tsirkin
Quoted 2 lines · Hu Tao
..to prevent one memory backend from being used by more than one numa node.
Thanks, but please always make the msg content self-contained so it can be understood without the subject.
E.g. here, just drop "..to".Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Are you sure we want this? Is there a chance sharing a backend can be useful?
This patch is actually a bug fix.
It is? What is the bug and how to reproduce it?
If user specifies the same memory backend for two numa nodes:
./x86_64-softmmu/qemu-system-x86_64 -hda
/home/data/libvirt-images/f18.img-m 512M \(quoted diff) +0
-4-qmp unix:/tmp/m,server,nowait -monitor stdio -enable-kvm \ -object memory-backend-ram,size=256M,id=ram0 \ -numa node,nodeid=0,memdev=ram0 \ -numa node,nodeid=1,memdev=ram0
Quoted 6 lines
Quoted 2 lines
I am not sure we should write a ton of code to validate qemu configuration, as long as qemu does not assert.
It seems qemu does not provide a way to disable assert currently. Even if I removed asserts on the code path in my test, there is another problem that it hits an infinite in
render_memory_region().
OK so this is what commit log should say:
--->
Specifying the same memory region twice leads to an assert:
./x86_64-softmmu/qemu-system-x86_64 -m 512M -enable-kvm -object memory-backend-ram,size=256M,id=ram0 -numa node,nodeid=0,memdev=ram0 -numa node,nodeid=1,memdev=ram0
qemu-system-x86_64: /scm/qemu/memory.c:1506:memory_region_add_subregion_common: Assertion `!subregion->container' failed.
Aborted (core dumped)
Detect and exit with an error message instead.
<---
See? Explain why your patch makes sense, don't just repeat what it does.
Quoted 26 lines
Quoted 5 lines
Quoted 3 lines
Even if we will want backend sharing, we
can do it after.By reverting this patch? So why merge it?
The point is qemu doesn't fire a bug no matter what user inputs.
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Igor, what's your take?
Quoted 14 lines
Signed-off-by Hu Tao <[email protected]>--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)numa.c +0
-0@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); }
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
numa.c void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, · line 284
Quoted 3 lines
numa.c +3
-0+if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path);
That's not very clear. How about:
memory backend %s is used multiple times. Each -numa option must use a different memdev value.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
numa.c void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, · line 285
Quoted 1 line
numa.c +1
-0+g_free (path);
As we are going to exit anyway, it does not make sense to bother with this.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
numa.c +3
-0+exit (1 ); + } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;Signature · 1 line
1.9.3
Igor Mammedov
Reviewed-byQuoted 46 lines · On Mon, 30 Jun 2014 11:28:07 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 26 lines · Hu Tao
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Hu Tao
Quoted 8 lines · Michael S. Tsirkin
Quoted 2 lines · Hu Tao
..to prevent one memory backend from being used by more than one numa node.
Thanks, but please always make the msg content self-contained so it can be understood without the subject.
E.g. here, just drop "..to".Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Are you sure we want this? Is there a chance sharing a backend can be useful?
This patch is actually a bug fix.
It is? What is the bug and how to reproduce it?
If user specifies the same memory backend for two numa nodes:
./x86_64-softmmu/qemu-system-x86_64 -hda
/home/data/libvirt-images/f18.img-m 512M \(quoted diff) +0
-4-qmp unix:/tmp/m,server,nowait -monitor stdio -enable-kvm \ -object memory-backend-ram,size=256M,id=ram0 \ -numa node,nodeid=0,memdev=ram0 \ -numa node,nodeid=1,memdev=ram0Quoted 6 lines
Quoted 2 lines
I am not sure we should write a ton of code to validate qemu configuration, as long as qemu does not assert.
It seems qemu does not provide a way to disable assert currently. Even if I removed asserts on the code path in my test, there is another problem that it hits an infinite in
render_memory_region().OK so this is what commit log should say:
--->
Specifying the same memory region twice leads to an assert:./x86_64-softmmu/qemu-system-x86_64 -m 512M -enable-kvm -object memory-backend-ram,size=256M,id=ram0 -numa node,nodeid=0,memdev=ram0 -numa node,nodeid=1,memdev=ram0
qemu-system-x86_64: /scm/qemu/memory.c:1506:memory_region_add_subregion_common: Assertion `!subregion->container' failed.
Aborted (core dumped)
Quoted 2 lines
Detect and exit with an error message instead.
<---
with fixed-up commit message:
Quoted 49 lines
See? Explain why your patch makes sense, don't just repeat what it does.
Quoted 26 lines
Quoted 5 lines
Quoted 3 lines
Even if we will want backend sharing, we
can do it after.By reverting this patch? So why merge it?
The point is qemu doesn't fire a bug no matter what user inputs.
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Igor, what's your take?
Quoted 14 lines
Signed-off-by Hu Tao <[email protected]>--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)numa.c +0
-0@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); }Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
numa.c void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, · line 284
Quoted 3 lines
numa.c +3
-0+if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path);That's not very clear. How about:
memory backend %s is used multiple times. Each -numa option must use a different memdev value.Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
numa.c void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, · line 285
Quoted 1 line
numa.c +1
-0+g_free (path);As we are going to exit anyway, it does not make sense to bother with this.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
numa.c +3
-0+exit (1 ); + } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;Signature · 1 line
1.9.3
Quoted 49 lines · Igor Mammedov
Quoted 46 lines · On Mon, 30 Jun 2014 11:28:07 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 26 lines · Hu Tao
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Hu Tao
Quoted 8 lines · Michael S. Tsirkin
Quoted 2 lines · Hu Tao
..to prevent one memory backend from being used by more than one numa node.
Thanks, but please always make the msg content self-contained so it can be understood without the subject.
E.g. here, just drop "..to".Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Are you sure we want this? Is there a chance sharing a backend can be useful?
This patch is actually a bug fix.
It is? What is the bug and how to reproduce it?
If user specifies the same memory backend for two numa nodes:
./x86_64-softmmu/qemu-system-x86_64 -hda
/home/data/libvirt-images/f18.img-m 512M \(quoted diff) +0
-4-qmp unix:/tmp/m,server,nowait -monitor stdio -enable-kvm \ -object memory-backend-ram,size=256M,id=ram0 \ -numa node,nodeid=0,memdev=ram0 \ -numa node,nodeid=1,memdev=ram0Quoted 6 lines
Quoted 2 lines
I am not sure we should write a ton of code to validate qemu configuration, as long as qemu does not assert.
It seems qemu does not provide a way to disable assert currently. Even if I removed asserts on the code path in my test, there is another problem that it hits an infinite in
render_memory_region().OK so this is what commit log should say:
--->
Specifying the same memory region twice leads to an assert:./x86_64-softmmu/qemu-system-x86_64 -m 512M -enable-kvm -object memory-backend-ram,size=256M,id=ram0 -numa node,nodeid=0,memdev=ram0 -numa node,nodeid=1,memdev=ram0
qemu-system-x86_64: /scm/qemu/memory.c:1506:memory_region_add_subregion_common: Assertion `!subregion->container' failed.
Aborted (core dumped)
Quoted 4 lines
Quoted 2 lines
Detect and exit with an error message instead.
<---with fixed-up commit message:
Reviewed-by Igor Mammedov <[email protected]>
Sorry I want the error message fixed up too.
Quoted 49 lines
Quoted 49 lines
See? Explain why your patch makes sense, don't just repeat what it does.
Quoted 26 lines
Quoted 5 lines
Quoted 3 lines
Even if we will want backend sharing, we
can do it after.By reverting this patch? So why merge it?
The point is qemu doesn't fire a bug no matter what user inputs.
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Igor, what's your take?
Quoted 14 lines
Signed-off-by Hu Tao <[email protected]>--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)numa.c +0
-0@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); }Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
numa.c void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, · line 284
Quoted 3 lines
numa.c +3
-0+if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path);That's not very clear. How about:
memory backend %s is used multiple times. Each -numa option must use a different memdev value.Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
numa.c void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, · line 285
Quoted 1 line
numa.c +1
-0+g_free (path);As we are going to exit anyway, it does not make sense to bother with this.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
numa.c +3
-0+exit (1 ); + } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;Signature · 1 line
1.9.3
Quoted 50 lines · Michael S. Tsirkin
Quoted 49 lines · Igor Mammedov
Quoted 46 lines · On Mon, 30 Jun 2014 11:28:07 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 26 lines · Hu Tao
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Hu Tao
Quoted 8 lines · Michael S. Tsirkin
Quoted 2 lines · Hu Tao
..to prevent one memory backend from being used by more than one numa node.
Thanks, but please always make the msg content self-contained so it can be understood without the subject.
E.g. here, just drop "..to".Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Are you sure we want this? Is there a chance sharing a backend can be useful?
This patch is actually a bug fix.
It is? What is the bug and how to reproduce it?
If user specifies the same memory backend for two numa nodes:
./x86_64-softmmu/qemu-system-x86_64 -hda
/home/data/libvirt-images/f18.img-m 512M \(quoted diff) +0
-4-qmp unix:/tmp/m,server,nowait -monitor stdio -enable-kvm \ -object memory-backend-ram,size=256M,id=ram0 \ -numa node,nodeid=0,memdev=ram0 \ -numa node,nodeid=1,memdev=ram0Quoted 6 lines
Quoted 2 lines
I am not sure we should write a ton of code to validate qemu configuration, as long as qemu does not assert.
It seems qemu does not provide a way to disable assert currently. Even if I removed asserts on the code path in my test, there is another problem that it hits an infinite in
render_memory_region().OK so this is what commit log should say:
--->
Specifying the same memory region twice leads to an assert:./x86_64-softmmu/qemu-system-x86_64 -m 512M -enable-kvm -object memory-backend-ram,size=256M,id=ram0 -numa node,nodeid=0,memdev=ram0 -numa node,nodeid=1,memdev=ram0
qemu-system-x86_64: /scm/qemu/memory.c:1506:memory_region_add_subregion_common: Assertion `!subregion->container' failed.
Aborted (core dumped)
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Detect and exit with an error message instead.
<---with fixed-up commit message:
Reviewed-by Igor Mammedov <[email protected]>Sorry I want the error message fixed up too.
Yes your error message is more clear. I'll send v2. Thanks for review.
Regards,
Hu
Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
See? Explain why your patch makes sense, don't just repeat what it does.
Quoted 26 lines
Quoted 5 lines
Quoted 3 lines
Even if we will want backend sharing, we
can do it after.By reverting this patch? So why merge it?
The point is qemu doesn't fire a bug no matter what user inputs.
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Igor, what's your take?
Quoted 14 lines
Signed-off-by Hu Tao <[email protected]>--- numa.c | 7 +++++++ 1 file changed, 7 insertions(+)numa.c +0
-0@@ -279,6 +279,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,exit (1 ); }Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
numa.c void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, · line 284
Quoted 3 lines
numa.c +3
-0+if (memory_region_is_mapped (seg)) { +char *path =object_get_canonical_path_component (OBJECT (backend)); +error_report ("memory backend %s is busy" , path);That's not very clear. How about:
memory backend %s is used multiple times. Each -numa option must use a different memdev value.Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
numa.c void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, · line 285
Quoted 1 line
numa.c +1
-0+g_free (path);As we are going to exit anyway, it does not make sense to bother with this.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
numa.c +3
-0+exit (1 ); + } +memory_region_add_subregion (mr, addr, seg);vmstate_register_ram_global (seg); addr += size;Signature · 1 line
1.9.3