Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1006499ybt; Fri, 19 Jun 2020 21:22:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9JvlGe9ipdruKtxJlzuFam+0uijTunVCubrCyVI5/u7aQTvjqvejs+g0dwRRl8/bhycmC X-Received: by 2002:a05:6402:2289:: with SMTP id cw9mr6628668edb.33.1592626969167; Fri, 19 Jun 2020 21:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592626969; cv=none; d=google.com; s=arc-20160816; b=tWcvO66cCE3O+u9Gg3ZeZBDSMgv/WUSj0kGq+6ckAK0TcD4Ne6hr8KocE3eRwu7mvp /br5LU9WpOzaVcZEiGo7A147xEqw7bKeEARasGg8IenvKdgR3aBG5sMiCfEp+D5g4l7B 2NcJ6Tnoa/UcpkaaRFm1rHfOn18ENDdYF/b53zvPstTHktFz1Tv6c2m7uJTevpyHkyTr btLTSTjrGfX2v1tAzK6AVypkiStsaafCiyG74EstroE6jfgoCexdlluwQMn8iJuizW2h KMiRPlI0VYNUeekAyd792sYTfKdYJkwVtmKtC43Px+d8Y4vjen+hkLpTjSbjGMd8ukNX 1LMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bc8bgBZaKAykX+oT4Ghe9dJSFsYjpNWBpF2Ak/zUniM=; b=GvtHKUnQcCEat7uhuPelM4AnRIkzum7t7yYln8Ywx2A+R1Og0UTqI7U9UraWDRm2dZ Prr3TnQBmeY6/ge2csxO4jWQ4V0DmS5Ameswdpj99fT7nbcbH2RUstWl6bV6WZ+yby3p Sw8SrwPCcL1WlIZry+MTQ+35H1r+vcuDMnYfcDtwvWo8WIDucAPRN+hAVHL6IFfivDwF h/59Orw9eydYZuLW/PC5Aj34CUzV8AAscDGkaigsykSYdplG/OKcNWIqVcRek4Rto/9g 3hwhcfBtA27xNn12rckJO12mr3gu0k2JK6Rfwctf6KJj2xCFZDhor0VOFCmzD0/Q17YK v7OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iTs7U5IK; 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 dp9si6664378ejc.698.2020.06.19.21.22.27; Fri, 19 Jun 2020 21:22:49 -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=iTs7U5IK; 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 S1732721AbgFSSXR (ORCPT + 99 others); Fri, 19 Jun 2020 14:23:17 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:31707 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731031AbgFSSXR (ORCPT ); Fri, 19 Jun 2020 14:23:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592590995; 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; bh=bc8bgBZaKAykX+oT4Ghe9dJSFsYjpNWBpF2Ak/zUniM=; b=iTs7U5IKf334OUKV0eUiJphDWvgtFh60yvxnIENIou96v4TSy2SqIZhJMY8kQT9EgYQkyB Tr6GUxeLcN4lCpe6E5fz1kuiciXAXO+FIjFEOVi9SKGC2GA9NOyhTQUKI0bAt2YdyEwk2g ywkO4Wm2gpcxw++vzscChW9fETv5dkw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-178-78tk4Hn8OS2BD-oyfUyQKg-1; Fri, 19 Jun 2020 14:23:13 -0400 X-MC-Unique: 78tk4Hn8OS2BD-oyfUyQKg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2264800053; Fri, 19 Jun 2020 18:23:12 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-113-14.ams2.redhat.com [10.36.113.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F73B7C1E4; Fri, 19 Jun 2020 18:23:05 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: mst@redhat.com Cc: kvm list , Stefano Garzarella , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Stefan Hajnoczi , Jason Wang Subject: [RFC v9 00/11] vhost: ring format independence Date: Fri, 19 Jun 2020 20:22:51 +0200 Message-Id: <20200619182302.850-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds infrastructure required for supporting multiple ring formats. The idea is as follows: we convert descriptors to an independent format first, and process that converting to iov later. Used ring is similar: we fetch into an independent struct first, convert that to IOV later. The point is that we have a tight loop that fetches descriptors, which is good for cache utilization. This will also allow all kind of batching tricks - e.g. it seems possible to keep SMAP disabled while we are fetching multiple descriptors. For used descriptors, this allows keeping track of the buffer length without need to rescan IOV. This seems to perform better on UDP stream tests, but a little bit worse on RR tests and TCP streams, based on a microbenchmark. More testing would be very much appreciated. changes from v8: - fixes fetch_descs returning "no descriptors available" when only few descriptors were available, stalling the communications. - minor syntax errors in intermediate commits. - skipping checking for sane max_descs if vhost device is not going to use worker like vDPA devices. changes from v7: - squashed in fixes. no longer hangs but still known to cause data corruption for some people. under debug. changes from v6: - fixes some bugs introduced in v6 and v5 changes from v5: - addressed comments by Jason: squashed API changes, fixed up discard changes from v4: - added used descriptor format independence - addressed comments by jason - fixed a crash detected by the lkp robot. changes from v3: - fixed error handling in case of indirect descriptors - add BUG_ON to detect buffer overflow in case of bugs in response to comment by Jason Wang - minor code tweaks Changes from v2: - fixed indirect descriptor batching reported by Jason Wang Changes from v1: - typo fixes Michael S. Tsirkin (11): vhost: option to fetch descriptors through an independent struct vhost: use batched get_vq_desc version vhost/net: pass net specific struct pointer vhost: reorder functions vhost: format-independent API for used buffers vhost/net: convert to new API: heads->bufs vhost/net: avoid iov length math vhost/test: convert to the buf API vhost/scsi: switch to buf APIs vhost/vsock: switch to the buf API vhost: drop head based APIs drivers/vhost/net.c | 174 ++++++++++---------- drivers/vhost/scsi.c | 73 +++++---- drivers/vhost/test.c | 22 +-- drivers/vhost/vhost.c | 372 +++++++++++++++++++++++++++--------------- drivers/vhost/vhost.h | 44 +++-- drivers/vhost/vsock.c | 30 ++-- 6 files changed, 435 insertions(+), 280 deletions(-) -- 2.18.1