Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751830AbdITKSp (ORCPT ); Wed, 20 Sep 2017 06:18:45 -0400 Received: from mail-bl2nam02on0081.outbound.protection.outlook.com ([104.47.38.81]:11233 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751561AbdITKSn (ORCPT ); Wed, 20 Sep 2017 06:18:43 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; oracle.com; dkim=none (message not signed) header.d=none;oracle.com; dmarc=fail action=none header.from=nxp.com; Message-ID: <1505902715.29684.34.camel@nxp.com> Subject: Re: [BACKPORT] swiotlb-xen: implement xen_swiotlb_dma_mmap callback From: Leonard Crestez To: Stefano Stabellini , Greg KH CC: , , , , Date: Wed, 20 Sep 2017 13:18:35 +0300 In-Reply-To: References: <20170916012352.GA21774@kroah.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131503763198750416;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(336005)(39380400002)(346002)(39860400002)(376002)(2980300002)(1110001)(1109001)(339900001)(377424004)(189002)(24454002)(53754006)(69234005)(199003)(47776003)(104016004)(23676002)(498600001)(5820100001)(229853002)(6246003)(85426001)(4326008)(97736004)(77096006)(50466002)(53936002)(189998001)(110136005)(50226002)(33646002)(106466001)(2870700001)(316002)(2950100002)(5660300001)(81156014)(305945005)(8676002)(2906002)(8936002)(356003)(81166006)(103116003)(68736007)(76176999)(575784001)(50986999)(86362001)(105606002)(36756003)(54906003)(99106002);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR03MB2360;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD009;1:clXkJZNDheoIrVuA9GTy0ec66A3SjNLNlywJNmbnXxI0/NnGdtTbZ9xc0bLkuQaD78MV7/3KdKE9yR7WZFSho2WZgYjyIxIoY+GS6QtRHawa2sUJU1IzudK/XWo+EWra X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf2f6c4e-bbf4-4d45-4d70-08d50010f68b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CO2PR03MB2360; X-Microsoft-Exchange-Diagnostics: 1;CO2PR03MB2360;3:ztvWwqfE1pu3wg5Nnpezre+me0xsRYxEXpc7Yr/g6DhXlzT90Bl8061AtGbjPK2bcgcNopZZt5iu6OO/iR+1mAONGp7bHXob4MjabSoJfjROeDTh6BhkhiSKyurvsLtox4fIkQeOxA+K7RRBRJzDtvYnHI+el3Wk0xVx489AscUFEN+7xB7QL7hK2iBd05XBmk3D28I+8tVW9sN4lir4VdPtUy389cOCQoK8Y8niTXm+764aOvb0d2pE4cM3FtJ5r6g5ljj89JMipFoA1VjGnpt81HB6dTt+sg/qXoBherk4u/8JDLR+4yWhgPFvE637j7CXs35YMJ93i/ThI/EGy8vQNuNIcX4xUQefE5kmWVw=;25:AHyvb4Wh3rBjZKh7Qi7smrtvg4HLfJVchKIinHZ6YLG5Z8RYeVNPoZ47zjNJAJJdaJT8bW+4oZZ2L6eM7yH9M7ZObedfqGBmDPNihJdSu9yrX/v1Rzj4KZbINbrNVnhjC7rqpl72ALGlhapJ0AwX3aJ0F5C0zqcKcyoUKe7pB6oG3Gb0Z3Hf4DfUAK7NXDB3DKQRntjrCSNd6uXSdM4n0R9dAx+z0EaNQf+ivI6TDiHrFSxLVs0aAdXzWCt2PY/IXtk+aHj594aFToO6zdp5i8GPoJQE2+JSW1Rotyfd/B4PFTg9BqSs3Q6l2eW3MHKbXvUB5+ijT/BRIDLh7j68uw== X-MS-TrafficTypeDiagnostic: CO2PR03MB2360: X-Microsoft-Exchange-Diagnostics: 1;CO2PR03MB2360;31:ZbfRgRUO9zPwAXUr9BN7Rh0MH0lUoUrqdwqE+NMMC/LATUvigxsqPRBNRgQ+Fgdmw+36S3xB+YBMj0oPsQCmLWGSrUIutfM3CWVwkLAGPha5mHDmmAVgFwb4yU3Ikc6e8CAX77JYrQRSuJFH+M6NmhigQPcvvQ781BL6zmqnNVZgonbUOTCswu0WHrltRekKZNhkfQRUtKgN5zJfC4s50g/mtiqgW47iwN/uto+zVG8=;4:y/t0nYg+g+6SpFPzY+UiMd4K1BFbkYm7SzN5zn48B1cEpP9L6RJPP7Chppb+IEJq+jfmB9EQv+h/3xNnHVX4qYN6/XUc9Q433M5nZ1se4m+iZGm88WUg+VgswYL1pwKVq87eoZiNLplwvbveaE5ZNApMkOZWMhE+2Pn41KkvQDA3lUYw5fbhw5fNrfMigUHNM0scV1f/9tmYTHDRP6PrjEpIjbRu+/npULIcGgGX6gV5mbT0WqJhKMzOvLumG5fbERBSrxUHFLUnTmt0fjQDSBBpjkvGkbZvVt0KhKrAPLU= X-Exchange-Antispam-Report-Test: UriScan:(20558992708506); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123563025)(20161123556025)(20161123559100)(20161123561025)(20161123565025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CO2PR03MB2360;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CO2PR03MB2360; X-Forefront-PRVS: 04362AC73B X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDTzJQUjAzTUIyMzYwOzIzOktlQ2t0aHFzMlZaNTRuVDJncXQ5cjdnNU1p?= =?utf-8?B?Rjd0SFpmVHR3a3cyOEVpTFNBdTF1emJHWG5RWlBNUE8zZ3F4YkZ2TzBsdVZx?= =?utf-8?B?c0tVQ0Q5cVNmbDNVTmYyTUFnM0VMZmdjS0tDb2ZOWHpPU0dTbURsQkJLL1d3?= =?utf-8?B?SHh2d01QcUJWVUkvQWdjb3lMeDl6TVZITDhkc1l1R2pDeTNURlpFN0huN0g0?= =?utf-8?B?U0hkWm5HbDJma0pjRVhkZnJGdHg5TGQ2WnlqWVV2UVFQR1VYMy9odFRjemp6?= =?utf-8?B?cDJtb0lheDFDQTFzamxzVDNCTllvdVBtSDJjeFM3UHJRY1RFVEVSRldVa3Rk?= =?utf-8?B?WXF3WkRFL3pZbXNVUUYvYmdidTlpSEI1QkNSK254S3JtZXJCVUdScXEvZlhN?= =?utf-8?B?Q3hreHF4czJkbW9HY2d3MUwyV3R1WTVsUUFDenBCVVF5bFZlYk56dm9BWncy?= =?utf-8?B?azZ4dlA1bFNMUHBCOVJnbkRMWVZoQ0wrTWo3OEZrRklDYjV0a3ZhOWRpMm1z?= =?utf-8?B?bFRjWEpzbG83QUZJZ2VQcWRVSXdGaDRRODd0UmZoYTVzMkh3S3R5TTEzM3NZ?= =?utf-8?B?OFJ0NUg0VkQ5T1F1cEkzdWhydTNjUnREOGRnR1FxcUM5UGtha3FocEdnbXNL?= =?utf-8?B?RmpoMkhISHhVcmFYS2h4ellLOFc2NWpQcUtxdS9URHBtUnlTQ0JITTU4VnBX?= =?utf-8?B?SGErb0pJUldKZ2NKMzhVem82UEhxMjczZTI2VHJyMlFZcEtyU0l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:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2017 10:18:39.6410 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR03MB2360 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1801 Lines: 44 On Mon, 2017-09-18 at 11:08 -0700, Stefano Stabellini wrote: On Fri, 15 Sep 2017, Greg KH wrote: > On Thu, Sep 14, 2017 at 04:23:05PM -0700, Stefano Stabellini wrote: > > Hi all, > >  > > We are getting reports from Xen on ARM users about DMA issues. The > > problem is that the commit below > > (7e91c7df29b5e196de3dc6f086c8937973bd0b88) is necessary to support mmap > > on Xen on ARM. It is self-contained and doesn't affect anything outside > > of Xen on ARM, so I think is a good candidate for backporting. It went > > upstream in 4.11. >  > But it's a new feature, right?  How does that fit the stable kernel > rules? It implements a previously unimplemented function (mmap), although it calls the generic functions to do it. Yes, I agree with you that it can be classified as a new feature. If that is against the stable kernel rules, then please discard this request. FYI the reason why it didn't raise a flag in my mind is that users reported something like "unhandled alignment fault (11) at 0xffffa6048080, esr 0x92000061", which really looks more like a bug. I am the one who reported this, on the #xenarm IRC channel. Not implementing mmap in dma_map_ops means that dma_common_mmap is called by dma_map_attrs as a fallback. The end result is not something like -ENOSYS but what seem to be corrupt mappings. However I agree that backporting might be excessive. I ran into this by experimenting with using a GPU from dom0. It seems reasonable to get kernel crashes if you try this kind of stuff. This patch results in calling __swiotlb_mmap instead of dma_common_mmap. I don't know the implementation details of the DMA api but the interesting difference between these paths seems to be the way pfn is fetched (from dma_addr instead of the kernel virt addr). -- Regards, Leonard