Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp375490imm; Tue, 19 Jun 2018 23:19:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJpXrHlYG+EjqPmGSli/Cf/nT0X6vc+vDkH5rzk1NGc5qRb0TT19BgeWTjxnfTdq1KJe42h X-Received: by 2002:a65:4d08:: with SMTP id i8-v6mr17565295pgt.427.1529475540948; Tue, 19 Jun 2018 23:19:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529475540; cv=none; d=google.com; s=arc-20160816; b=q8L+ekNbxFhgNpREj2sHIUUbjC0qftRxy46pnG9MYF+hafpCyKp0BykF2TgyLqZTbW qRY9hL3+PATvGiiNoCw+ACnbb7P+1dPHiZG2QOcNbZw5MEUTecTCZ4u//e+T6ITZUnF2 fK0lR1l6YbPBoIDhO6o0H1zRrOE4JAS2euXUY4BQ/TBtlHp1nnI7oqrc7b4WBQTgJGGP DdGUB1PV5Y0rnIyTKI1QEEennwaGDroBfgxj1kGdZ7Dos0ok9KAtRJeTaAHpj7h4hCjv enJ2luK8PCMLjMgSFo+G+DqxMU7v/CHYf02Lg0KkpzKGpJS2ZhWaRD0WqDyVbeRkvT/b fOLQ== 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=UIgsNBes7rvokXuuoCGuVOHhCOwx2ZLCobbBQswYZz0=; b=c40eqqTPnP3Vc98mRRRX7PikpySlo4d+3QC1g3fTYzpfGRKfAcDn1GDiwbF2Abi5Eu wa49GJ7Ern4+UNAhFxPDOh7DxuLd7+FSVMzKzPJqYf7JSNjUcIjD8clo0ayZ1E9V08qd TEgJJYulde8qzXhXvDhlr4rvzc5g+BJBrIHgUHDoUmsuiEKmbv7mEkL67EGPCWdE29vl doZdc2ODD31w5AYCdQXgXLXkPwQKKQHgWIY+gW1eIAnWtC6Bhx/YK5lxvZbvWqeXzttX aJnV424iMqm3Rrp2ulo5MVOvlRIzglIPhWhp1aB1lDaULlkYiD7sABb6WzpNepfXpKet o3cQ== 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 p3-v6si1611616pld.408.2018.06.19.23.18.47; Tue, 19 Jun 2018 23:19:00 -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 S1754237AbeFTGQo (ORCPT + 99 others); Wed, 20 Jun 2018 02:16:44 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:14815 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752829AbeFTGPQ (ORCPT ); Wed, 20 Jun 2018 02:15:16 -0400 Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Tue, 19 Jun 2018 23:15:11 -0700 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 92A71B0C21; Tue, 19 Jun 2018 23:15:15 -0700 (PDT) From: Nadav Amit To: Greg Kroah-Hartman CC: Xavier Deguillard , Arnd Bergmann , , Nadav Amit , Subject: [PATCH v3 3/7] vmw_balloon: VMCI_DOORBELL_SET does not check status Date: Tue, 19 Jun 2018 16:00:26 -0700 Message-ID: <20180619230030.112906-4-namit@vmware.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180619230030.112906-1-namit@vmware.com> References: <20180619230030.112906-1-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-002.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