Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1142559imm; Wed, 13 Jun 2018 14:10:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJtDXiCZLj4iB6efbLvAUY+QtNOcz/bc/nBqI64BnHNNu8oXBc6akPqVOpnnp3u9XypTRpT X-Received: by 2002:a65:4287:: with SMTP id j7-v6mr5439964pgp.144.1528924211035; Wed, 13 Jun 2018 14:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528924211; cv=none; d=google.com; s=arc-20160816; b=lh55gdPaDY7qu9BSjrf5TKuRQqGLIFjQTtf7YmfRf637XofKRD48XEFCh3wfjGYEp5 BQ1zbrIl5ZdWy36dFfPRZhJiG0xeL4d9UHTscmB7VWOzW71HBs6g7iizCRLeL2IlrDTK W73KQp3Yk4pgelGPkcOQsTSyhj13mDIsROiHKzuKmvMTQDr7Hel1CGJtWUVMqQazbRQr gwWfsZ76V7bNgaW9aNNmEkCbWPT3xNXhiJCU4zOf/aaXDH2hHLjA9ntzRsFCDKWA1Mbe gQZTAp2kvyvpiF42zve6pt1ww80Dxh0+PZsoeyav8BrMKIYm2HU7hkDTHKcyeZdfUBrZ UZPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=7z+vC3hg9IT4uIhwk/xA6nPlTxhFj3ZkoZyDQhqe9k8=; b=VhZlK8gy+CJqZcSsTaXneQhQQdMjxHHq0QqXpY5NzpKBWzS69KHGrnfXxL26IJrkil qCLKKle2QCwIgYM5Mf97EwgUgofofAVcSwf7qqPftWs+9v5ASjcxha01qz18VJeeVrt4 FZp8J+CKCjM96Lp4kWbzWZvBGoa57egaq4pSJdKQZfeS8wvp+KlrIAFCuWLzzXh3kWw/ gAuKagavCUdvyGi4ZczTMENXpvDrmxmnsE8fgwBdbPHJLVDDkM5tqSUH28W+CED2mvnx aM3Akltm9nieFeAqZr2X+3Tdy4ityNgodGhhYVnd1xoouuuTei6BGM8ru9JSZfUea5nU t2HA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b15-v6si3699494pfc.320.2018.06.13.14.09.56; Wed, 13 Jun 2018 14:10:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964777AbeFMVJV (ORCPT + 99 others); Wed, 13 Jun 2018 17:09:21 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:49469 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935842AbeFMVJQ (ORCPT ); Wed, 13 Jun 2018 17:09:16 -0400 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Wed, 13 Jun 2018 14:08:50 -0700 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id EA889409B8; Wed, 13 Jun 2018 14:09:15 -0700 (PDT) From: Nadav Amit To: Greg Kroah-Hartman CC: Xavier Deguillard , , Arnd Bergmann , Nadav Amit , Subject: [PATCH v2 3/7] vmw_balloon: VMCI_DOORBELL_SET does not check status Date: Wed, 13 Jun 2018 06:54:08 -0700 Message-ID: <20180613135412.81660-4-namit@vmware.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180613135412.81660-1-namit@vmware.com> References: <20180613135412.81660-1-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-001.vmware.com: namit@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. This might cause VMCI doorbell not to be enabled, resulting in degraded performance. Fixes: 48e3d668b790 ("VMware balloon: Enable notification via VMCI") Cc: stable@vger.kernel.org Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- 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 60ab83d3d0ef..a7df4c24a28d 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -1036,29 +1036,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