LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nadav Amit <namit@vmware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Xavier Deguillard <xdeguillard@vmware.com>,
	<linux-kernel@vger.kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Nadav Amit <namit@vmware.com>
Subject: [PATCH 5/7] vmw_balloon: VMCI_DOORBELL_SET does not check status
Date: Wed, 13 Jun 2018 04:03:57 -0700	[thread overview]
Message-ID: <20180613110359.109033-6-namit@vmware.com> (raw)
In-Reply-To: <20180613110359.109033-1-namit@vmware.com>

When vmballoon_vmci_init() sets a doorbell using VMCI_DOORBELL_SET, for
some reason it does not consider the status and looks at the result.
However, the hypervisor does not update the result - it updates the
status.

Fixes: 48e3d668b790 ("VMware balloon: Enable notification via VMCI")

Reviewed-by: Xavier Deguillard <xdeguillard@vmware.com>
Signed-off-by: Nadav Amit <namit@vmware.com>
---
 drivers/misc/vmw_balloon.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index db3cf91a515d..6e0b09b79fb5 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -1034,29 +1034,30 @@ static void vmballoon_vmci_cleanup(struct vmballoon *b)
  */
 static int vmballoon_vmci_init(struct vmballoon *b)
 {
-	int error = 0;
+	unsigned long error, dummy;
 
-	if ((b->capabilities & VMW_BALLOON_SIGNALLED_WAKEUP_CMD) != 0) {
-		error = vmci_doorbell_create(&b->vmci_doorbell,
-				VMCI_FLAG_DELAYED_CB,
-				VMCI_PRIVILEGE_FLAG_RESTRICTED,
-				vmballoon_doorbell, b);
-
-		if (error == VMCI_SUCCESS) {
-			VMWARE_BALLOON_CMD(VMCI_DOORBELL_SET,
-					b->vmci_doorbell.context,
-					b->vmci_doorbell.resource, error);
-			STATS_INC(b->stats.doorbell_set);
-		}
-	}
+	if ((b->capabilities & VMW_BALLOON_SIGNALLED_WAKEUP_CMD) == 0)
+		return 0;
 
-	if (error != 0) {
-		vmballoon_vmci_cleanup(b);
+	error = vmci_doorbell_create(&b->vmci_doorbell, VMCI_FLAG_DELAYED_CB,
+				     VMCI_PRIVILEGE_FLAG_RESTRICTED,
+				     vmballoon_doorbell, b);
 
-		return -EIO;
-	}
+	if (error != VMCI_SUCCESS)
+		goto fail;
+
+	error = VMWARE_BALLOON_CMD(VMCI_DOORBELL_SET, b->vmci_doorbell.context,
+				   b->vmci_doorbell.resource, dummy);
+
+	STATS_INC(b->stats.doorbell_set);
+
+	if (error != VMW_BALLOON_SUCCESS)
+		goto fail;
 
 	return 0;
+fail:
+	vmballoon_vmci_cleanup(b);
+	return -EIO;
 }
 
 /*
-- 
2.17.0


  parent reply	other threads:[~2018-06-13 18:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 11:03 [PATCH 0/7] vmw_balloon: addressing bugs and issues Nadav Amit
2018-06-13 11:03 ` [PATCH 1/7] vmw_balloon: update copyright message Nadav Amit
2018-06-13 18:20   ` Greg Kroah-Hartman
2018-06-13 18:24     ` Nadav Amit
2018-06-13 11:03 ` [PATCH 2/7] vmw_balloon: update maintainers list Nadav Amit
2018-06-13 11:03 ` [PATCH 3/7] vmw_balloon: fix inflation of 64-bit GFNs Nadav Amit
2018-06-13 18:21   ` Greg Kroah-Hartman
2018-06-13 18:27     ` Nadav Amit
2018-06-13 11:03 ` [PATCH 4/7] vmw_balloon: do not use 2MB without batching Nadav Amit
2018-06-13 11:03 ` Nadav Amit [this message]
2018-06-13 11:03 ` [PATCH 6/7] vmw_balloon: fix VMCI use when balloon built into kernel Nadav Amit
2018-06-13 11:03 ` [PATCH 7/7] vmw_balloon: remove inflation rate limiting Nadav Amit

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=20180613110359.109033-6-namit@vmware.com \
    --to=namit@vmware.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xdeguillard@vmware.com \
    --subject='Re: [PATCH 5/7] vmw_balloon: VMCI_DOORBELL_SET does not check status' \
    /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

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).