Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1142316imm; Wed, 1 Aug 2018 10:53:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpct3IA/kF3gS75Kv+9BHyBzu9D5UnQ1Myq0RuLMBqXiWhQ5UxYsumbT9f8E4uQ/fJH9cKrM X-Received: by 2002:a62:23c2:: with SMTP id q63-v6mr27831553pfj.91.1533146014910; Wed, 01 Aug 2018 10:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533146014; cv=none; d=google.com; s=arc-20160816; b=T6HBvjEsnso8/WEwmhxMPaBxTpByULaDem9nNVcT2OZDu/r0tuX3bCvz9BcEw1VNmR W3/cknc0sMRMrRHDsbfmI0XFEN/Hqt2oZAvdrWW6TRyZHYbo51kXCtw4TdTN2NS6A9aD 2L/UKO95BQ7kSXI4IvEA9dvcmba2hy2kh14XrloIHidR8+J/PuRjjl8xC2Z+EPTBRbPd ebXcqPH0PGnfvVA51EEs+eyQtbVXSARSBmE5ca93LdDNqmExypRCpNCTVpqwlim58d64 g0TnWHCbGnCdFzamXsc9u3FYeoTlpAyDl3urUauf1IaoMDBeFshD/cKBcL3gc6ksRfWU dL4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=x7OnaYMrSWbAzzSq0Vgg8ckKgyIo1aNGav9uWdLdfCQ=; b=FH44wU0j5sTWYFHCLtAENvqKSY5PwsxLj/5zhK0+qyD8vKL4DfsT3rCLyJ/+gbm1p6 PmkSSbLAH1Q8LCpoMHpvMvdkayMDdc9Fnrc6CjmM+mmxgGtFS672y2k7IFJmkd49uanv 9zNMWmzKeHsGlj8W66N3e+RAIFQ2G1d8YB89ubD+zWFpRZJ6mQJtARI4bd11BZfV1fC/ ilbobHwmNC342SPundwi9bfmaQkVm56c40dN4o/xkl96yNvm7QOVkziKQxOD5UQsF1Pt KgpjtwJnukovWEiKrzhmCfimhBGdBGDQQ+Yqw8OURKAPAzUL8ERThOSuJxGnUMNzi9er vDNQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h25-v6si16458438pgh.119.2018.08.01.10.53.20; Wed, 01 Aug 2018 10:53:34 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390642AbeHATjY (ORCPT + 99 others); Wed, 1 Aug 2018 15:39:24 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49812 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406017AbeHATIl (ORCPT ); Wed, 1 Aug 2018 15:08:41 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 40A8C1357; Wed, 1 Aug 2018 17:13:26 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Boris Ostrovsky , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 021/246] xen/netfront: raise max number of slots in xennet_get_responses() Date: Wed, 1 Aug 2018 18:48:51 +0200 Message-Id: <20180801165012.715542128@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Juergen Gross [ Upstream commit 57f230ab04d2910a06d17d988f1c4d7586a59113 ] The max number of slots used in xennet_get_responses() is set to MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD). In old kernel-xen MAX_SKB_FRAGS was 18, while nowadays it is 17. This difference is resulting in frequent messages "too many slots" and a reduced network throughput for some workloads (factor 10 below that of a kernel-xen based guest). Replacing MAX_SKB_FRAGS by XEN_NETIF_NR_SLOTS_MIN for calculation of the max number of slots to use solves that problem (tests showed no more messages "too many slots" and throughput was as high as with the kernel-xen based guest system). Replace MAX_SKB_FRAGS-2 by XEN_NETIF_NR_SLOTS_MIN-1 in netfront_tx_slot_available() for making it clearer what is really being tested without actually modifying the tested value. Signed-off-by: Juergen Gross Reviewed-by: Boris Ostrovsky Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/xen-netfront.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -239,7 +239,7 @@ static void rx_refill_timeout(unsigned l static int netfront_tx_slot_available(struct netfront_queue *queue) { return (queue->tx.req_prod_pvt - queue->tx.rsp_cons) < - (NET_TX_RING_SIZE - MAX_SKB_FRAGS - 2); + (NET_TX_RING_SIZE - XEN_NETIF_NR_SLOTS_MIN - 1); } static void xennet_maybe_wake_tx(struct netfront_queue *queue) @@ -790,7 +790,7 @@ static int xennet_get_responses(struct n RING_IDX cons = queue->rx.rsp_cons; struct sk_buff *skb = xennet_get_rx_skb(queue, cons); grant_ref_t ref = xennet_get_rx_ref(queue, cons); - int max = MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD); + int max = XEN_NETIF_NR_SLOTS_MIN + (rx->status <= RX_COPY_THRESHOLD); int slots = 1; int err = 0; unsigned long ret;