Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1202129
| From | "Philip P. Moltmann" <moltmann@vmware.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v5 6/7] VMware balloon: Treat init like reset |
| Date | 2015-08-07 00:30 +0200 |
| Message-ID | <pUBPH-5As-15@gated-at.bofh.it> (permalink) |
| References | <pUBG2-5pj-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Unify the behavior of the first start of the balloon and a reset. Also on
unload, declare that the balloon driver does not have any capabilities
anymore.
Acked-by: Andy King <acking@vmware.com>
Signed-off-by: Xavier Deguillard <xdeguillard@vmware.com>
---
drivers/misc/vmw_balloon.c | 53 ++++++++++++++++------------------------------
1 file changed, 18 insertions(+), 35 deletions(-)
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 01519ff..28fe9e5 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -47,7 +47,7 @@
MODULE_AUTHOR("VMware, Inc.");
MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver");
-MODULE_VERSION("1.4.0.0-k");
+MODULE_VERSION("1.4.1.0-k");
MODULE_ALIAS("dmi:*:svnVMware*:*");
MODULE_ALIAS("vmware_vmmemctl");
MODULE_LICENSE("GPL");
@@ -564,12 +564,14 @@ static void vmballoon_pop(struct vmballoon *b)
}
}
- if ((b->capabilities & VMW_BALLOON_BATCHED_CMDS) != 0) {
- if (b->batch_page)
- vunmap(b->batch_page);
+ if (b->batch_page) {
+ vunmap(b->batch_page);
+ b->batch_page = NULL;
+ }
- if (b->page)
- __free_page(b->page);
+ if (b->page) {
+ __free_page(b->page);
+ b->page = NULL;
}
}
@@ -1044,7 +1046,7 @@ static void vmballoon_work(struct work_struct *work)
if (b->slow_allocation_cycles > 0)
b->slow_allocation_cycles--;
- if (vmballoon_send_get_target(b, &target)) {
+ if (!b->reset_required && vmballoon_send_get_target(b, &target)) {
/* update target, adjust size */
b->target = target;
@@ -1076,8 +1078,10 @@ static int vmballoon_debug_show(struct seq_file *f, void *offset)
/* format capabilities info */
seq_printf(f,
"balloon capabilities: %#4x\n"
- "used capabilities: %#4lx\n",
- VMW_BALLOON_CAPABILITIES, b->capabilities);
+ "used capabilities: %#4lx\n"
+ "is resetting: %c\n",
+ VMW_BALLOON_CAPABILITIES, b->capabilities,
+ b->reset_required ? 'y' : 'n');
/* format size info */
seq_printf(f,
@@ -1196,35 +1200,14 @@ static int __init vmballoon_init(void)
INIT_DELAYED_WORK(&balloon.dwork, vmballoon_work);
- /*
- * Start balloon.
- */
- if (!vmballoon_send_start(&balloon, VMW_BALLOON_CAPABILITIES)) {
- pr_err("failed to send start command to the host\n");
- return -EIO;
- }
-
- if ((balloon.capabilities & VMW_BALLOON_BATCHED_CMDS) != 0) {
- balloon.ops = &vmballoon_batched_ops;
- balloon.batch_max_pages = VMW_BALLOON_BATCH_MAX_PAGES;
- if (!vmballoon_init_batching(&balloon)) {
- pr_err("failed to init batching\n");
- return -EIO;
- }
- } else if ((balloon.capabilities & VMW_BALLOON_BASIC_CMDS) != 0) {
- balloon.ops = &vmballoon_basic_ops;
- balloon.batch_max_pages = 1;
- }
-
- if (!vmballoon_send_guest_id(&balloon)) {
- pr_err("failed to send guest ID to the host\n");
- return -EIO;
- }
-
error = vmballoon_debugfs_init(&balloon);
if (error)
return error;
+ balloon.batch_page = NULL;
+ balloon.page = NULL;
+ balloon.reset_required = true;
+
queue_delayed_work(system_freezable_wq, &balloon.dwork, 0);
return 0;
@@ -1242,7 +1225,7 @@ static void __exit vmballoon_exit(void)
* Reset connection before deallocating memory to avoid potential for
* additional spurious resets from guest touching deallocated pages.
*/
- vmballoon_send_start(&balloon, VMW_BALLOON_CAPABILITIES);
+ vmballoon_send_start(&balloon, 0);
vmballoon_pop(&balloon);
}
module_exit(vmballoon_exit);
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v3 3/9] VMware balloon: add batching to the vmw_balloon. Greg KH <gregkh@linuxfoundation.org> - 2015-08-05 22:20 +0200
[PATCH v4 3/9] VMware balloon: add batching to the vmw_balloon. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 00:40 +0200
Re: [PATCH v4 3/9] VMware balloon: add batching to the vmw_balloon. Philip Moltmann <moltmann@vmware.com> - 2015-08-06 00:50 +0200
Re: [PATCH v4 3/9] VMware balloon: add batching to the vmw_balloon. "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org> - 2015-08-06 01:30 +0200
[PATCH v4 0/9] Fourth revision of the performance improvement patch to the VMware balloon driver "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 22:40 +0200
[PATCH v4 5/9] VMware balloon: Show capabilities of balloon and resulting capabilities in the debug-fs node. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 22:40 +0200
[PATCH v4 6/9] VMware balloon: Do not limit the amount of frees and allocations in non-sleep mode. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 22:40 +0200
[PATCH v4 8/9] VMware balloon: Treat init like reset "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 22:40 +0200
[PATCH v4 4/9] VMware balloon: Update balloon target on each lock/unlock. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 22:40 +0200
[PATCH v4 1/9] VMware balloon: partially inline vmballoon_reserve_page. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 22:40 +0200
Re: [PATCH v4 1/9] VMware balloon: partially inline vmballoon_reserve_page. Greg KH <gregkh@linuxfoundation.org> - 2015-08-06 23:10 +0200
[PATCH v5 0/7] Fifth revision of the performance improvement patch to the VMware balloon driver "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-07 00:30 +0200
[PATCH v5 4/7] VMware balloon: Do not limit the amount of frees and allocations in non-sleep mode. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-07 00:30 +0200
[PATCH v5 2/7] VMware balloon: Update balloon target on each lock/unlock. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-07 00:30 +0200
[PATCH v5 6/7] VMware balloon: Treat init like reset "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-07 00:30 +0200
[PATCH v5 5/7] VMware balloon: Support 2m page ballooning. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-07 00:30 +0200
[PATCH v5 1/7] VMware balloon: add batching to the vmw_balloon. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-07 00:30 +0200
[PATCH v5 7/7] VMware balloon: Enable notification via VMCI "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-07 00:30 +0200
Re: [PATCH v5 0/7] Fifth revision of the performance improvement patch to the VMware balloon driver Philip Moltmann <moltmann@vmware.com> - 2015-08-15 01:30 +0200
[PATCH v4 3/9] VMware balloon: add batching to the vmw_balloon. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 22:40 +0200
[PATCH v4 2/9] VMware balloon: Add support for balloon capabilities. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 22:40 +0200
[PATCH v4 7/9] VMware balloon: Support 2m page ballooning. "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 22:40 +0200
[PATCH v4 9/9] VMware balloon: Enable notification via VMCI "Philip P. Moltmann" <moltmann@vmware.com> - 2015-08-06 22:40 +0200
Re: [PATCH v4 3/9] VMware balloon: add batching to the vmw_balloon. Greg KH <gregkh@linuxfoundation.org> - 2015-08-06 00:50 +0200
csiph-web