All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philip P. Moltmann" <moltmann@vmware.com>
To: dmitry.torokhov@gmail.com
Cc: "Philip P. Moltmann" <moltmann@vmware.com>,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	xdeguillard@vmware.com, akpm@linux-foundation.org,
	pv-drivers@vmware.com
Subject: [PATCH v2 8/9] VMware balloon: Treat init like reset
Date: Thu, 11 Jun 2015 13:43:03 -0700	[thread overview]
Message-ID: <1434055384-3192-9-git-send-email-moltmann@vmware.com> (raw)
In-Reply-To: <1434055384-3192-1-git-send-email-moltmann@vmware.com>
In-Reply-To: <0150416205555.GA21618@dtor-ws>

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 cbaf329..cc4953d 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -46,7 +46,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");
@@ -563,12 +563,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;
 	}
 }
 
@@ -1043,7 +1045,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;
 
@@ -1075,8 +1077,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,
@@ -1195,35 +1199,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;
@@ -1241,7 +1224,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


  parent reply	other threads:[~2015-06-11 20:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0150416205555.GA21618@dtor-ws>
2015-06-11 20:42 ` [PATCH v2 0/9] Second revision of the performance improvement patch to the VMware balloon driver Philip P. Moltmann
2015-06-11 20:42 ` [PATCH v2 1/9] VMware balloon: partially inline vmballoon_reserve_page Philip P. Moltmann
2015-06-11 20:42 ` [PATCH v2 2/9] VMware balloon: Add support for balloon capabilities Philip P. Moltmann
2015-06-11 20:42 ` [PATCH v2 3/9] VMware balloon: add batching to the vmw_balloon Philip P. Moltmann
2015-06-11 20:42 ` [PATCH v2 4/9] VMware balloon: Update balloon target on each lock/unlock Philip P. Moltmann
2015-06-11 20:43 ` [PATCH v2 5/9] VMware balloon: Show capabilities of balloon and resulting capabilities in the debug-fs node Philip P. Moltmann
2015-06-11 20:43 ` [PATCH v2 6/9] VMware balloon: Do not limit the amount of frees and allocations in non-sleep mode Philip P. Moltmann
2015-06-11 20:43 ` [PATCH v2 7/9] VMware balloon: Support 2m page ballooning Philip P. Moltmann
2015-06-11 20:43 ` Philip P. Moltmann [this message]
2015-06-11 20:43 ` [PATCH v2 9/9] VMware balloon: Enable notification via VMCI Philip P. Moltmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434055384-3192-9-git-send-email-moltmann@vmware.com \
    --to=moltmann@vmware.com \
    --cc=akpm@linux-foundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pv-drivers@vmware.com \
    --cc=xdeguillard@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.