don't use NVDIMM for balooning
v4 cover don't use NVDIMM for balooning
v4:
0001: Reviewed-by: Eric Blake <[email protected]>
second patch is splitted to 0002 and 0003
0002: Add 'type' field instead of 'balloonable' to PCDIMMDeviceInfo 0003: chec 'type' instead of 'balloonable'
v3:
- do not use additional class variable
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Vladimir Sementsov-Ogievskiy (3):
move get_current_ram_size to virtio-balloon.c
pcdimm: add 'type' field to PCDIMMDeviceInfo
balloon: don't use NVDIMM for ballooning
hw/mem/pc-dimm.c | 27 +-------------------------- hw/virtio/virtio-balloon.c | 29 +++++++++++++++++++++++++++++ include/exec/cpu-common.h | 1 - qapi-schema.json | 5 ++++- stubs/qmp_pc_dimm_device_list.c | 5 ----- 5 files changed, 34 insertions(+), 33 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v4 1/3 move get_current_ram_size to virtio-balloon.c
get_current_ram_size() is used only in virtio-balloon.c This patch moves it into virtio-balloon and make it static, to allow some balloon-specific tuning.
--- hw/mem/pc-dimm.c | 26 -------------------------- hw/virtio/virtio-balloon.c | 26 ++++++++++++++++++++++++++ include/exec/cpu-common.h | 1 - stubs/qmp_pc_dimm_device_list.c | 5 ----- 4 files changed, 26 insertions(+), 32 deletions(-)
hw/mem/pc-dimm.c +0 -26
@@ -191,32 +191,6 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque)return 0 ; } -ram_addr_t get_current_ram_size (void ) -{ -MemoryDeviceInfoList *info_list =NULL ; -MemoryDeviceInfoList **prev = &info_list; -MemoryDeviceInfoList *info; -ram_addr_t size = ram_size; - -qmp_pc_dimm_device_list (qdev_get_machine (), &prev); -for (info = info_list; info; info = info->next) { -MemoryDeviceInfo *value = info->value; - -if (value) { -switch (value->type) { -case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; -break ; -default : -break ; - } - } - } -qapi_free_MemoryDeviceInfoList (info_list); - -return size; -} -static int pc_dimm_slot2bitmap (Object *obj,void *opaque) {unsigned long *bitmap = opaque;
hw/virtio/virtio-balloon.c +26 -0
@@ -294,6 +294,32 @@ static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data)memcpy (config_data, &config,sizeof (struct virtio_balloon_config )); } +static ram_addr_t get_current_ram_size (void ) +{ +MemoryDeviceInfoList *info_list =NULL ; +MemoryDeviceInfoList **prev = &info_list; +MemoryDeviceInfoList *info; +ram_addr_t size = ram_size; + +qmp_pc_dimm_device_list (qdev_get_machine (), &prev); +for (info = info_list; info; info = info->next) { +MemoryDeviceInfo *value = info->value; + +if (value) { +switch (value->type) { +case MEMORY_DEVICE_INFO_KIND_DIMM : + size += value->u.dimm->size; +break ; +default : +break ; + } + } + } +qapi_free_MemoryDeviceInfoList (info_list); + +return size; +} +static void virtio_balloon_set_config (VirtIODevice *vdev,const uint8_t *config_data) {
include/exec/cpu-common.h +0 -1
@@ -54,7 +54,6 @@ typedef uintptr_t ram_addr_t;#endif extern ram_addr_t ram_size; -ram_addr_t get_current_ram_size (void );/* memory API */
stubs/qmp_pc_dimm_device_list.c +0 -5
@@ -5,8 +5,3 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque) {return 0 ; } - -ram_addr_t get_current_ram_size (void ) -{ -return ram_size; -}
Signature · 1 line
1.8.3.1
PATCH v4 2/3 pcdimm: add 'type' field to PCDIMMDeviceInfo
In reply to Vladimir Sementsov-OgievskiyThe field is needed to distinguish pc-dimm and nvdimm.
--- hw/mem/pc-dimm.c | 1 + qapi-schema.json | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)
hw/mem/pc-dimm.c +1 -0
@@ -178,6 +178,7 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque) di->size =object_property_get_int (OBJECT (dimm),PC_DIMM_SIZE_PROP ,NULL ); di->memdev =object_get_canonical_path (OBJECT (dimm->hostmem)); + di->type =g_strdup (object_get_typename (obj)); info->u.dimm = di; elem->value = info;
qapi-schema.json +4 -1
@@ -3924,6 +3924,8 @@ # # @hotpluggable: true if device if could be added/removed while machine is running # +# @type: device type: 'pc-dimm' or 'nvdimm' (since 2.6) +# # Since: 2.1 ## { 'struct': 'PCDIMMDeviceInfo',
@@ -3934,7 +3936,8 @@ 'node': 'int', 'memdev': 'str', 'hotplugged': 'bool', - 'hotpluggable': 'bool' + 'hotpluggable': 'bool', + 'type': 'str' } }
Signature · 1 line
1.8.3.1
PATCH v4 3/3 balloon: don't use NVDIMM for ballooning
In reply to Vladimir Sementsov-OgievskiyNVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit 463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memory
--- hw/virtio/virtio-balloon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
hw/virtio/virtio-balloon.c +4 -1
@@ -26,6 +26,7 @@#include "qapi/visitor.h" #include "qapi-event.h" #include "trace.h" +#include "hw/mem/nvdimm.h" #if defined(__linux__)#include <sys/mman.h>
@@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void)if (value) {switch (value->type) {case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; +if (strcmp (value->u.dimm->type,TYPE_NVDIMM )) { + size += value->u.dimm->size; + }break ;default :break ;
Signature · 1 line
1.8.3.1
Quoted 31 lines · Vladimir Sementsov-Ogievskiy
v4:
0001: Reviewed-by: Eric Blake <[email protected]>
second patch is splitted to 0002 and 0003
0002: Add 'type' field instead of 'balloonable' to PCDIMMDeviceInfo 0003: chec 'type' instead of 'balloonable'v3:
- do not use additional class variableNVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>Vladimir Sementsov-Ogievskiy (3):
moveget_current_ram_sizetovirtio-balloon.c
pcdimm: add 'type' field to PCDIMMDeviceInfo
balloon: don't use NVDIMM for ballooning
Quoted 7 lines
hw/mem/pc-dimm.c | 27 +-------------------------- hw/virtio/virtio-balloon.c | 29 +++++++++++++++++++++++++++++ include/exec/cpu-common.h | 1 - qapi-schema.json | 5 ++++- stubs/qmp_pc_dimm_device_list.c | 5 ----- 5 files changed, 34 insertions(+), 33 deletions(-)
ping
Re: [Qemu-devel] [PATCH 2/3] pcdimm: add 'type' field to PCDIMMDeviceInfo
In reply to Vladimir Sementsov-Ogievskiyhw/mem/pc-dimm.c int qmp_pc_dimm_device_list(Object *obj, void *opaque)
Quoted 20 lines · Vladimir Sementsov-Ogievskiy
The field is needed to distinguish pc-dimm and nvdimm.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>--- hw/mem/pc-dimm.c | 1 + qapi-schema.json | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)hw/mem/pc-dimm.c +0
-0@@ -178,6 +178,7 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque)
if (object_dynamic_cast(obj, TYPE_PC_DIMM)) {
DeviceState *dev = DEVICE(obj);
if (dev->realized) {[...]
Quoted 4 lines
di->size = object_property_get_int(OBJECT(dimm), PC_DIMM_SIZE_PROP, NULL); di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem));+
di->type= g_strdup(object_get_typename(obj));
@type is the type name of a subtype of TYPE_PC_DIMM.
Current subtypes are TYPE_PC_DIMM itself and TYPE_NVDIMM, i.e. "pc-dimm" and "nvdimm".
qapi-schema.json line 3928
Quoted 13 lines
info->u.dimm = di; elem->value = info;qapi-schema.json +2
-0@@ -3924,6 +3924,8 @@ # # @hotpluggable: true if device if could be added/removed while machine is running # +# @type: device type: 'pc-dimm' or 'nvdimm' (since 2.6) +#
Not wrong, but brittle: it breaks whenever someone adds another subtype and doesn't remember to update this spot. Remembering it seems unlikely, because it's somewhere else entirely.
Let's document it to be the type name of a subtype of pc-dimm, and that you can query the possible values with QMP command
{ "execute": "qom-list-types", "arguments": { "implements": "pc-dimm", "abstract": false } }Quoted 12 lines
qapi-schema.json +2
-1# Since: 2.1 ## { 'struct': 'PCDIMMDeviceInfo',@@ -3934,7 +3936,8 @@ 'node': 'int', 'memdev': 'str', 'hotplugged': 'bool', - 'hotpluggable': 'bool' + 'hotpluggable': 'bool', + 'type': 'str' } }
Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning
In reply to Vladimir Sementsov-OgievskiyQuoted 37 lines · Vladimir Sementsov-Ogievskiy
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit
463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memorySigned-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>--- hw/virtio/virtio-balloon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)hw/virtio/virtio-balloon.c +1
-0@@ -26,6 +26,7 @@#include "qapi/visitor.h" #include "qapi-event.h" #include "trace.h" +#include "hw/mem/nvdimm.h" #if defined(__linux__)#include <sys/mman.h>
hw/virtio/virtio-balloon.c static ram_addr_t get_current_ram_size(void) · line 317
Quoted 10 lines
hw/virtio/virtio-balloon.c +3
-1@@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void)if (value) {switch (value->type) {case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; +if (strcmp (value->u.dimm->type,TYPE_NVDIMM )) { + size += value->u.dimm->size; + }break ;default :break ;
Should this be a blacklist ("don't count TYPE_NVDIMM") or a whitelist ("count TYPE_PC_DIMM")? I guess that depends on whether we think future types are more likely to need counting or not counting.
Re: [Qemu-devel] [PATCH 2/3] pcdimm: add 'type' field to PCDIMMDeviceInfo
In reply to Vladimir Sementsov-OgievskiyQuoted 23 lines · Vladimir Sementsov-Ogievskiy
The field is needed to distinguish pc-dimm and nvdimm.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>---
+++
b/qapi-schema.jsonqapi-schema.json +2
-0@@ -3924,6 +3924,8 @@ # # @hotpluggable: true if device if could be added/removed while machine is running # +# @type: device type: 'pc-dimm' or 'nvdimm' (since 2.6) +# # Since: 2.1 ## { 'struct': 'PCDIMMDeviceInfo',
qapi-schema.json line 3940
Quoted 6 lines
qapi-schema.json +2
-1@@ -3934,7 +3936,8 @@ 'node': 'int', 'memdev': 'str', 'hotplugged': 'bool', - 'hotpluggable': 'bool' + 'hotpluggable': 'bool', + 'type': 'str'
No. Since it is a finite set of values (just two possible), you should be using an enum here rather than open-coded 'str'. Something like:
{ 'enum': 'DIMMType', 'data': [ 'pc-dimm', 'nvdimm' ] }
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning
In reply to Vladimir Sementsov-OgievskiyQuoted 23 lines · Vladimir Sementsov-Ogievskiy
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit
463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memorySigned-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>---
hw/virtio/virtio-balloon.c static ram_addr_t get_current_ram_size(void) · line 312
Quoted 5 lines
hw/virtio/virtio-balloon.c +1
-1@@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void)if (value) {switch (value->type) {case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; +if (strcmp (value->u.dimm->type,TYPE_NVDIMM )) {
If you fix 2/3 to use a QAPI enum, then this will be an integer compare instead of a strcmp().
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 2/3] pcdimm: add 'type' field to PCDIMMDeviceInfo
In reply to Eric BlakeQuoted 32 lines · Eric Blake
Quoted 22 lines · Vladimir Sementsov-Ogievskiy
The field is needed to distinguish pc-dimm and nvdimm.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>---
+++b/qapi-schema.jsonqapi-schema.json +2
-0@@ -3924,6 +3924,8 @@ # # @hotpluggable: true if device if could be added/removed while machine is running # +# @type: device type: 'pc-dimm' or 'nvdimm' (since 2.6) +# # Since: 2.1 ## { 'struct': 'PCDIMMDeviceInfo',qapi-schema.json line 3940
Quoted 6 lines
qapi-schema.json +2
-1@@ -3934,7 +3936,8 @@ 'node': 'int', 'memdev': 'str', 'hotplugged': 'bool', - 'hotpluggable': 'bool' + 'hotpluggable': 'bool', + 'type': 'str'No. Since it is a finite set of values (just two possible), you should be using an enum here rather than open-coded 'str'. Something like:
Quoted 2 lines
{ 'enum': 'DIMMType', 'data': [ 'pc-dimm', 'nvdimm' ] }
Are you sure? This is only output Info, so user will never "set" this field. Also, qemu type system (as I understand) is based on string names. object_dynamic_cast and other functions uses "const char *typename". This enum will be out of qemu type system and we will have to sync it.. Is there already some practice of translating string typenames to enum values?
Signature · 2 lines
Best regards, Vladimir
Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning
In reply to Markus ArmbrusterQuoted 36 lines · Markus Armbruster
Quoted 34 lines · Vladimir Sementsov-Ogievskiy
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit
463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memorySigned-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>--- hw/virtio/virtio-balloon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)hw/virtio/virtio-balloon.c +1
-0@@ -26,6 +26,7 @@#include "qapi/visitor.h" #include "qapi-event.h" #include "trace.h" +#include "hw/mem/nvdimm.h"
Quoted 16 lines
hw/virtio/virtio-balloon.c static ram_addr_t get_current_ram_size(void) · line 317
Quoted 13 lines
hw/virtio/virtio-balloon.c +3
-1#if defined(__linux__)#include <sys/mman.h> @@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void)if (value) {switch (value->type) {case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; +if (strcmp (value->u.dimm->type,TYPE_NVDIMM )) { + size += value->u.dimm->size; + }break ;default :break ;Should this be a blacklist ("don't count
TYPE_NVDIMM") or a whitelist ("countTYPE_PC_DIMM")? I guess that depends on whether we think future types are more likely to need counting or not counting.
May be, to avoid such bugs in future, it would be better to make like a whitelist.
Signature · 2 lines
Best regards, Vladimir
Re: [Qemu-devel] [PATCH 2/3] pcdimm: add 'type' field to PCDIMMDeviceInfo
In reply to Vladimir Sementsov-OgievskiyQuoted 18 lines · Vladimir Sementsov-Ogievskiy
Quoted 15 lines
qapi-schema.json line 3940
Quoted 12 lines
qapi-schema.json +4
-1+# @type: device type: 'pc-dimm' or 'nvdimm' (since 2.6) +# # Since: 2.1 ## { 'struct': 'PCDIMMDeviceInfo',@@ -3934,7 +3936,8 @@ 'node': 'int', 'memdev': 'str', 'hotplugged': 'bool', - 'hotpluggable': 'bool' + 'hotpluggable': 'bool', + 'type': 'str'No. Since it is a finite set of values (just two possible), you should be using an enum here rather than open-coded 'str'. Something like:
Quoted 2 lines
{ 'enum': 'DIMMType', 'data': [ 'pc-dimm', 'nvdimm' ] }
Quoted 6 lines
Are you sure? This is only output Info, so user will never "set" this field. Also, qemu type system (as I understand) is based on string names.
object_dynamic_castand other functions uses "const char *typename". This enum will be out of qemu type system and we will have to sync it.. Is there already some practice of translating string typenames to enum values?
Yes, exposing a finite set of strings as an enum is ideal for the user interface, even if we carry string values instead of enum values in other places in the code. QAPI already includes convenience methods for translating between strings and enum values (EnumName_lookup[] to go from int to string, and qapi_enum_parse() to reverse from string back to enum).
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 2/3] pcdimm: add 'type' field to PCDIMMDeviceInfo
Quoted 27 lines · Eric Blake
Quoted 18 lines · Vladimir Sementsov-Ogievskiy
Quoted 15 lines
qapi-schema.json line 3940
Quoted 12 lines
qapi-schema.json +4
-1+# @type: device type: 'pc-dimm' or 'nvdimm' (since 2.6) +# # Since: 2.1 ## { 'struct': 'PCDIMMDeviceInfo',@@ -3934,7 +3936,8 @@ 'node': 'int', 'memdev': 'str', 'hotplugged': 'bool', - 'hotpluggable': 'bool' + 'hotpluggable': 'bool', + 'type': 'str'No. Since it is a finite set of values (just two possible), you should be using an enum here rather than open-coded 'str'. Something like:
Quoted 2 lines
{ 'enum': 'DIMMType', 'data': [ 'pc-dimm', 'nvdimm' ] }
Quoted 6 lines
Are you sure? This is only output Info, so user will never "set" this field. Also, qemu type system (as I understand) is based on string names.
object_dynamic_castand other functions uses "const char *typename". This enum will be out of qemu type system and we will have to sync it.. Is there already some practice of translating string typenames to enum values?
Quoted 6 lines
Yes, exposing a finite set of strings as an enum is ideal for the user interface, even if we carry string values instead of enum values in other places in the code. QAPI already includes convenience methods for translating between strings and enum values (EnumName_lookup[] to go from int to string, and
qapi_enum_parse()to reverse from string back to enum).
Well, it's not an arbitrary set of strings, it the set of names of concrete subtypes of "pc-dimm". See also my reply to this patch (Message-ID: <[email protected]>), which also shows how to introspect this set.
Doesn't mean we must not create an enum for this set. If we do, we get to map from type name to enum value in qmp_pc_dimm_device_list(). Begs the question what to do when we run into a type name we don't know to map.
The deeper question is whether we want to duplicate sets of QOM type names as QAPI enums in general. I'm leaning towards "we don't", but I'm happy to hear arguments for doing it.
Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning
In reply to Eric BlakeQuoted 23 lines · Eric Blake
Quoted 21 lines · Vladimir Sementsov-Ogievskiy
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit
463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memorySigned-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>---
Quoted 9 lines
hw/virtio/virtio-balloon.c static ram_addr_t get_current_ram_size(void) · line 312
Quoted 6 lines
hw/virtio/virtio-balloon.c +1
-1@@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void)if (value) {switch (value->type) {case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; +if (strcmp (value->u.dimm->type,TYPE_NVDIMM )) {If you fix 2/3 to use a QAPI enum, then this will be an integer compare instead of a
strcmp().
Another option is to add a flag to the subtypes of TYPE_PC_DIMM, set it for the subtypes that should be counted here, and accumulate the sizes of devices where the flag is set. Requires iterating directly over the devices here (like qmp_pc_dimm_device_list() does under the hood) rather than the MemoryDeviceInfoList returned by qmp_pc_dimm_device_list(),
Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning
Quoted 35 lines · On Wed, 03 Feb 2016 16:42:21 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 23 lines · Eric Blake
Quoted 21 lines · Vladimir Sementsov-Ogievskiy
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit
463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memorySigned-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>---
Quoted 9 lines
hw/virtio/virtio-balloon.c static ram_addr_t get_current_ram_size(void) · line 312
Quoted 6 lines
hw/virtio/virtio-balloon.c +1
-1@@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void)if (value) {switch (value->type) {case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; +if (strcmp (value->u.dimm->type,TYPE_NVDIMM )) {If you fix 2/3 to use a QAPI enum, then this will be an integer compare instead of a
strcmp().
Quoted 5 lines
Another option is to add a flag to the subtypes of
TYPE_PC_DIMM, set it for the subtypes that should be counted here, and accumulate the sizes of devices where the flag is set. Requires iterating directly over the devices here (likeqmp_pc_dimm_device_list()does under the hood) rather than the MemoryDeviceInfoList returned byqmp_pc_dimm_device_list(),
I'd rather not add flag to TYPE_PC_DIMM state/class as its purely balloon qemu/guest driver limit and not related to [pc-|nv]in general. Lets whitelist balloon supported type here.
Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning
In reply to Markus ArmbrusterQuoted 32 lines · Markus Armbruster
Quoted 22 lines · Eric Blake
Quoted 21 lines · Vladimir Sementsov-Ogievskiy
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit
463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memorySigned-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>---
Quoted 8 lines
hw/virtio/virtio-balloon.c static ram_addr_t get_current_ram_size(void) · line 312
Quoted 6 lines
hw/virtio/virtio-balloon.c +1
-1@@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void)if (value) {switch (value->type) {case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; +if (strcmp (value->u.dimm->type,TYPE_NVDIMM )) {If you fix 2/3 to use a QAPI enum, then this will be an integer compare instead of a
strcmp().
Quoted 5 lines
Another option is to add a flag to the subtypes of
TYPE_PC_DIMM, set it for the subtypes that should be counted here, and accumulate the sizes of devices where the flag is set. Requires iterating directly over the devices here (likeqmp_pc_dimm_device_list()does under the hood) rather than the MemoryDeviceInfoList returned byqmp_pc_dimm_device_list(),
It was my first approach but it was rejected)
As another option I can make a function iterating over the devices and return list of them, and then use it instead of qmp_pc_dimm_device_list.. Then, I'll have pointers to devices and can use object_dynamic_cast.
Signature · 2 lines
Best regards, Vladimir
Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning
Quoted 38 lines · Vladimir Sementsov-Ogievskiy
Quoted 32 lines · Markus Armbruster
Quoted 22 lines · Eric Blake
Quoted 21 lines · Vladimir Sementsov-Ogievskiy
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit
463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memorySigned-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>---
Quoted 8 lines
hw/virtio/virtio-balloon.c static ram_addr_t get_current_ram_size(void) · line 312
Quoted 6 lines
hw/virtio/virtio-balloon.c +1
-1@@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void)if (value) {switch (value->type) {case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; +if (strcmp (value->u.dimm->type,TYPE_NVDIMM )) {If you fix 2/3 to use a QAPI enum, then this will be an integer compare instead of a
strcmp().Quoted 5 lines
Another option is to add a flag to the subtypes of
TYPE_PC_DIMM, set it for the subtypes that should be counted here, and accumulate the sizes of devices where the flag is set. Requires iterating directly over the devices here (likeqmp_pc_dimm_device_list()does under the hood) rather than the MemoryDeviceInfoList returned byqmp_pc_dimm_device_list(),
Quoted 6 lines
It was my first approach but it was rejected)
As another option I can make a function iterating over the devices and return list of them, and then use it instead of
qmp_pc_dimm_device_list.. Then, I'll have pointers to devices and can useobject_dynamic_cast.
I fail to see how splitting a tree walk doing stuff into a tree walk creating a list and a list walk doing stuff makes things better :)
Anyway, you guys figure it out. The only part where I get involved is QAPI design.
Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning
Quoted 40 lines · Markus Armbruster
Quoted 38 lines · Vladimir Sementsov-Ogievskiy
Quoted 37 lines · Markus Armbruster
Quoted 22 lines · Eric Blake
Quoted 21 lines · Vladimir Sementsov-Ogievskiy
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit
463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memorySigned-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>---
Quoted 8 lines
hw/virtio/virtio-balloon.c static ram_addr_t get_current_ram_size(void) · line 312
Quoted 6 lines
hw/virtio/virtio-balloon.c +1
-1@@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void)if (value) {switch (value->type) {case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; +if (strcmp (value->u.dimm->type,TYPE_NVDIMM )) {If you fix 2/3 to use a QAPI enum, then this will be an integer compare instead of a
strcmp().Another option is to add a flag to the subtypes of
TYPE_PC_DIMM, set it for the subtypes that should be counted here, and accumulate the sizes of devices where the flag is set. Requires iterating directly over the devices here (likeqmp_pc_dimm_device_list()does under the hood) rather than the MemoryDeviceInfoList returned byqmp_pc_dimm_device_list(),
Quoted 8 lines
Quoted 6 lines
It was my first approach but it was rejected)
As another option I can make a function iterating over the devices and return list of them, and then use it instead of
qmp_pc_dimm_device_list.. Then, I'll have pointers to devices and can useobject_dynamic_cast.I fail to see how splitting a tree walk doing stuff into a tree walk creating a list and a list walk doing stuff makes things better :)
It will allow me not touch qapi)
Quoted 3 lines
Anyway, you guys figure it out. The only part where I get involved is QAPI design.
Signature · 2 lines
Best regards, Vladimir
Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning
Quoted 36 lines · Vladimir Sementsov-Ogievskiy
Quoted 35 lines · Markus Armbruster
Quoted 33 lines · Vladimir Sementsov-Ogievskiy
Quoted 32 lines · Markus Armbruster
Quoted 30 lines · Eric Blake
Quoted 22 lines · Vladimir Sementsov-Ogievskiy
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit
463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memorySigned-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>---
hw/virtio/virtio-balloon.c static ram_addr_t get_current_ram_size(void) · line 312
Quoted 5 lines
hw/virtio/virtio-balloon.c +1
-1@@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void)if (value) {switch (value->type) {case MEMORY_DEVICE_INFO_KIND_DIMM : - size += value->u.dimm->size; +if (strcmp (value->u.dimm->type,TYPE_NVDIMM )) {If you fix 2/3 to use a QAPI enum, then this will be an integer compare instead of a
strcmp().
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Another option is to add a flag to the subtypes of
TYPE_PC_DIMM, set it for the subtypes that should be counted here, and accumulate the sizes of devices where the flag is set. Requires iterating directly over the devices here (likeqmp_pc_dimm_device_list()does under the hood) rather than the MemoryDeviceInfoList returned byqmp_pc_dimm_device_list(),It was my first approach but it was rejected)
Sounds like your first approach was the right approach.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
As another option I can make a function iterating over the devices and return list of them, and then use it instead of
qmp_pc_dimm_device_list.. Then, I'll have pointers to devices and can useobject_dynamic_cast.I fail to see how splitting a tree walk doing stuff into a tree walk creating a list and a list walk doing stuff makes things better :)
It will allow me not touch qapi)
Whatever it takes to get this fix past the gaggle of maintainers (I can relate to that).
[...]
Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning
Quoted 50 lines · Markus Armbruster
Quoted 36 lines · Vladimir Sementsov-Ogievskiy
Quoted 35 lines · Markus Armbruster
Quoted 33 lines · Vladimir Sementsov-Ogievskiy
Quoted 32 lines · Markus Armbruster
Quoted 30 lines · Eric Blake
Quoted 22 lines · Vladimir Sementsov-Ogievskiy
NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs.
In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram.
Counting dimm devices as part of the ram for ballooning was started from commit
463756d03:
virtio-balloon: Fix balloon not working correctly when hotplug memorySigned-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Stefan Hajnoczi <[email protected]>CC Xiao Guangrong <[email protected]>CC "Michael S. Tsirkin" <[email protected]>CC Igor Mammedov <[email protected]>CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>---
Review static ram_addr_t get_current_ram_size(void) · line 312
Quoted 5 lines
(quoted diff) +1
-1@@ -308,7 +309,9 @@ static ram_addr_t get_current_ram_size(void) if (value) { switch (value->type) { case MEMORY_DEVICE_INFO_KIND_DIMM: - size += value->u.dimm->size; + if (strcmp(value->u.dimm->type, TYPE_NVDIMM)) {If you fix 2/3 to use a QAPI enum, then this will be an integer compare instead of a
strcmp().Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Another option is to add a flag to the subtypes of
TYPE_PC_DIMM, set it for the subtypes that should be counted here, and accumulate the sizes of devices where the flag is set. Requires iterating directly over the devices here (likeqmp_pc_dimm_device_list()does under the hood) rather than the MemoryDeviceInfoList returned byqmp_pc_dimm_device_list(),It was my first approach but it was rejected)
Sounds like your first approach was the right approach.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
As another option I can make a function iterating over the devices and return list of them, and then use it instead of
qmp_pc_dimm_device_list.. Then, I'll have pointers to devices and can useobject_dynamic_cast.
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
I fail to see how splitting a tree walk doing stuff into a tree walk creating a list and a list walk doing stuff makes things better :)
It will allow me not touch qapi)
Whatever it takes to get this fix past the gaggle of maintainers (I can relate to that).
[...]
Everything is in your hands). I'm not mind if someone take any of this series versions, tune it as he wants and merge. It is a bug fix, but the discussion looks like I'm trying to add a new feature)
Signature · 2 lines
Best regards, Vladimir