Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp306852imm; Thu, 2 Aug 2018 19:43:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcy8xyCfMswU9h77G6leCktMmirKg4CYSeZZVK1f+IP6zMXq4eAmVBcubkWRnwtvUdQE/qz X-Received: by 2002:a63:1360:: with SMTP id 32-v6mr1864012pgt.159.1533264180693; Thu, 02 Aug 2018 19:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533264180; cv=none; d=google.com; s=arc-20160816; b=WMPkUdML24FFDnFkNNvMFI9Pka033fg80RSBlwGvMg8TV6oGqTy3n0+x1s1OZwAylh OjacARDf967ABb5owGdzxLCvIfcsjWefqlkyCERdS62aT7VGI4j2dg6SP6Kbz2XEoIeB m5gfvbFJXIuRRKFlLPJ6ZZJ/NJ8CUxze5wYA3vB2NK63gFebof4PQNGAmjzE+F/Prwa1 q88FnzqhINSZzXV2cikujSc8xBT3ZgGw53Tdar/vL4qk1mvFybGZzCw3Qaafc+oFFu9X o6BrM3uwnZ0KyeNQnLdqDZ3dRkryFgGVvNEvvB7rZ8XziR0fwuhjVT3xzp5DcvbM+D7T UNEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=rTDCQsIsYU1Xv8WdwtRXC0ir3lnHnw0lVqYzMIVD2R4=; b=ATwLERNaAyW49YlWDSTIZi0SJqwwAMJ7/UZddZjCohnEdmXI4BXoHH3XTDyxs5R8Eb I7WV6vFGslloGDeFPh/gTThMsN+krEYaxr/FEgKNirMtMWYDF8nbYZHD+CNbGw5U1NGg ak9A2ii+vuAIzahvbbCInjnEe1xLgc2zjPD4TiOhz88302w4bKKvRBqm8pqkO7h6Tx9A AHy8WGAeIJNuR7pD/BlbijpRmE0vZ6RcJqftRrh/sfy7YI1zR/Ey6U0pNlLWBn3YZwKf K4O6mBLEqpfW719mYFwN3KkoA34P1FfP/ZAIUKZUZzzcotuWvA0g7HCvjm0ANzL1lERK 97CA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x11-v6si2556565pln.130.2018.08.02.19.42.45; Thu, 02 Aug 2018 19:43:00 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726851AbeHCEf7 (ORCPT + 99 others); Fri, 3 Aug 2018 00:35:59 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54310 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726190AbeHCEf7 (ORCPT ); Fri, 3 Aug 2018 00:35:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A3E8D8185342; Fri, 3 Aug 2018 02:41:55 +0000 (UTC) Received: from [10.72.12.51] (ovpn-12-51.pek2.redhat.com [10.72.12.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A0A602166BA2; Fri, 3 Aug 2018 02:41:44 +0000 (UTC) Subject: Re: [RFC 0/4] Virtio uses DMA API for all devices To: "Michael S. Tsirkin" , Anshuman Khandual Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, aik@ozlabs.ru, robh@kernel.org, joe@perches.com, elfring@users.sourceforge.net, david@gibson.dropbear.id.au, benh@kernel.crashing.org, mpe@ellerman.id.au, hch@infradead.org, linuxram@us.ibm.com, haren@linux.vnet.ibm.com, paulus@samba.org, srikar@linux.vnet.ibm.com References: <20180720035941.6844-1-khandual@linux.vnet.ibm.com> <20180802235332-mutt-send-email-mst@kernel.org> From: Jason Wang Message-ID: Date: Fri, 3 Aug 2018 10:41:41 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180802235332-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 03 Aug 2018 02:41:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 03 Aug 2018 02:41:55 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jasowang@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018年08月03日 04:55, Michael S. Tsirkin wrote: > On Fri, Jul 20, 2018 at 09:29:37AM +0530, Anshuman Khandual wrote: >> This patch series is the follow up on the discussions we had before about >> the RFC titled [RFC,V2] virtio: Add platform specific DMA API translation >> for virito devices (https://patchwork.kernel.org/patch/10417371/). There >> were suggestions about doing away with two different paths of transactions >> with the host/QEMU, first being the direct GPA and the other being the DMA >> API based translations. >> >> First patch attempts to create a direct GPA mapping based DMA operations >> structure called 'virtio_direct_dma_ops' with exact same implementation >> of the direct GPA path which virtio core currently has but just wrapped in >> a DMA API format. Virtio core must use 'virtio_direct_dma_ops' instead of >> the arch default in absence of VIRTIO_F_IOMMU_PLATFORM flag to preserve the >> existing semantics. The second patch does exactly that inside the function >> virtio_finalize_features(). The third patch removes the default direct GPA >> path from virtio core forcing it to use DMA API callbacks for all devices. >> Now with that change, every device must have a DMA operations structure >> associated with it. The fourth patch adds an additional hook which gives >> the platform an opportunity to do yet another override if required. This >> platform hook can be used on POWER Ultravisor based protected guests to >> load up SWIOTLB DMA callbacks to do the required (as discussed previously >> in the above mentioned thread how host is allowed to access only parts of >> the guest GPA range) bounce buffering into the shared memory for all I/O >> scatter gather buffers to be consumed on the host side. >> >> Please go through these patches and review whether this approach broadly >> makes sense. I will appreciate suggestions, inputs, comments regarding >> the patches or the approach in general. Thank you. > Jason did some work on profiling this. Unfortunately he reports > about 4% extra overhead from this switch on x86 with no vIOMMU. The test is rather simple, just run pktgen (pktgen_sample01_simple.sh) in guest and measure PPS on tap on host. Thanks > > I expect he's writing up the data in more detail, but > just wanted to let you know this would be one more > thing to debug before we can just switch to DMA APIs. > > >> Anshuman Khandual (4): >> virtio: Define virtio_direct_dma_ops structure >> virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively >> virtio: Force virtio core to use DMA API callbacks for all virtio devices >> virtio: Add platform specific DMA API translation for virito devices >> >> arch/powerpc/include/asm/dma-mapping.h | 6 +++ >> arch/powerpc/platforms/pseries/iommu.c | 6 +++ >> drivers/virtio/virtio.c | 72 ++++++++++++++++++++++++++++++++++ >> drivers/virtio/virtio_pci_common.h | 3 ++ >> drivers/virtio/virtio_ring.c | 65 +----------------------------- >> 5 files changed, 89 insertions(+), 63 deletions(-) >> >> -- >> 2.9.3