From patchwork Wed Mar 7 14:28:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 882633 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3zxGGh2JMTz9sch; Thu, 8 Mar 2018 01:28:44 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1eta3a-0008AU-Tz; Wed, 07 Mar 2018 14:28:38 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1eta3Z-0008A3-MB for kernel-team@lists.ubuntu.com; Wed, 07 Mar 2018 14:28:37 +0000 Received: from mail-wm0-f71.google.com ([74.125.82.71]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1eta3Z-000249-EO for kernel-team@lists.ubuntu.com; Wed, 07 Mar 2018 14:28:37 +0000 Received: by mail-wm0-f71.google.com with SMTP id t19so1173085wmh.3 for ; Wed, 07 Mar 2018 06:28:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=hEvm9aNPJqWNq1tIjfMY2QFcYB2YT9jUby3TVL3YdaI=; b=nYpeJ/UIWMy7BzsqDv3L9BgZpvwOQ+MUFU8a4DbxKyPu7V8wXntow9gAA/rFVXDrRz IfijIVM2meMLy6di9NvUJkaaEiBsT1TB5tpgnSVDyv3QtgK0io7klQDaBryIsgrPS4uS Mo8u/7KevOAAxvI/uE6D48NaJdldBVaSCaWa2oy2vbww3nIe9GsTq4kmK9epVgc+MSo1 VK0oAZAo6FwFIKVS7PuKLMo9KtPbrl6Fr00xno10Q/LfEpgExIre+9FCLBVn+/YmPyMk 1SZEhsvijL7XsISA7pnVcGEu+abDFZXahJZgPNwxlLa/D3xoiYBX4D4fps10SSUf7dxw 4LaA== X-Gm-Message-State: APf1xPCm25bKCs4owWKfj6yqxVNd8P6UcrwYAA23tP/2uXnxZShPUltv RecRU5ff6PMY7rXN3cMX49D3Jby6zL1CaoLBwVMUAGrxXbn0MVrMH9OMTBE+bePapfCVRovQHm5 hP+XK5LEDFaYsg0Ml6iKM4Q9OJ+iAUd4I0r86BbLb X-Received: by 10.223.128.201 with SMTP id 67mr18883154wrl.131.1520432916521; Wed, 07 Mar 2018 06:28:36 -0800 (PST) X-Google-Smtp-Source: AG47ELuWUcD+R96FO7kan/OqPwYc1SRKM85bi5G/8aNbYvwNzcZkXC3gPPRhwFvLm3PbbRwvy0YYmA== X-Received: by 10.223.128.201 with SMTP id 67mr18883137wrl.131.1520432916266; Wed, 07 Mar 2018 06:28:36 -0800 (PST) Received: from localhost.localdomain ([37.220.133.201]) by smtp.gmail.com with ESMTPSA id 4sm10124603wmz.31.2018.03.07.06.28.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Mar 2018 06:28:34 -0800 (PST) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [azure:x][PATCH v2 1/4] Revert "UBUNTU: SAUCE: vmbus: fix performance regression" Date: Wed, 7 Mar 2018 11:28:28 -0300 Message-Id: <1520432911-4667-2-git-send-email-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520432911-4667-1-git-send-email-marcelo.cerri@canonical.com> References: <1520432911-4667-1-git-send-email-marcelo.cerri@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: http://bugs.launchpad.net/bugs/1748662 This reverts commit 9ea3e22cb96dcca0d12213c12b503253ceb0e798. Signed-off-by: Marcelo Henrique Cerri --- drivers/hv/ring_buffer.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index dbc76554f9f9..8214042757cb 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -407,10 +407,10 @@ EXPORT_SYMBOL_GPL(__hv_pkt_iter_next); void hv_pkt_iter_close(struct vmbus_channel *channel) { struct hv_ring_buffer_info *rbi = &channel->inbound; - u32 cached_write_sz, cur_write_sz, pending_sz; + u32 orig_write_sz; /* Available space before read_index update */ - cached_write_sz = hv_get_bytes_to_write(rbi); + orig_write_sz = hv_get_bytes_to_write(rbi); /* * Make sure all reads are done before we update the read index since @@ -422,6 +422,10 @@ void hv_pkt_iter_close(struct vmbus_channel *channel) /* Update the position where ring buffer has been read from */ rbi->ring_buffer->read_index = rbi->priv_read_index; + /* If more data is available then no need to signal */ + if (hv_get_bytes_to_read(rbi)) + return; + /* * If the reading of the pend_sz were to be reordered and read * before we commit the new read index. @@ -431,22 +435,18 @@ void hv_pkt_iter_close(struct vmbus_channel *channel) virt_wmb(); if (rbi->ring_buffer->feature_bits.feat_pending_send_sz) { - pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz); - - /* If the other end is not blocked on write don't bother. */ - if (pending_sz == 0) - return; - - /* If pending write will not fit, don't give false hope. */ - cur_write_sz = hv_get_bytes_to_write(rbi); - if (cur_write_sz < pending_sz) - return; + u32 pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz); /* * If there was space before we began iteration, then - * host was not blocked. + * host was not blocked. Also handles the case where + * pending_sz is zero because host has nothing pending. */ - if (cached_write_sz >= pending_sz) + if (orig_write_sz > pending_sz) + return; + + /* If pending write will not fit, don't give false hope. */ + if (hv_get_bytes_to_write(rbi) < pending_sz) return; }