lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a098359a-0f89-6028-68df-9f83718df256@linux.intel.com>
Date:   Fri, 26 Jul 2019 09:56:51 +0800
From:   Lu Baolu <baolu.lu@...ux.intel.com>
To:     Christoph Hellwig <hch@....de>
Cc:     baolu.lu@...ux.intel.com, David Woodhouse <dwmw2@...radead.org>,
        Joerg Roedel <joro@...tes.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>, ashok.raj@...el.com,
        jacob.jun.pan@...el.com, alan.cox@...el.com, kevin.tian@...el.com,
        mika.westerberg@...ux.intel.com, Ingo Molnar <mingo@...hat.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        pengfei.xu@...el.com,
        Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Robin Murphy <robin.murphy@....com>,
        Jonathan Corbet <corbet@....net>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Juergen Gross <jgross@...e.com>,
        Stefano Stabellini <sstabellini@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
        Jacob Pan <jacob.jun.pan@...ux.intel.com>
Subject: Re: [PATCH v5 02/10] iommu/vt-d: Use per-device dma_ops

Hi,

On 7/25/19 7:43 PM, Christoph Hellwig wrote:
> On Thu, Jul 25, 2019 at 03:18:03PM +0800, Lu Baolu wrote:
>>> Don't we need to keep this bit so that we still allow the IOMMU
>>> to act if the device has a too small DMA mask to address all memory in
>>> the system, even if if it should otherwise be identity mapped?
>>>
>>
>> This checking happens only when device is using an identity mapped
>> domain. If the device has a small DMA mask, swiotlb will be used for
>> high memory access.
>>
>> This is supposed to be handled in dma_direct_map_page():
>>
>>          if (unlikely(!dma_direct_possible(dev, dma_addr, size)) &&
>>              !swiotlb_map(dev, &phys, &dma_addr, size, dir, attrs)) {
>>                  report_addr(dev, dma_addr, size);
>>                  return DMA_MAPPING_ERROR;
>>          }
> 
> Well, yes.  But the point is that the current code uses dynamic iommu
> mappings even if the devices is in the identity mapped domain when the
> dma mask іs too small to map all memory directly.  Your change means it
> will now use swiotlb which is most likely going to be a lot more

By default, we use DMA domain. The privileged users are able to change
this with global kernel parameter or per-group default domain type under
discussion. In another word, use of identity domain is a choice of the
privileged user who should consider the possible bounce buffer overhead.

I think current code doesn't do the right thing. The user asks the iommu
driver to use identity domain for a device, but the driver force it back
to DMA domain because of the device address capability.

> expensive.  I don't think that this change is a good idea, and even if
> we decide that this is a good idea after all that should be done in a
> separate prep patch that explains the rationale.

Yes. Make sense.

Best regards,
Baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ