Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1601159ybh; Mon, 20 Jul 2020 02:29:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiv7OzeggCUGC4iK4vhrsAOe2zL/4N8Xtv0ppY29crqS8pZpx22FOX1f6rt/FKn+oz0ZBX X-Received: by 2002:a05:6402:2cb:: with SMTP id b11mr21466089edx.66.1595237395462; Mon, 20 Jul 2020 02:29:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595237395; cv=none; d=google.com; s=arc-20160816; b=a0OUJEVrTef3owhEVGwcFTHvRQgtg+c+jh0UjWMOoq4wsOYRIEOlxXqQVChjEko+FV R8m8jltJagTpv57Jf8T7/b1SZZ6MEvOHxawhSz/BBukKJb2AP7sO6So7mnBzEL7tCJ14 BiAZwg7cwJ1WNjYd8WiJCKOn0xFNhL4X/NkAzBpZtAV0Lh1OBaK/58Ww9ZMftbLyX0To hy9LOGBF01osxWiCJsj1Uhx/QgvUx1KJx+titu3e97zzdblr/Q2oZ3Cy91MBGaRnBK92 nkNrN/4y6B2wF94gZjdLXoS5HDe2FtyvMbOFeQA2G++zqGVvlpxCuCr9XUAp0i0/kTq6 /vzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=BfDHngK+oB3XbjAU3xOuqommK/lKgoaQlCXUf45Prys=; b=M162xus1bP3qvSB2L8HqoVwJ8ioxG4Lgv01qNIVmmiSWz8BUTRTlvd/6/Klhb6ZuN6 4Qbp1Ws5jPMIvTOeUIv/OBgP5g0ubr5LSLEPmYXhWe/IU1aMcAzlf9Dy1rL2XkWc5TcS NyvmkATQ+kl3+V+b9eA4BAZL85tAcB/XjvRdc11AUSJIpXj1s+dWYt/1o2mTzAv8aqRP 4lwKly4b88mAcH3h5z9pn/OQnRu2MLnK6WUWcEwzyd8NDf2d+jN0/5NteZtSaS2AaFmb me9RoDlTdZoRouNXYMfITtq3Hlw7z3jWE577KJ9lgffpsLTKSEpi+tLe8Uu7SQjj7KoG SHxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fFdhjcq2; 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 m18si10393356edr.21.2020.07.20.02.29.32; Mon, 20 Jul 2020 02:29:55 -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=fFdhjcq2; 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 S1728155AbgGTJ1t (ORCPT + 99 others); Mon, 20 Jul 2020 05:27:49 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:24868 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727769AbgGTJ1t (ORCPT ); Mon, 20 Jul 2020 05:27:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595237267; 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: in-reply-to:in-reply-to:references:references; bh=BfDHngK+oB3XbjAU3xOuqommK/lKgoaQlCXUf45Prys=; b=fFdhjcq2fE1CS44HaJauMZmAaAkyuOS1GpP/pQ/i8vPVQq1DE0mDE57oSD0dThGhJK3JqS KK8JnFCw7RMDdtustDOOgXms/3ilGkHRgz6lEOuch7chRW83fCUV8ktAX1FViqslYuWB2y cDdiopxCLyzgOtHbK/+OOm+7E480uAA= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-435-wuvJNxP9OKKSt9aeJbHNOQ-1; Mon, 20 Jul 2020 05:27:45 -0400 X-MC-Unique: wuvJNxP9OKKSt9aeJbHNOQ-1 Received: by mail-wm1-f71.google.com with SMTP id z11so14064154wmg.5 for ; Mon, 20 Jul 2020 02:27:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BfDHngK+oB3XbjAU3xOuqommK/lKgoaQlCXUf45Prys=; b=aChLmDVWK2oUsyBH4KcyAzotZK02spYGNJfbYipI7mY3mRvpFGTKE2C3gjMhDXCv8y YQdwhTQq3u7BoCObLZdTIt381+pV4p7ZO/OirkQZN3Yx2PxkNIm6goWenVJVBxgihsse 9cYAk/bQ0bvrES/eACLwHQC7vsvCzY5AS2sCLujRzxcz+gm5cvEM3F9ixNG1kujoAE+T ISl4kwtpj0IJUSC6qHvnAZLuv6nHmIXYpDQHL07yC4t2SzWdSnjC6IBC2oUQMqGFx0VL wAprHlOL+CwVo+d6AsXSP2nSuGQv2SRaNncUYtjjZQAHn696KO10LeuzAwoW7F3iOoai lNng== X-Gm-Message-State: AOAM531FRbWdm/IZdU649upePBZ2tOy9jeZ7PjGe0K76AgRP47JpiZ0N 9I3ppn2ClAQf2dkoxNf6zzvFQNNmepk4ndtW8e8nwrNk+n/0Wpf0R7G2lTs1I1ZzpqPqDuBshxP IKCNM0CDUxLwhoWvL1ePMeSKX X-Received: by 2002:a5d:690a:: with SMTP id t10mr8969051wru.374.1595237264614; Mon, 20 Jul 2020 02:27:44 -0700 (PDT) X-Received: by 2002:a5d:690a:: with SMTP id t10mr8969032wru.374.1595237264391; Mon, 20 Jul 2020 02:27:44 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id z63sm34167625wmb.2.2020.07.20.02.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 02:27:43 -0700 (PDT) Date: Mon, 20 Jul 2020 05:27:39 -0400 From: "Michael S. Tsirkin" To: Eugenio Perez Martin Cc: Jason Wang , Konrad Rzeszutek Wilk , linux-kernel@vger.kernel.org, kvm list , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org Subject: Re: [PATCH RFC v8 02/11] vhost: use batched get_vq_desc version Message-ID: <20200720051410-mutt-send-email-mst@kernel.org> References: <419cc689-adae-7ba4-fe22-577b3986688c@redhat.com> <0a83aa03-8e3c-1271-82f5-4c07931edea3@redhat.com> <20200709133438-mutt-send-email-mst@kernel.org> <7dec8cc2-152c-83f4-aa45-8ef9c6aca56d@redhat.com> <20200710015615-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 16, 2020 at 07:16:27PM +0200, Eugenio Perez Martin wrote: > On Fri, Jul 10, 2020 at 7:58 AM Michael S. Tsirkin wrote: > > > > On Fri, Jul 10, 2020 at 07:39:26AM +0200, Eugenio Perez Martin wrote: > > > > > How about playing with the batch size? Make it a mod parameter instead > > > > > of the hard coded 64, and measure for all values 1 to 64 ... > > > > > > > > > > > > Right, according to the test result, 64 seems to be too aggressive in > > > > the case of TX. > > > > > > > > > > Got it, thanks both! > > > > In particular I wonder whether with batch size 1 > > we get same performance as without batching > > (would indicate 64 is too aggressive) > > or not (would indicate one of the code changes > > affects performance in an unexpected way). > > > > -- > > MST > > > > Hi! > > Varying batch_size as drivers/vhost/net.c:VHOST_NET_BATCH, sorry this is not what I meant. I mean something like this: diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 0b509be8d7b1..b94680e5721d 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1279,6 +1279,10 @@ static void handle_rx_net(struct vhost_work *work) handle_rx(net); } +MODULE_PARM_DESC(batch_num, "Number of batched descriptors. (offset from 64)"); +module_param(batch_num, int, 0644); +static int batch_num = 0; + static int vhost_net_open(struct inode *inode, struct file *f) { struct vhost_net *n; @@ -1333,7 +1337,7 @@ static int vhost_net_open(struct inode *inode, struct file *f) vhost_net_buf_init(&n->vqs[i].rxq); } vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX, - UIO_MAXIOV + VHOST_NET_BATCH, + UIO_MAXIOV + VHOST_NET_BATCH + batch_num, VHOST_NET_PKT_WEIGHT, VHOST_NET_WEIGHT, true, NULL); then you can try tweaking batching and playing with mod parameter without recompiling. VHOST_NET_BATCH affects lots of other things. > and testing > the pps as previous mail says. This means that we have either only > vhost_net batching (in base testing, like previously to apply this > patch) or both batching sizes the same. > > I've checked that vhost process (and pktgen) goes 100% cpu also. > > For tx: Batching decrements always the performance, in all cases. Not > sure why bufapi made things better the last time. > > Batching makes improvements until 64 bufs, I see increments of pps but like 1%. > > For rx: Batching always improves performance. It seems that if we > batch little, bufapi decreases performance, but beyond 64, bufapi is > much better. The bufapi version keeps improving until I set a batching > of 1024. So I guess it is super good to have a bunch of buffers to > receive. > > Since with this test I cannot disable event_idx or things like that, > what would be the next step for testing? > > Thanks! > > -- > Results: > # Buf size: 1,16,32,64,128,256,512 > > # Tx > # === > # Base > 2293304.308,3396057.769,3540860.615,3636056.077,3332950.846,3694276.154,3689820 > # Batch > 2286723.857,3307191.643,3400346.571,3452527.786,3460766.857,3431042.5,3440722.286 > # Batch + Bufapi > 2257970.769,3151268.385,3260150.538,3379383.846,3424028.846,3433384.308,3385635.231,3406554.538 > > # Rx > # == > # pktgen results (pps) > 1223275,1668868,1728794,1769261,1808574,1837252,1846436 > 1456924,1797901,1831234,1868746,1877508,1931598,1936402 > 1368923,1719716,1794373,1865170,1884803,1916021,1975160 > > # Testpmd pps results > 1222698.143,1670604,1731040.6,1769218,1811206,1839308.75,1848478.75 > 1450140.5,1799985.75,1834089.75,1871290,1880005.5,1934147.25,1939034 > 1370621,1721858,1796287.75,1866618.5,1885466.5,1918670.75,1976173.5,1988760.75,1978316 > > pktgen was run again for rx with 1024 and 2048 buf size, giving > 1988760.75 and 1978316 pps. Testpmd goes the same way. Don't really understand what does this data mean. Which number of descs is batched for each run? -- MST