Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp11040950imu; Thu, 6 Dec 2018 10:32:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/XQaxLCiNluMBuGYZZU1bR6JXsJ0hSlCTiV1FsJjmSRAfTOt5TKYu1Im2EvwqM9Er6H+zuP X-Received: by 2002:a17:902:f20d:: with SMTP id gn13mr28123445plb.11.1544121124499; Thu, 06 Dec 2018 10:32:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544121124; cv=none; d=google.com; s=arc-20160816; b=tgWRLZb5ZOF0Du10/3q8JHkTbCI6YP675vzzBDBRrALD78lw3j3ISkRI6tEPbNdPqq QtZWsgGKsFycVGrezQj4z0RE80N/ArpkaR4b2zdxIAgYTqqxVANDvvBm1nWh/teTHSpy LfTqwykqFy+IIFLpTmTiPfi0yihmnxIk7SiKezJZkRzn+4sE5aYxvX1BRHbWR5Lmg3Fw O++aVHPYYX6dbB/zEdQxL/lnvvx0baXBsRfI+eW2S7JNIBhAwI8xgo0yNVcbyKENUSjv Ty4JaE5V7PP9t+75AP1o3PJPCb8LxEk9B15K30NllgxwgtL2umjcwFj83A/uFofqfZmF 83Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=0NaZAcuUcKs3rDmTTBoyewiFljJ1a7xNnUVaA9keIjU=; b=mOi+04dbLj1nTBHZF6EjuRQjB1b1sA9ABdsVklGMwbtO5Igh8jq5kyW9gSq0WTGWyg SzLpG5j+GJbYFLbDgnxbukqwqLhSiOak4KabnVgUSCrq9gAINWuWAOY/FPwx9u6oTxV9 tEFrWyc+S+JrO8DyDuR/Zq7UM+qZwCsaE5w4rL4B6ITY5t06t632gyw/xoWt+QmflB+3 Rr6zMLSugjGsVf0zW4pg+CLBUW0sleJkr1XiWc/jeIaF4rsuQk0xN0tGJWLFMZ4LxXpG OhHMoKZV0h1ByWmIZgZktSViWOFT9K2PA9sg3pmEF6pCNWG8kMHA+jTSqvEVexY/044Y UxZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VwDjgCEu; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d37si792409plb.140.2018.12.06.10.31.46; Thu, 06 Dec 2018 10:32:04 -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=pass header.i=@gmail.com header.s=20161025 header.b=VwDjgCEu; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726063AbeLFS3p (ORCPT + 99 others); Thu, 6 Dec 2018 13:29:45 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44366 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbeLFS3n (ORCPT ); Thu, 6 Dec 2018 13:29:43 -0500 Received: by mail-wr1-f68.google.com with SMTP id z5so1436052wrt.11 for ; Thu, 06 Dec 2018 10:29:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=0NaZAcuUcKs3rDmTTBoyewiFljJ1a7xNnUVaA9keIjU=; b=VwDjgCEuc9LIF16vp2V4+onnSgHG7jioDhWM2BHan1wcUomYniDPBRzvjFL3BPpvAV KtdrmCxrGgaM8aX6M+5470L7GL3CSPNA1npakFNoC/MAZjr5aF5RpSSfuTZ9HohwIxhx 4U52DWC/pJlO2ASsT9+49jxFCT2oPaUfuMCK7C2T2g2I/DdLqlAoisDPow1WTF9rbXWH V+S2FKSfoVDen3duYnmemAWP+mf3ipP8AmusjkIiNdfMKUchN/HeFTWD4weup7aT7lqO OcL7BqvEs+R0uoJ12ZIyf3kijPUHEvlpn+0DkM+fuGNxuwPU2SJoSXkla4Jyfwyjiku7 bfTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=0NaZAcuUcKs3rDmTTBoyewiFljJ1a7xNnUVaA9keIjU=; b=gTjv0yv+Kqt6eS5VUNpUc2sCqJKx0AXp2h6aNbbLcDMYMeaqxCBa8VwZo4a3ZMH4PX 3aYblu/VsxltlnCo7vTAYtJGYUZ5eFbTDEYb6TdO6Bsdy99HbmOsQi5QbfFY99KBXP5O J01VKzshMaRH1BH95TcgBaegMmiks7aiOaHGzHmZ/PEGbloFIOUhDKl9JE/we76CS1+n SwwOK1QenHsvUp3yr9PJqpgQ33ppEjsYPFXAqQIghWW9u+DGTBD4xJgfnKugMh5actum KzQDKMnY6e7/I9805ta+aDp5xOjb0dX63XTL6gdcJV2H9fGbyPk8iqtQKNN9sKl0gM8E O7fw== X-Gm-Message-State: AA+aEWZNc9YOrxb/IkZpK5aK0UkD+tPq3zH/SniEbLm/Q09TO9UZkXaW jjRNQrHFyeI6F/n4O1nOwEY= X-Received: by 2002:a5d:6105:: with SMTP id v5mr25741337wrt.63.1544120981444; Thu, 06 Dec 2018 10:29:41 -0800 (PST) Received: from [10.2.19.70] ([208.91.2.1]) by smtp.gmail.com with ESMTPSA id s66sm2082513wmf.34.2018.12.06.10.29.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 10:29:40 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Subject: Re: [RFC] avoid indirect calls for DMA direct mappings From: Nadav Amit In-Reply-To: <20181206184351.4d9ece54@redhat.com> Date: Thu, 6 Dec 2018 10:29:35 -0800 Cc: Christoph Hellwig , =?utf-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Linus Torvalds , Ilias Apalodimas , LKML , iommu , Robin Murphy , Tariq Toukan , Josh Poimboeuf Content-Transfer-Encoding: quoted-printable Message-Id: References: <20181206153720.10702-1-hch@lst.de> <20181206184351.4d9ece54@redhat.com> To: Jesper Dangaard Brouer X-Mailer: Apple Mail (2.3445.101.1) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Dec 6, 2018, at 9:43 AM, Jesper Dangaard Brouer = wrote: >=20 > On Thu, 6 Dec 2018 07:37:19 -0800 > Christoph Hellwig wrote: >=20 >> Hi all, >>=20 >> 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. >>=20 >> 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. >>=20 >> 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. >=20 > Full test report avail here: > = https://github.com/xdp-project/xdp-project/blob/master/areas/dma/dma01_tes= t_hellwig_direct_dma.org >=20 >=20 >> 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: >>=20 >>=20 >> git://git.infradead.org/users/hch/misc.git dma-direct-calls >>=20 >> Gitweb: >>=20 >> = http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-direct= -calls Did you happen to see my RFC for "automatic" indirect call promotion?=20 https://lkml.org/lkml/2018/10/18/175 I hope to get v1 based on Josh responses next week.