Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp930491imu; Fri, 7 Dec 2018 11:08:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/UEVKUwKuoBjz/SHPkLgVi/I7rGKaY7meqxrr/mEksY1WA39JKzzsn5J5FmupZrPfqBS4eL X-Received: by 2002:a62:c42:: with SMTP id u63mr3323795pfi.73.1544209721607; Fri, 07 Dec 2018 11:08:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544209721; cv=none; d=google.com; s=arc-20160816; b=WgsDDG7ODdDbjJPhKZ2+vXVkFW5OsW7gk/HFvuaOFwmxYbZXOWRxtAYx2rvZFPe3er OlRNJZ/uVs/FmiLaDwrLdZm3ituDcxw6IQQOWJadIdgxDPVNxjKVOZuGyQALb4nXOJBw P26IVuLO/hSBVzZTneEUj9KtziRWMVvFzHTMVosV+TslEfs9XfCfQYvxvTHzk7oyMlBx Jkx7hI0DyCxtjF/GPMiysQ9d1k6fS+TsQq+DAXJYkTX4AIoyP9XuNjf71YwMhY7XlARX diTvgImH3TopHNn3H45LJk++6P+dAYKvx5qDtN9bxGxMxb/FV48hndgIlfNhwLx6DnSO 2B7Q== 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=SzjGjFo6eCmae/ZCig3ght1FUR+8zrQ2bs45B5ePvs4=; b=csnpN7H704bFpK3kjDwekkR8O36yicVPDWgbYfJrliOlm9TqKaMFwFuLp0VaZ1SZ0b Yeu03CifY0K3z0tdzxV3MgKgpGYp53Et8ZFu+a5Sb1ItAMnK9JT9QzjT9IU9IQpQwG22 ov6DC56IDN8sVQNwggFmfUzGShQb8NWPGDwVnocwLhDPlx1M4mA/ZU9zVrU5KAPxr87f jtmsnwy6/f8tHN/Zd01/yktjB5RNmJBsvke+WD26kPcg0f6GSdaysjsJF/j1kvCFFhei 5ZxKWlyoLDpyVSUCN1AqyRjtm/Z1vfudT3mS4qIqlEnvIuz5oT7G/Cgy6GSAXt6nSSUr uRww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=pLLm5Fy0; 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 s2si3431011pgj.60.2018.12.07.11.08.23; Fri, 07 Dec 2018 11:08:41 -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=pLLm5Fy0; 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 S1726072AbeLGTHk (ORCPT + 99 others); Fri, 7 Dec 2018 14:07:40 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48284 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbeLGTHk (ORCPT ); Fri, 7 Dec 2018 14:07:40 -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=SzjGjFo6eCmae/ZCig3ght1FUR+8zrQ2bs45B5ePvs4=; b=pLLm5Fy04HyA+9kH9tAUbeHln pFj4vAtpALOSQTXFKSqOm14FCLSrd9pUOvhLAAKUiKk990f13IUgd6/KC3C2+lYwbMwfbj1yTRXdT 4TpPMKBMuwgI9wLZ/yKtT0CQUj3ItBB3ATxuBpvcmRgr8QITWNjmauBGEugh6a0lc7JmDewPQUE/f kTLlmToyuVnHWx1dk5712lESVuZmTQeVTWVh2Py+OIaRg5qVHc8c3S9+1dvcCeDrLUi8RRM86x3J7 YOmn434KsPTvJNNFs2tS5QfQX31WuLxShjWMU0E4f7iqLvnMj+RFeEzqQEQ6CHBdPheoe7HNC1bIY NGoHy4aCQ==; Received: from [199.255.44.128] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gVLTD-0006cf-Fi; Fri, 07 Dec 2018 19:07:27 +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 , 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 Subject: [RFC] avoid indirect calls for DMA direct mappings v2 Date: Fri, 7 Dec 2018 11:07:05 -0800 Message-Id: <20181207190720.18517-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 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 Changes since v1: - now also includes all the prep patches relative to the dma-mapping for-next tree - move various slow path functions out of line - use a NULL dma ops as the indicate to use the direct mapping path - remove dma_direct_ops now that we always call it without the indirection - move the dummy dma ops to common code - explicitly st the dummy dma ops for devices that are indicates as not DMA capable by firmware