Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1832811imu; Sat, 8 Dec 2018 08:09:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/V/B8twWoL5Xm8r4XLYuBaipMH4F9LoPP77mz8yZY+446OUdM/1xSPOV54jNozM4xbRT2k5 X-Received: by 2002:a17:902:bc3:: with SMTP id 61mr6148540plr.15.1544285352703; Sat, 08 Dec 2018 08:09:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544285352; cv=none; d=google.com; s=arc-20160816; b=RL81SGXyLe6PALpJRo6JUsA9Imc6EM9j0K/OqSSl6zGp4vKj+f4sURKgI3HnZjortR MdRAtNAYknG6H3syOMyxqd2hN/UomeodKTrsC3QAeCBXxlmZjWCnWGooR4Jn5K2yvVEh gCT1U8CvX+5VNM2gRKUi1Y8Jjajxi2N3X0wGUktWluGbloWit+oB1x5NxqhRGXAv9V8t hI+JrHKdVZrezsEYBMo8yPnoJOfqmrhI01mfknI0UP7LiRaP6YY1NLhJu/6hQP6AF1wO Hd7UBEXgqlKv5c+dBwQVp1O+dm7p1eiHGJHIkV621o6voOP0OuS0t1rYdD7HPUykmmTs m3XQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=YZtfCfNH/p4wc3Q58RzCm0k1+N0Ep8Tk1oHdhD2iuZ4=; b=PfgEFxXXQS/mxDFLa9Wd8z5bYQVjRSwRk62RhA9pPxBEGL0U6MKwPHrIEjnnL8GVDM gYduawkEgMKVXb/hP/SmmbiIEWoOeQ+bTAJlV2leFkNc5KPz19QH0CXMRownkNoZcaoz bNrXj5AZQ3/TjhxFl+2HBa06HqcmBxrU2bi45ZFrp0VhUwNxr3zQjKUW6isozK/5dy+v DmYWTcs+gKQgsu4Tvw+yL/CSN5cd9sgBUNqs2p17NHJ3QR4WpzybpwzO4ck61w7ODrMU QxPXnV3N8ntfGHmO+y4Dn2CCvaKpcuv4zKS3A0XsTgbfwMdBGVJK88bUVWZYummhklp/ T7WQ== 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 r11si5156775pgg.327.2018.12.08.08.08.56; Sat, 08 Dec 2018 08:09:12 -0800 (PST) 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 S1726232AbeLHQG7 (ORCPT + 99 others); Sat, 8 Dec 2018 11:06:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56504 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726160AbeLHQG7 (ORCPT ); Sat, 8 Dec 2018 11:06:59 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 20E76C057F21; Sat, 8 Dec 2018 16:06:58 +0000 (UTC) Received: from localhost (ovpn-200-34.brq.redhat.com [10.40.200.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5ABA1608C3; Sat, 8 Dec 2018 16:06:49 +0000 (UTC) Date: Sat, 8 Dec 2018 17:06:48 +0100 From: Jesper Dangaard Brouer To: Christoph Hellwig Cc: iommu@lists.linux-foundation.org, Linus Torvalds , Tariq Toukan , Ilias Apalodimas , Toke =?UTF-8?B?SMO4aWxhbmQtSsO4?= =?UTF-8?B?cmdlbnNlbg==?= , Robin Murphy , Konrad Rzeszutek Wilk , Tony Luck , Fenghua Yu , Marek Szyprowski , Keith Busch , Jonathan Derrick , linux-pci@vger.kernel.org, linux-ia64@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, brouer@redhat.com Subject: Re: [RFC] avoid indirect calls for DMA direct mappings v2 Message-ID: <20181208170648.296fb8a1@redhat.com> In-Reply-To: <20181207190720.18517-1-hch@lst.de> References: <20181207190720.18517-1-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 08 Dec 2018 16:06:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 7 Dec 2018 11:07:05 -0800 Christoph Hellwig wrote: > Hi all, > > a while ago Jesper reported major performance regressions due to the > spectre v2 mitigations in his XDP forwarding workloads. A large part > of that is due to the DMA mapping API indirect calls. > > It turns out that the most common implementation of the DMA API is the > direct mapping case, and now that we have merged almost all duplicate > implementations of that into a single generic one is easily feasily to > direct calls for this fast path. > > This series adds consolidate the DMA mapping code by merging the > swiotlb case into the dma direct case, and then treats NULL dma_ops > as an indicator that that we should directly call the direct mapping > case. This recovers a large part of the retpoline induces XDP slowdown. > > This works is based on the dma-mapping tree, so you probably want to > want this git tree for testing: > > git://git.infradead.org/users/hch/misc.git dma-direct-calls.2 > > Gitweb: > > http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-direct-calls.2 You can add my: Tested-by: Jesper Dangaard Brouer or Acked-by: Jesper Dangaard Brouer I'm very happy that you work on this. And I've done micro-benchmark testing of the patchset (and branch dma-direct-calls), which I've made avail here: https://github.com/xdp-project/xdp-project/blob/master/areas/dma/dma01_test_hellwig_direct_dma.org My XDP performance is back, minus the BPF-indirect call, and net_rx_action napi->poll, and net_device->ndo_xdp_xmit calls. I verified that manually disabling retpoline for these remaining netstack retpoline-calls restore the performance full (well minus 1.5 nanosec). -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer