The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Raj, Ashok" <ashok.raj@intel.com>
To: Casey Leedom <leedom@chelsio.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Harsh Jain <Harsh@chelsio.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"dwmw2@infradead.org" <dwmw2@infradead.org>,
	Michael Werner <werner@chelsio.com>, "nd@arm.com" <nd@arm.com>
Subject: Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU
Date: Wed, 27 Sep 2017 12:07:45 -0700	[thread overview]
Message-ID: <20170927190745.GA96373@otc-nc-03> (raw)
In-Reply-To: <MWHPR12MB16005D59D7A33F3D5BE43395C8780@MWHPR12MB1600.namprd12.prod.outlook.com>

Hi Casey

looking at the debug output i got from Harsh it still looks like
a bug in the code. 

[  538.284589] __domain_mapping nr_pages 0x1
[  538.284600] __domain_mapping sg_res 0x1 sg->dma_address 0xf291000e dma len 0x38 pteval 0x3cbce3003 phys_pfn 0x3cbce3
[  538.284604] chelsio driver - offset 4110 len 56 dma addr f291000e dma len 56
[  538.284667] DMAR: DRHD: handling fault status reg 2
[  538.290017] DMAR: [DMA Write] Request device [02:00.4] fault addr f2910000 [fault reason 05] PTE Write access is not set

somehow when crypto_authenc_encrypt() -> scatterwalk_ffwd()-> sg_set_page()

->sg_set_page(dst, sg_page(src), src->length - len, src->offset + len);

src->offset + len gets set as sg->offset in sg_set_page(). Either the 
assumption that there should be room is incorrect, or some higher order crypto
code that ends up setting the offset did the wrong calculation.

if src->offset is already towards the end of the page, then offset+len will
go beyond the end of page.


On Wed, Sep 27, 2017 at 09:29:23PM +0000, Casey Leedom wrote:
> Hey Raj,
> 
>   Let us know if you need help in gathering more debugging information.  For
> the time being we've decided to ERRATA the use of the Intel I/O MMU with
> IPsec till we Root Cause the issue.  But this is still at the top of Harsh's
> bug list.
>  
>   With Robin's comments, I'm almost sure that the:
> 
>     (iov_pfn + sg->offset) << VTD_PAGE_SHIFT)

true, but this is the IOVA- IO Virtual address generated by the 
dma_map call. Thought in cases when sg->offset is beyond a page, then 
the new iov_pfn should fall on the next page. But we can't randomly adjust
here, unless IOMMU has also allocated IOVA for the page overflow.

Cheers,
Ashok

  reply	other threads:[~2017-09-27 22:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-16  6:11 DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU Harsh Jain
2017-09-20  8:01 ` Herbert Xu
2017-09-20 10:12   ` Robin Murphy
2017-09-20 11:20     ` Harsh Jain
2017-09-25 17:46     ` Casey Leedom
2017-09-25 15:54       ` Raj, Ashok
2017-09-25 18:46         ` Casey Leedom
2017-09-26  3:46           ` Harsh Jain
2017-09-26 12:21             ` Harsh Jain
2017-09-26 14:22               ` Robin Murphy
2017-09-26 14:34                 ` Raj, Ashok
2017-09-26 14:40                   ` Raj, Ashok
2017-09-26 20:50                     ` Casey Leedom
2017-09-26 18:15                   ` Robin Murphy
     [not found]                 ` <MWHPR12MB1600694D099E1CFAD6849A68C87B0@MWHPR12MB1600.namprd12.prod.outlook.com>
2017-09-26 16:10                   ` Dan Williams
2017-09-27 16:31                     ` Casey Leedom
2017-09-27 17:13                       ` Dan Williams
2017-10-01  8:59                         ` Christoph Hellwig
2017-09-27 17:18                       ` Robin Murphy
2017-09-27 14:48                         ` Raj, Ashok
2017-09-27 21:29                           ` Casey Leedom
2017-09-27 19:07                             ` Raj, Ashok [this message]
2017-09-27 22:13                               ` Casey Leedom
2017-09-28  5:01                                 ` Harsh Jain
2017-09-28 10:33                                 ` Herbert Xu
2017-09-28 13:38                             ` Harsh Jain
2017-09-28 13:05                               ` Raj, Ashok
2017-09-29  5:37                                 ` Harsh Jain
2017-09-27 17:30                         ` Casey Leedom
2017-09-26 17:30                 ` Casey Leedom
2017-09-25 19:31       ` Dan Williams
2017-09-25 20:05         ` Casey Leedom
2017-09-25 20:11           ` Dan Williams
2017-09-25 19:03             ` Raj, Ashok
2017-09-25 23:41               ` Casey Leedom
2017-09-26 13:04             ` Harsh Jain
2017-09-20 11:30   ` Harsh Jain
2017-09-25 18:45   ` David Woodhouse
2017-09-25 20:19     ` Casey Leedom
2017-09-26 11:17     ` Harsh Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170927190745.GA96373@otc-nc-03 \
    --to=ashok.raj@intel.com \
    --cc=Harsh@chelsio.com \
    --cc=dan.j.williams@intel.com \
    --cc=dwmw2@infradead.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=iommu@lists.linux-foundation.org \
    --cc=leedom@chelsio.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nd@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=werner@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox