* [Qemu-devel] [PATCH v3 0/2] nvdimm: disable balloon
@ 2016-01-27 13:24 Denis V. Lunev
2016-01-27 13:24 ` [Qemu-devel] [PATCH 1/2] move get_current_ram_size to virtio-balloon.c Denis V. Lunev
2016-01-27 13:24 ` [Qemu-devel] [PATCH 2/2] nvdimm: disable balloon Denis V. Lunev
0 siblings, 2 replies; 6+ messages in thread
From: Denis V. Lunev @ 2016-01-27 13:24 UTC (permalink / raw)
Cc: Vladimir Sementsov-Ogievskiy, Xiao Guangrong, Michael S. Tsirkin,
qemu-devel, Markus Armbruster, Stefan Hajnoczi, Igor Mammedov,
Denis V. Lunev
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.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Xiao Guangrong <guangrong.xiao@linux.intel.com>
CC: "Michael S. Tsirkin" <mst@redhat.com>
CC: Igor Mammedov <imammedo@redhat.com>
CC: Eric Blake <eblake@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
v3:
- do not use additional class variable
Vladimir Sementsov-Ogievskiy (2):
move get_current_ram_size to virtio-balloon.c
nvdimm: disable balloon
hw/mem/pc-dimm.c | 28 ++--------------------------
hw/virtio/virtio-balloon.c | 28 ++++++++++++++++++++++++++++
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(-)
--
2.5.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/2] move get_current_ram_size to virtio-balloon.c
2016-01-27 13:24 [Qemu-devel] [PATCH v3 0/2] nvdimm: disable balloon Denis V. Lunev
@ 2016-01-27 13:24 ` Denis V. Lunev
2016-01-27 20:50 ` Eric Blake
2016-01-27 13:24 ` [Qemu-devel] [PATCH 2/2] nvdimm: disable balloon Denis V. Lunev
1 sibling, 1 reply; 6+ messages in thread
From: Denis V. Lunev @ 2016-01-27 13:24 UTC (permalink / raw)
Cc: Vladimir Sementsov-Ogievskiy, Xiao Guangrong, Michael S. Tsirkin,
qemu-devel, Markus Armbruster, Stefan Hajnoczi, Igor Mammedov,
Denis V. Lunev
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
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.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Xiao Guangrong <guangrong.xiao@linux.intel.com>
CC: "Michael S. Tsirkin" <mst@redhat.com>
CC: Igor Mammedov <imammedo@redhat.com>
CC: Eric Blake <eblake@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
---
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(-)
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index d5cdab2..4f30950 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -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;
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 9671635..6a4c4d2 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -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)
{
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 85aa403..a0ad2ac 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -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 */
diff --git a/stubs/qmp_pc_dimm_device_list.c b/stubs/qmp_pc_dimm_device_list.c
index b584bd8..5cb220c 100644
--- a/stubs/qmp_pc_dimm_device_list.c
+++ b/stubs/qmp_pc_dimm_device_list.c
@@ -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;
-}
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/2] nvdimm: disable balloon
2016-01-27 13:24 [Qemu-devel] [PATCH v3 0/2] nvdimm: disable balloon Denis V. Lunev
2016-01-27 13:24 ` [Qemu-devel] [PATCH 1/2] move get_current_ram_size to virtio-balloon.c Denis V. Lunev
@ 2016-01-27 13:24 ` Denis V. Lunev
2016-01-27 14:31 ` Igor Mammedov
2016-01-27 20:52 ` Eric Blake
1 sibling, 2 replies; 6+ messages in thread
From: Denis V. Lunev @ 2016-01-27 13:24 UTC (permalink / raw)
Cc: Vladimir Sementsov-Ogievskiy, Xiao Guangrong, Michael S. Tsirkin,
qemu-devel, Markus Armbruster, Stefan Hajnoczi, Igor Mammedov,
Denis V. Lunev
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
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 memory
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Xiao Guangrong <guangrong.xiao@linux.intel.com>
CC: "Michael S. Tsirkin" <mst@redhat.com>
CC: Igor Mammedov <imammedo@redhat.com>
CC: Eric Blake <eblake@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
---
hw/mem/pc-dimm.c | 2 ++
hw/virtio/virtio-balloon.c | 4 +++-
qapi-schema.json | 5 ++++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 4f30950..2ff9f95 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -19,6 +19,7 @@
*/
#include "hw/mem/pc-dimm.h"
+#include "hw/mem/nvdimm.h"
#include "qemu/config-file.h"
#include "qapi/visitor.h"
#include "qemu/range.h"
@@ -178,6 +179,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->balloonable = (object_dynamic_cast(obj, TYPE_NVDIMM) == NULL);
info->u.dimm = di;
elem->value = info;
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 6a4c4d2..0a3de75 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -308,7 +308,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 (value->u.dimm->balloonable) {
+ size += value->u.dimm->size;
+ }
break;
default:
break;
diff --git a/qapi-schema.json b/qapi-schema.json
index 8d04897..5934f81 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3924,6 +3924,8 @@
#
# @hotpluggable: true if device if could be added/removed while machine is running
#
+# @balloonable: true if device take part in ballooning (since 2.6)
+#
# Since: 2.1
##
{ 'struct': 'PCDIMMDeviceInfo',
@@ -3934,7 +3936,8 @@
'node': 'int',
'memdev': 'str',
'hotplugged': 'bool',
- 'hotpluggable': 'bool'
+ 'hotpluggable': 'bool',
+ 'balloonable': 'bool'
}
}
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] nvdimm: disable balloon
2016-01-27 13:24 ` [Qemu-devel] [PATCH 2/2] nvdimm: disable balloon Denis V. Lunev
@ 2016-01-27 14:31 ` Igor Mammedov
2016-01-27 20:52 ` Eric Blake
1 sibling, 0 replies; 6+ messages in thread
From: Igor Mammedov @ 2016-01-27 14:31 UTC (permalink / raw)
To: Denis V. Lunev
Cc: Vladimir Sementsov-Ogievskiy, Xiao Guangrong, Michael S. Tsirkin,
qemu-devel, Markus Armbruster, Stefan Hajnoczi, lcapitulino
On Wed, 27 Jan 2016 16:24:29 +0300
"Denis V. Lunev" <den@openvz.org> wrote:
suggest to change subj to: don't use NVDIMM for balooning
> From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> 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 memory
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Xiao Guangrong <guangrong.xiao@linux.intel.com>
> CC: "Michael S. Tsirkin" <mst@redhat.com>
> CC: Igor Mammedov <imammedo@redhat.com>
> CC: Eric Blake <eblake@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> ---
> hw/mem/pc-dimm.c | 2 ++
> hw/virtio/virtio-balloon.c | 4 +++-
> qapi-schema.json | 5 ++++-
> 3 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index 4f30950..2ff9f95 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -19,6 +19,7 @@
> */
>
> #include "hw/mem/pc-dimm.h"
> +#include "hw/mem/nvdimm.h"
> #include "qemu/config-file.h"
> #include "qapi/visitor.h"
> #include "qemu/range.h"
> @@ -178,6 +179,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->balloonable = (object_dynamic_cast(obj, TYPE_NVDIMM) == NULL);
I don't think that balloonable is property of DIMM and that it should be
displayed by MemoryDeviceInfo.
I'd drop this + the last hunk and put check directly into get_current_ram_size()
in this patch.
And another path on top that adds 'type' to PCDIMMDeviceInfo and shows
it in hmp_info_memory_devices() so that management tools/users would be
able to distinguish entries.
>
> info->u.dimm = di;
> elem->value = info;
> diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
> index 6a4c4d2..0a3de75 100644
> --- a/hw/virtio/virtio-balloon.c
> +++ b/hw/virtio/virtio-balloon.c
> @@ -308,7 +308,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 (value->u.dimm->balloonable) {
> + size += value->u.dimm->size;
> + }
> break;
> default:
> break;
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 8d04897..5934f81 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -3924,6 +3924,8 @@
> #
> # @hotpluggable: true if device if could be added/removed while machine is running
> #
> +# @balloonable: true if device take part in ballooning (since 2.6)
> +#
> # Since: 2.1
> ##
> { 'struct': 'PCDIMMDeviceInfo',
> @@ -3934,7 +3936,8 @@
> 'node': 'int',
> 'memdev': 'str',
> 'hotplugged': 'bool',
> - 'hotpluggable': 'bool'
> + 'hotpluggable': 'bool',
> + 'balloonable': 'bool'
> }
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] move get_current_ram_size to virtio-balloon.c
2016-01-27 13:24 ` [Qemu-devel] [PATCH 1/2] move get_current_ram_size to virtio-balloon.c Denis V. Lunev
@ 2016-01-27 20:50 ` Eric Blake
0 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2016-01-27 20:50 UTC (permalink / raw)
To: Denis V. Lunev
Cc: Vladimir Sementsov-Ogievskiy, Xiao Guangrong, Michael S. Tsirkin,
qemu-devel, Markus Armbruster, Stefan Hajnoczi, Igor Mammedov
[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]
On 01/27/2016 06:24 AM, Denis V. Lunev wrote:
> From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> 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.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Xiao Guangrong <guangrong.xiao@linux.intel.com>
> CC: "Michael S. Tsirkin" <mst@redhat.com>
> CC: Igor Mammedov <imammedo@redhat.com>
> CC: Eric Blake <eblake@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> ---
> 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(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] nvdimm: disable balloon
2016-01-27 13:24 ` [Qemu-devel] [PATCH 2/2] nvdimm: disable balloon Denis V. Lunev
2016-01-27 14:31 ` Igor Mammedov
@ 2016-01-27 20:52 ` Eric Blake
1 sibling, 0 replies; 6+ messages in thread
From: Eric Blake @ 2016-01-27 20:52 UTC (permalink / raw)
To: Denis V. Lunev
Cc: Vladimir Sementsov-Ogievskiy, Xiao Guangrong, Michael S. Tsirkin,
qemu-devel, Markus Armbruster, Stefan Hajnoczi, Igor Mammedov
[-- Attachment #1: Type: text/plain, Size: 2451 bytes --]
On 01/27/2016 06:24 AM, Denis V. Lunev wrote:
> From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> 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.
Intentional mid-line break?
>
> 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
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Xiao Guangrong <guangrong.xiao@linux.intel.com>
> CC: "Michael S. Tsirkin" <mst@redhat.com>
> CC: Igor Mammedov <imammedo@redhat.com>
> CC: Eric Blake <eblake@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> ---
> hw/mem/pc-dimm.c | 2 ++
> hw/virtio/virtio-balloon.c | 4 +++-
> qapi-schema.json | 5 ++++-
> 3 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index 4f30950..2ff9f95 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -19,6 +19,7 @@
> */
>
> #include "hw/mem/pc-dimm.h"
> +#include "hw/mem/nvdimm.h"
> #include "qemu/config-file.h"
> #include "qapi/visitor.h"
> #include "qemu/range.h"
> @@ -178,6 +179,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->balloonable = (object_dynamic_cast(obj, TYPE_NVDIMM) == NULL);
The outer () seem spurious to me; I might have shortened this to:
di->balloonable = !object_dynamic_cast(obj, TYPE_NVDIMM);
> +++ b/qapi-schema.json
> @@ -3924,6 +3924,8 @@
> #
> # @hotpluggable: true if device if could be added/removed while machine is running
> #
> +# @balloonable: true if device take part in ballooning (since 2.6)
s/take/takes/
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-01-27 20:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 13:24 [Qemu-devel] [PATCH v3 0/2] nvdimm: disable balloon Denis V. Lunev
2016-01-27 13:24 ` [Qemu-devel] [PATCH 1/2] move get_current_ram_size to virtio-balloon.c Denis V. Lunev
2016-01-27 20:50 ` Eric Blake
2016-01-27 13:24 ` [Qemu-devel] [PATCH 2/2] nvdimm: disable balloon Denis V. Lunev
2016-01-27 14:31 ` Igor Mammedov
2016-01-27 20:52 ` Eric Blake
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).