Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp11061215imu; Thu, 6 Dec 2018 10:54:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/WJC0ltu6k6gty3XkfRV4AL0k5uM96f3HwsMHxKWaob0iVFfWf9ZZlq38Q5r1EmTkZpEiqH X-Received: by 2002:a62:d448:: with SMTP id u8mr21111521pfl.105.1544122441090; Thu, 06 Dec 2018 10:54:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544122441; cv=none; d=google.com; s=arc-20160816; b=JXHLm7hCF1cYyMhFbuOwJO5BRnT8IDXQ80faZpbSB1105xqrb9LjZrp3UNYkK8BD7K QHye6AJPdEhx57XcFZ76/k4S+9a6IDxSd4TW4eLwEEQ4exdhWqJvGYkP1BsxPx17+6fp 9j+H0Af8O5sNdHZmJc5IB6YPYZWzEORk9WdySyUlC32wriKrbI59ANZC0Nm0QdqqkRPe 8i1SkYQ39inKSuR0M3ZHdFd/bHQvyfRfWck3gHDI/yNDabOT1u+Ax/Xl34iaKE+4PIlL FZY3HcLiDfWpkI1BT+agH6GxGuj1olTtCGxSWgL+xT6GMFjKQpj+cA0rclCixhzKkrBu zCww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=wtHJ3kp3x/vlLC5M0AAup4QJTGPpZ1IUQEvR5OziQYA=; b=hnaWBgeYgNvBam/WaKRU+1et2XchYrWJElRkUT3fnQ/nJHgp3QW5x0rQzKMnfFJqHD UQGc5o6R1/4CX5cO/bIpcSq0NcxFPprpLwcTSmZhaflfB9Tko+792eeuBUAJ7MFCtaIx ovCVUxXjM2iT29z44JDlm+8fSwf1cp/P9cOhDD7uc6+/CcFQo2wam58YM0Lul5xRJJiy CHFFeh3C5khnOAacO18u89lbjCjmUgQFZX33aG8TD66mAvXk4g/GcBBi3vGPfO8U75zx ssF15PTJSxAJXCB+MacwmYeYDczjQVL3h6tAOuVFniyELS3P46zIEHQ191zBNajMs3eP 5Wrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=J8+MOyZ7; 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 f5si803698plo.422.2018.12.06.10.53.45; Thu, 06 Dec 2018 10:54:01 -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=@linux-foundation.org header.s=google header.b=J8+MOyZ7; 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 S1725981AbeLFSvy (ORCPT + 99 others); Thu, 6 Dec 2018 13:51:54 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:37753 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725908AbeLFSvx (ORCPT ); Thu, 6 Dec 2018 13:51:53 -0500 Received: by mail-lj1-f196.google.com with SMTP id e5-v6so1366521lja.4 for ; Thu, 06 Dec 2018 10:51:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wtHJ3kp3x/vlLC5M0AAup4QJTGPpZ1IUQEvR5OziQYA=; b=J8+MOyZ7elAOpBFAXOm/DFldjf3bMIRGwHcE9Z2JExH1aRrMhhr7zDbfKJ/330KtDb pRXYgGym2+/eJK64Ck6id4J7l8akd2ew+OHirfnBah+Rjo/tZKxU7wrALb3zJ6o47QM3 03a4JqC5usku3K+Unl40IWLtK/ZBb9YsorTD8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wtHJ3kp3x/vlLC5M0AAup4QJTGPpZ1IUQEvR5OziQYA=; b=B8S1NmQh1ROo/FY/q53kBjdQgSWf12cuzJZ3Q6s6HSkb/bNjncizjfbp19vMvKU2FV lzUvM6N4dXC7NvPEEjwgZw1ScuxPAh1Wr6+J3/LKbct06Sv7gNnRy44h6Yfbb0PTqclJ YcLMpX11Pq6ZYrJyH8joOOnsakJVSMrLNO1mZW1ZerwIdlQ4cH4hdAidPyQ+c6MlDE2X krurKTBe5kl8/vFT2yp28EQw6GWdE4P/qyt2g2we4QoHYDNDgmxtYXnA2pYs4qyFqsnm iVqYMDQRiso0R+Kd9GCL1vwffzX+W98EWav6klGLUEyVvqtOc7R/EAlJcWqBnLIkQT77 Qyjw== X-Gm-Message-State: AA+aEWbG43EtGmB/e6201hE879bqjsYLxZ8w/6M/NNw2kIJkhnDUJC0e wy5YJ1Qu7B5jAfosBNqf84uMQN+NU3s= X-Received: by 2002:a2e:7d15:: with SMTP id y21-v6mr1377634ljc.77.1544122311227; Thu, 06 Dec 2018 10:51:51 -0800 (PST) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com. [209.85.208.172]) by smtp.gmail.com with ESMTPSA id x29-v6sm195853ljb.97.2018.12.06.10.51.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 10:51:50 -0800 (PST) Received: by mail-lj1-f172.google.com with SMTP id k19-v6so1321593lji.11 for ; Thu, 06 Dec 2018 10:51:50 -0800 (PST) X-Received: by 2002:a2e:994:: with SMTP id 142-v6mr16949452ljj.120.1544122309785; Thu, 06 Dec 2018 10:51:49 -0800 (PST) MIME-Version: 1.0 References: <20181206153720.10702-1-hch@lst.de> <20181206184330.GB30039@lst.de> In-Reply-To: <20181206184330.GB30039@lst.de> From: Linus Torvalds Date: Thu, 6 Dec 2018 10:51:33 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] avoid indirect calls for DMA direct mappings To: Christoph Hellwig Cc: iommu@lists.linux-foundation.org, brouer@redhat.com, tariqt@mellanox.com, ilias.apalodimas@linaro.org, toke@toke.dk, robin.murphy@arm.com, Linux List Kernel Mailing Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 6, 2018 at 10:43 AM Christoph Hellwig wrote: > > > > > (a) the dma_is_direct() function/macro uses "likely()" for the test > > I'm a little worried about that. Yes, for the common case it is > likely. But if you run a setup where you say always have an iommu > it is not, in fact it is never called in that case, but we only know > that at runtime. Note that "likely()" doesn't have any really huge overhead - it just makes the compiler move the unlikely case out-of-line. Compared to the overhead of the indirect branch, it's simply not a huge deal, it's more a mispredict and cache layout issue. So marking something "likely()" when it isn't doesn't really penalize things too much. It's not like an exception or anything like that, it's really just a marker for better code layout. Linus