Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10989962imu; Thu, 6 Dec 2018 09:45:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/U2rYbUeXV4xMvoaaKvTkjLmlE0lb3eVgGOMktJEPPFpihsvp7x1jwkHd99vJBr+bDvFLPR X-Received: by 2002:a17:902:96a:: with SMTP id 97mr28252372plm.45.1544118307701; Thu, 06 Dec 2018 09:45:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544118307; cv=none; d=google.com; s=arc-20160816; b=SOB/8syFqnP2PdrEAX3EkOad+v3xnJqDG1/jS8jm6P+Q0NqJGFNcl0/zaXE35mPw24 DvtSWesOM76QW3//ZCW0cQrb5Lxg1l3xKezSywrdHv+A+buKkTWwGhB//qRScqPk/WLq J9pxPTel+UdI9r9CQsmhZXKt3+TA9fF8AX1XmXIVXRg+Jtf6cnMZWWS0L/jzPuqIlBph mZHJ1F33ZadIJ90iYqsYl/52TJvkpbUcHWs0HpryJGNW4ZgAIqkDShjrhAWHnrfjdPxa NH3rrtb5MvCzVpyPewjJh08y/RYcuBfZMNI/DmVcc7PC5kO/taJ6kOQLcsmQw8B2kZ5t UqZA== 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=9LloB4wkmKJ7ieoBheXWDuxXDpLsloqDuDtnyXjY5mk=; b=Z9oCOrMIr38ZQmkplVek0H2QgchdOUMiDDd+UDszPttG1vtrxYd+RUqTt5hl5LIIFE Iv/YLN405u2pMI8E3j8FRulSzD1V7q6iP2Qe8yX0LIpgrZY8dejDrHflJy2ehhJuE6xC AchEjF0Lje3WgTF8w2ac7Sf/cO45L4QarTSCOuJqcW5GEDi2tsU68tdDAYj5sVFDHOr3 iye4moV+UoSDuLPYDBcvUODfjM4lkeBH8VRQXQXs4R7SG0kx2PR4bxFKhX3+PGd71E4d rhlDMUE3dhFDCxEVKJH7RdhdL/n0QTEtldHGkHhM1KHHujSC3KEPAuY8oZp2dhxWyfh3 DUbQ== 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 9si756406pfq.129.2018.12.06.09.44.51; Thu, 06 Dec 2018 09:45:07 -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 S1726020AbeLFRn7 (ORCPT + 99 others); Thu, 6 Dec 2018 12:43:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44596 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725871AbeLFRn6 (ORCPT ); Thu, 6 Dec 2018 12:43:58 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7308C7F6D0; Thu, 6 Dec 2018 17:43: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 BBAC360F89; Thu, 6 Dec 2018 17:43:52 +0000 (UTC) Date: Thu, 6 Dec 2018 18:43:51 +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 , linux-kernel@vger.kernel.org, brouer@redhat.com Subject: Re: [RFC] avoid indirect calls for DMA direct mappings Message-ID: <20181206184351.4d9ece54@redhat.com> In-Reply-To: <20181206153720.10702-1-hch@lst.de> References: <20181206153720.10702-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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 06 Dec 2018 17:43:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Dec 2018 07:37:19 -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 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. Full test report avail here: https://github.com/xdp-project/xdp-project/blob/master/areas/dma/dma01_test_hellwig_direct_dma.org > 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 > -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer