Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752320AbdI0WNM (ORCPT ); Wed, 27 Sep 2017 18:13:12 -0400 Received: from mail-by2nam03on0094.outbound.protection.outlook.com ([104.47.42.94]:44096 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752095AbdI0WNK (ORCPT ); Wed, 27 Sep 2017 18:13:10 -0400 From: Casey Leedom To: "Raj, Ashok" CC: Robin Murphy , Dan Williams , "Harsh Jain" , Herbert Xu , "linux-kernel@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "linux-crypto@vger.kernel.org" , "dwmw2@infradead.org" , Michael Werner , "nd@arm.com" Subject: Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU Thread-Topic: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU Thread-Index: AQHTLrKuCX/YGlya50aETYTEmnILyqK9cAoAgAAkZQCACFcnkv//5CkAgAAvAguAAJgAAIAAj7QAgAAh/4CAABrJ6IAAA2oAgAGW6yaAAA4uAP//1k4AgABoxyT//9+SgAAGQBIW Date: Wed, 27 Sep 2017 22:13:04 +0000 Message-ID: References: <6d2af675-7b97-6eaf-4daa-d7bf80a05923@chelsio.com> <437a9bd8-d4d6-22ca-1a64-1a3e73f1101a@arm.com> <20170927181802.3dcd7efb@m750.lan> <20170927144847.GA95654@otc-nc-03> ,<20170927190745.GA96373@otc-nc-03> In-Reply-To: <20170927190745.GA96373@otc-nc-03> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [12.32.117.8] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR12MB1949;6:4AvNKAXPxM8Oo2vYR9YZKLza/SM4KS/vsTyO53hMb5qAoenBls3xUdwayZwZT3bhfLz976iJm8zUAFNa0tbVmrtE9i/wlNpfmyulpyitTjAfCCttHIjqZnxgzdXGc/+eQpQbuVCM+aFF+l4vm8gjkTNN3UTQ5G5g4nk8RDEI46DEzQ/OdCCAJCBWFBNn2w4Ly/KkHCuxcFZ7FP7/Pn8oP5d5l2mVR2HHottYdv2xO5kxLO8aj8uyG5CChCersEJwSArocZpU7PZ9142LAH2rX+czXn3+U1g7HtWc8jt4+pOj3AUWSHkrkwR8/wqWTZpw+22+WTVr9fJ7RK/Zlb7sNQ==;5:2mn1MhmG5Yqs5wVcUv+tUKD7+1prfTy3pwq2SUPxF6SHB9zjZmFpcTQuovdeaTHnqegPr59dFDmy7XC5YAJiEsMi7Mkfc36pMg5JqW6kL+/MMQ8PzVUciaNXFbfHQ+URLrY4XNddHtx/l3NCJa1Y4A==;24:xmXuKfjNTtNDTW/6s8ffl1XqIk/uppq6N0fA88Tw8t004jt8D/hCL3mMLwdfP9o8aWWDLSPZi9dop8Y56ls6Qzk02xmlGRXNUkVdMjQ6Mrw=;7:lcCNTbXS1tUKyLTmiyCu/Y3IzDjDFguVZbJzH/uH+MYdF1ep/HdgSXTIFM/u/himW6/U4CP/j/vZGEu9DtLv5FbOKzhGjpThOhXmuo8wtCIfT3uXcOjc2wzBub/S/IYGoISnL23f2QCmVKMFTF4AvcXGgwEvza92VPdKdj8sTSVgBL0Qi6Us7hXn23hyvwW9imgMOllSjVpXFNtM6Va4tN0lLFogWqpQUlkMVN5caOM= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10019020)(6009001)(376002)(346002)(199003)(377454003)(189002)(316002)(33656002)(6246003)(2950100002)(14454004)(68736007)(6506006)(6916009)(77096006)(4326008)(6436002)(99286003)(53936002)(55016002)(54356999)(50986999)(101416001)(76176999)(5660300001)(7696004)(229853002)(9686003)(93886005)(81156014)(86362001)(81166006)(8676002)(2900100001)(3660700001)(478600001)(305945005)(74316002)(7736002)(25786009)(8936002)(6116002)(102836003)(3846002)(97736004)(105586002)(3280700002)(66066001)(2906002)(54906003)(189998001)(106356001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR12MB1949;H:MWHPR12MB1600.namprd12.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; x-ms-office365-filtering-correlation-id: 3ee6a2b3-9576-4b85-ab06-08d505f4ecc5 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(2017082002075)(2017052603199)(201703131423075)(201702281549075);SRVR:MWHPR12MB1949; x-ms-traffictypediagnostic: MWHPR12MB1949: authentication-results: spf=none (sender IP is ) smtp.mailfrom=leedom@chelsio.com; x-exchange-antispam-report-test: UriScan:(228905959029699); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(6041248)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(2016111802025)(20161123564025)(20161123562025)(20161123558100)(6072148)(6043046)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:MWHPR12MB1949;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:MWHPR12MB1949; x-forefront-prvs: 04433051BF spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-OriginatorOrg: chelsio.com X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Sep 2017 22:13:04.3298 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 065db76d-a7ae-4c60-b78a-501e8fc17095 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1949 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8RMDH4B024748 Content-Length: 1257 Lines: 33 | From: Raj, Ashok | Sent: Wednesday, September 27, 2017 12:07 PM | | 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. Hhmmm, it seems like we need Herbert to comment on this. Herbert, is there any specific debugging information that you'd like to see here? Casey