Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10843790imu; Thu, 6 Dec 2018 07:38:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/UWfisMgOzXaeGhwJ0WCPXDQUHkg0eMms3lazjDuPtk0NB9+Jg9MjLgJ53W7Wla49qVQ37F X-Received: by 2002:a63:d70e:: with SMTP id d14mr24726077pgg.159.1544110739029; Thu, 06 Dec 2018 07:38:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544110738; cv=none; d=google.com; s=arc-20160816; b=ba1RFA2JjL4HilexJsTPmhRh8yZD1VYOz9rrE6XYs+wvFMkCpEdF1YZwDvfTXAAXGB 2wcZAlhNFI1m4W52ZQ3sKm8U52yu1IhvuGuhxRjGp3ja6HY7wUIAHlBGEcFw2bubw4wo dDmnUtI924kYK7E/9QNef9BST92BaLXR5NwMrhNVMISIpJ1fs9XZSTxch0odg6Xsqu9b 3D0gwgkT55lN9xt3qqEZDTgjkProW32MBc6mSOwAevIgrnawgNvstTkxCAs0F3UgIVUr PjFqplKG+aN2Q1DJKLpn6+B5ZZIbik+tfsD/7vZgfSA7fMvVrn/A21r7FzxoJ5QG7vF7 jiRw== 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=7/CO/XZKBp5lTPZblOoX1Ml/Yl52k3jny4cR57zEhBs=; b=KpU+MPVCECKD/xUAD76HggjtAkdiQMP49/92an3CQyCXM2Rr57VdCWE2h0c68h+yGc 4feijwchrawo5k+noPtoL45GfClzBKEmtDYCP142UXX9/C+AQfU3GyWYz6RaP/iVwgd+ Rlw8nyvDQHFp1ZVAo1sfvL5/8/IBlUR7FYEcGeoce3cizfsztoSQDAXAccLA9MwgFKXy AT3Is64a3Bb3WLXjPWvFjBA5mPfUMlmA3B9of4eFdXGei2pGCNY5O0Mr3FUYBIeAvufe sNu07jGBkfN9P84zKXlWQCEtLKUoy4zbPIdFhL6gLLjCrka/duwRCfHQnTp1vSk8aspA iAYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=bKtv9us2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si518407pgj.20.2018.12.06.07.38.33; Thu, 06 Dec 2018 07:38:58 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=bKtv9us2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726164AbeLFPhc (ORCPT + 99 others); Thu, 6 Dec 2018 10:37:32 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:35508 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725907AbeLFPhb (ORCPT ); Thu, 6 Dec 2018 10:37:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7/CO/XZKBp5lTPZblOoX1Ml/Yl52k3jny4cR57zEhBs=; b=bKtv9us2R5DregY2MBf5CUU1E Vez0eQ0ajmYmPUQbIe6lCBpl/ytsllBiyumFpxjade1yTW1nnx2zfPdwiCC0APyoPwOkKGp4fTc01 igAWi3YXlSl41Uwi4hQZhdcsy74MwPZ/hZeOYueHXZ+GuoKU41x8WGWsoVEMRoSAkxtqbxaGHvRU6 SXV1+7d+0A6KWgF7jiRjYJOwPnGoDDlfzrd3zK4W3EmwaRwb1PzlkPYoBTifusMhLhQHelmytzp85 XHUUtaGuF8QTT0sKzgTQUflsg7jiNhZMHtyEtOPKWBEQpRWc3I/E84kvy2YYolHjXry/MLq3aycl2 OwIj1aG0w==; Received: from [38.126.112.138] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUviO-0000ms-1b; Thu, 06 Dec 2018 15:37:24 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org, Linus Torvalds , Jesper Dangaard Brouer Cc: Tariq Toukan , Ilias Apalodimas , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Robin Murphy , linux-kernel@vger.kernel.org Subject: [RFC] avoid indirect calls for DMA direct mappings Date: Thu, 6 Dec 2018 07:37:19 -0800 Message-Id: <20181206153720.10702-1-hch@lst.de> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 patch adds a check if we are using dma_direct_ops in each fast path DMA operation, and just uses a direct call instead. For the XDP workload this increases the number of packets per second from 7,438,283 to 9,610,088, so it provides a very significant speedup. Note that the patch depends on a lot of work either queued up in the DMA mapping tree, or still out on the list from review, so to actually try the patch you probably want this git tree: git://git.infradead.org/users/hch/misc.git dma-direct-calls Gitweb: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-direct-calls