Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp465213pxv; Thu, 8 Jul 2021 06:40:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz68IRE5KtG/IYI0rag+g60DIDt3TZh/ryP/fgGmQUbT5arMXduFKShiO//I7vXdEBkpM1A X-Received: by 2002:a5d:408f:: with SMTP id o15mr35165342wrp.342.1625751608008; Thu, 08 Jul 2021 06:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625751607; cv=none; d=google.com; s=arc-20160816; b=sDmqADaD6dFatgOR/vk7jyhxkMiqLrGJb4DQxdXb2ZKgM/r0Xv6EVsPNU8pQ2fFBUx rVN86tzVfnxbspy4h3umtOG9V3hVpa7AZgCQ/haliOzohpsbl7Qcd9TmFuAjWJWKqR4W KIyw8xigQWPlMo2BYIsStimknWFi0fs3s63aoIyTpI2UUQp9F+hAIBolB+w5wjrhrNMg ZuOIdc+sm7IkpYRFR522yRMoiZddttdufTgU4Md8Ev1kQmAhKti0c2SBCx3wb/2OYM/Q qzYan4ksqMYNNMX5k1ldDFhw5/CLJuR3SapD7u9mFsoaxUdlgcxaeiuGYVmoEE2fm0/X /LrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:to:cc; bh=kRJO3oNHE9kHVvm/+WaTTJ2M6Rg5EejJaHQRsmxIjsQ=; b=IRE1xJHuyCzDnTNKUwmxr9BWgFQ4WNwy10hDvCayPkgiAf9jjpzVLMHj+qNbfmj1d3 Jmk8bSy/CEOkkzQFoFmXrn1+zmf23SeCnEJOThhRKi+IQ45M014GBZYFWkTRJ7XgCudU m/rLk3lsj3wUkQC1J7AJ+Gy8qJM/FPIDWiNo6wBSaYWeLkHjm65XstbkTiVLgTh/5bMX TVgPmS5K59yH43htSMMfq4EDnizTqECFPIdVmE2p/+f8RyTTMlO6a2mBQjwCqgGN7H4Z 5cnCOhdddsiWTRYF2Q0ssHpfGc6yEiVktQyZQyRJDzm3E3qwRyVXrcYqGNqWBYd+tjur 0JVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nc38si3777739ejc.36.2021.07.08.06.39.45; Thu, 08 Jul 2021 06:40:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231842AbhGHNlV (ORCPT + 99 others); Thu, 8 Jul 2021 09:41:21 -0400 Received: from mga09.intel.com ([134.134.136.24]:2879 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231817AbhGHNlU (ORCPT ); Thu, 8 Jul 2021 09:41:20 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10038"; a="209467995" X-IronPort-AV: E=Sophos;i="5.84,222,1620716400"; d="scan'208";a="209467995" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2021 06:38:38 -0700 X-IronPort-AV: E=Sophos;i="5.84,222,1620716400"; d="scan'208";a="487606704" Received: from blu2-mobl3.ccr.corp.intel.com (HELO [10.254.214.103]) ([10.254.214.103]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2021 06:38:36 -0700 Cc: baolu.lu@linux.intel.com, Sergey Senozhatsky , iommu@lists.linux-foundation.org, David Stevens , Christoph Hellwig , linux-kernel@vger.kernel.org To: David Stevens , Joerg Roedel , Will Deacon References: <20210707075505.2896824-1-stevensd@google.com> From: Lu Baolu Subject: Re: [PATCH 0/4] Add dynamic iommu backed bounce buffers Message-ID: Date: Thu, 8 Jul 2021 21:38:34 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210707075505.2896824-1-stevensd@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, I like this idea. Thanks for proposing this. On 2021/7/7 15:55, David Stevens wrote: > Add support for per-domain dynamic pools of iommu bounce buffers to the > dma-iommu API. This allows iommu mappings to be reused while still > maintaining strict iommu protection. Allocating buffers dynamically > instead of using swiotlb carveouts makes per-domain pools more amenable > on systems with large numbers of devices or where devices are unknown. Have you ever considered leveraging the per-device swiotlb memory pool added by below series? https://lore.kernel.org/linux-iommu/20210625123004.GA3170@willie-the-truck/ > > When enabled, all non-direct streaming mappings below a configurable > size will go through bounce buffers. Note that this means drivers which > don't properly use the DMA API (e.g. i915) cannot use an iommu when this > feature is enabled. However, all drivers which work with swiotlb=force > should work. If so, why not making it more scalable by adding a callback into vendor iommu drivers? The vendor iommu drivers have enough information to tell whether the bounce buffer is feasible for a specific domain. > > Bounce buffers serve as an optimization in situations where interactions > with the iommu are very costly. For example, virtio-iommu operations in The simulated IOMMU does the same thing. It's also an optimization for bare metal in cases where the strict mode of cache invalidation is used. CPU moving data is faster than IOMMU cache invalidation if the buffer is small. Best regards, baolu