Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3047969pxj; Sun, 23 May 2021 19:55:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpL+QtKGRknuAmWJ955TYjtAayvuRLa7wHCkwf+d8lcjtO4ct0Y+QedhsDL24i5PBOVVre X-Received: by 2002:a17:906:87d0:: with SMTP id zb16mr20939485ejb.467.1621824914856; Sun, 23 May 2021 19:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621824914; cv=none; d=google.com; s=arc-20160816; b=0+B5jO5HzcRgHwzKmOBOGBDuOScLeMs0v1sTnZp8y//PeTuPnvL+CSOie20T3oWB/T Cw3ifKebQF1VVw3xKoV3zQ8aGlKTCREslckOR8zW+lsINzSEYeOHVDI4OAhTBuLObOfP Z/5lby3rI2nB+kQgNMm6Veoe07wCWo3/gF11vX4QkQwwKWpBSDLYYIZCBKHyXaQ0Ztcp R7Mg0eYD33uPBbMHHk48uo3e8Kip7vD8jYsCMs6ZVEYE0ACbbh3nN5aPndOo21/3aevT 3+yBSe+48emRP83znx4ugLtP+7M5zS/d4POdZE+uLraCGG30VufbZPSahqF0+TtIi7pU L4ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=OHCpWszk2k0MKGSbz/oMp6Y4c3mTJaXAiLMSobPSgQg=; b=OOONEPxcn1WcId6F3j1jdS1CTwl2rKqS5T7CiCaBAgFQ0J2xHtgT4AYJl6A7DnD7mW SQbTv6FF6nA+oN2dg2GkzOrGhMc5MrpPQTiTvWHP4GQKsbSBK9QVpe35/PZDkHEgTpPL v0wS75fdBPcS/WmltylYqVsuiaw2FXEzTfRAzms4+l4CVnQuKmIZOgl/oByTq/oahQPq 4ZyOO9bepkjTBVSCQ/9y7dBJ8nkgNwCnoceudO2OFAtc+nQS/uo6om2xVe3Dwycd0mpg sfLSFuHbETdk02Pmlx+QTgqLSeC+KaN7EviAmaRW/e5J/O3yiBpDMh5DHGitgD5Jo1Ek j10A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YvolKr8X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k12si5159999ejv.259.2021.05.23.19.54.51; Sun, 23 May 2021 19:55:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YvolKr8X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232200AbhEXCyt (ORCPT + 99 others); Sun, 23 May 2021 22:54:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46744 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231896AbhEXCyt (ORCPT ); Sun, 23 May 2021 22:54:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621824801; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OHCpWszk2k0MKGSbz/oMp6Y4c3mTJaXAiLMSobPSgQg=; b=YvolKr8XsByZwrAg0qc56TH7IIweqwtpUZuVblSLmpXx9O3B6pDbrtmPi2q9eGpCxeL87K GL0o3HrXma0HnldMPIG2z4A32aFEHbgP9vNaw3tmStT8DDY7SALCKJ6wHjlJzbfk9rZg5p abxcGPncMDpyTHzwVgl4ScMmQUFUrbM= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-326-CL1IcWi5OESiIh-sf0zaWA-1; Sun, 23 May 2021 22:53:18 -0400 X-MC-Unique: CL1IcWi5OESiIh-sf0zaWA-1 Received: by mail-pj1-f72.google.com with SMTP id gq1-20020a17090b1041b029015dad62a207so12868293pjb.9 for ; Sun, 23 May 2021 19:53:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=OHCpWszk2k0MKGSbz/oMp6Y4c3mTJaXAiLMSobPSgQg=; b=dtasDF2KGPXeE4Zhe7fceP4nNqrdiBi3klNzMamoY2+nWhamxadLdsg8LQldoxL8n4 aICHvVQIlYE+q0YOihXvS1wyrCYpuw/mNOP3X6qnkUM3E0W8r52Tv+CxYjNXhqQIPoje ECq+0CIgnRsv1dTzCocdVxOeg9tfcqyQhDH68amrheZvsf8cn8tIKGFGhZEv2YfJqnI9 7UQSb4JsadTO29U34PyF7SXfIJkH26AY/GDtiKBaIvkOxOM/gchqRpjh4dc5/g4/II5J kZIINN1IOEhSKG0ORCCEoh+IQPsvuk6ERf/r7z48enzG1Z2bl5VRcFpzzbhfP9EALwF5 QuCA== X-Gm-Message-State: AOAM531Ui1EUCNDPHpuSfRloLwSoQApqPTSDLEzTFtxtZ5bllRB0IcCl BWhf6krJggBexE39wDeIbiOUhwlMsHF8IraKcyeIh54r35HlJJ9XvOVQz293fBtmrgE/Kgg8nAy DFSJPf+wY3nfy8ahdOM14Xi6C X-Received: by 2002:a63:74e:: with SMTP id 75mr7415331pgh.200.1621824797353; Sun, 23 May 2021 19:53:17 -0700 (PDT) X-Received: by 2002:a63:74e:: with SMTP id 75mr7415321pgh.200.1621824797107; Sun, 23 May 2021 19:53:17 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id b9sm9335313pfo.107.2021.05.23.19.53.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 23 May 2021 19:53:16 -0700 (PDT) Subject: Re: virtio_net: BQL? To: Dave Taht , Willem de Bruijn Cc: Xianting Tian , "Michael S. Tsirkin" , "David S. Miller" , Jakub Kicinski , virtualization , Linux Kernel Network Developers , LKML , bloat References: <56270996-33a6-d71b-d935-452dad121df7@linux.alibaba.com> From: Jason Wang Message-ID: Date: Mon, 24 May 2021 10:53:08 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/5/18 上午5:48, Dave Taht 写道: > On Mon, May 17, 2021 at 1:23 PM Willem de Bruijn > wrote: >> On Mon, May 17, 2021 at 2:44 PM Dave Taht wrote: >>> Not really related to this patch, but is there some reason why virtio >>> has no support for BQL? >> There have been a few attempts to add it over the years. >> >> Most recently, https://lore.kernel.org/lkml/20181205225323.12555-2-mst@redhat.com/ >> >> That thread has a long discussion. I think the key open issue remains >> >> "The tricky part is the mode switching between napi and no napi." > Oy, vey. > > I didn't pay any attention to that discussion, sadly enough. > > It's been about that long (2018) since I paid any attention to > bufferbloat in the cloud and my cloudy provider (linode) switched to > using virtio when I wasn't looking. For over a year now, I'd been > getting reports saying that comcast's pie rollout wasn't working as > well as expected, that evenroute's implementation of sch_cake and sqm > on inbound wasn't working right, nor pf_sense's and numerous other > issues at Internet scale. > > Last week I ran a string of benchmarks against starlink's new services > and was really aghast at what I found there, too. but the problem > seemed deeper than in just the dishy... > > Without BQL, there's no backpressure for fq_codel to do its thing. > None. My measurement servers aren't FQ-codeling > no matter how much load I put on them. Since that qdisc is the default > now in most linux distributions, I imagine that the bulk of the cloud > is now behaving as erratically as linux was in 2011 with enormous > swings in throughput and latency from GSO/TSO hitting overlarge rx/tx > rings, [1], breaking various rate estimators in codel, pie and the tcp > stack itself. > > See: > > http://fremont.starlink.taht.net/~d/virtio_nobql/rrul_-_evenroute_v3_server_fq_codel.png > > See the swings in latency there? that's symptomatic of tx/rx rings > filling and emptying. > > it wasn't until I switched my measurement server temporarily over to > sch_fq that I got a rrul result that was close to the results we used > to get from the virtualized e1000e drivers we were using in 2014. > > http://fremont.starlink.taht.net/~d/virtio_nobql/rrul_-_evenroute_v3_server_fq.png > > While I have long supported the use of sch_fq for tcp-heavy workloads, > it still behaves better with bql in place, and fq_codel is better for > generic workloads... but needs bql based backpressure to kick in. > > [1] I really hope I'm overreacting but, um, er, could someone(s) spin > up a new patch that does bql in some way even half right for this > driver and help test it? I haven't built a kernel in a while. I think it's time to obsolete skb_orphan() for virtio-net to get rid of a brunch of tricky codes in the current virtio-net driver. Then we can do BQL on top. I will prepare some patches to do this (probably with Michael's BQL patch). Thanks > > >>> On Mon, May 17, 2021 at 11:41 AM Xianting Tian >>> wrote: >>>> BUG_ON() uses unlikely in if(), which can be optimized at compile time. >>>> >>>> Signed-off-by: Xianting Tian >>>> --- >>>> drivers/net/virtio_net.c | 5 ++--- >>>> 1 file changed, 2 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c >>>> index c921ebf3ae82..212d52204884 100644 >>>> --- a/drivers/net/virtio_net.c >>>> +++ b/drivers/net/virtio_net.c >>>> @@ -1646,10 +1646,9 @@ static int xmit_skb(struct send_queue *sq, struct >>>> sk_buff *skb) >>>> else >>>> hdr = skb_vnet_hdr(skb); >>>> >>>> - if (virtio_net_hdr_from_skb(skb, &hdr->hdr, >>>> + BUG_ON(virtio_net_hdr_from_skb(skb, &hdr->hdr, >>>> virtio_is_little_endian(vi->vdev), false, >>>> - 0)) >>>> - BUG(); >>>> + 0)); >>>> >>>> if (vi->mergeable_rx_bufs) >>>> hdr->num_buffers = 0; >>>> -- >>>> 2.17.1 >>>> >>> >>> -- >>> Latest Podcast: >>> https://www.linkedin.com/feed/update/urn:li:activity:6791014284936785920/ >>> >>> Dave Täht CTO, TekLibre, LLC > > > -- > Latest Podcast: > https://www.linkedin.com/feed/update/urn:li:activity:6791014284936785920/ > > Dave Täht CTO, TekLibre, LLC >