Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751975AbdI2MN6 (ORCPT ); Fri, 29 Sep 2017 08:13:58 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:57869 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750782AbdI2MN4 (ORCPT ); Fri, 29 Sep 2017 08:13:56 -0400 X-AuditID: cbfec7f4-f79ab6d000003290-a3-59ce3901c99a Subject: Re: [PATCH 3/4] iommu/arm-smmu-v3: Use NUMA memory allocations for stream tables and comamnd queues To: Robin Murphy , Ganapatrao Kulkarni , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-mm@kvack.org, Christoph Hellwig Cc: Will.Deacon@arm.com, lorenzo.pieralisi@arm.com, hanjun.guo@linaro.org, joro@8bytes.org, vbabka@suse.cz, akpm@linux-foundation.org, mhocko@suse.com, Tomasz.Nowicki@cavium.com, Robert.Richter@cavium.com, jnair@caviumnetworks.com, gklkml16@gmail.com From: Marek Szyprowski Message-id: <7e270ffc-963c-c1c7-410c-ff3c2e767984@samsung.com> Date: Fri, 29 Sep 2017 14:13:50 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-version: 1.0 In-reply-to: Content-type: text/plain; charset="utf-8"; format="flowed" Content-transfer-encoding: 7bit Content-language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0hTcRTH+e3e3Xu3mtzmyl/2EAYa9PBBQr9eZiB1/6jor8RIauhlWtuK LaVV1DI1t8rVZjhmhakVudnGlOGjDKeplI3sIY1yRVpqZZSP0qTVtqvgf59zzvf8zvkefhQm /sePpnJVx1m1SqaQEkLc3TntXQc2ejMSvz5dga477ASafHufRJP39DzkbLzIR/dsj3mo8tFm ZPxdTyB9hZNEroE+PnrZfJ1Afvs/Pvo2M0yi96Wp6K9lhERtPwaDKXcn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4rF5Sb3H5BvLGT1232xg81i/5SqLx5kFR9g9Pm+SC+CL4rJJ Sc3JLEst0rdL4MpYfekTe8FN7ooXD/6xNDDu4uxi5OSQEDCR6OqZzg5hi0lcuLeerYuRi0NI YAmjxLSF95kgnOeMEhN3fGUDqRIWyJOYdXMGC4gtIvCfUeLBrwCQImaBBiaJcz+egI0SEmhi knjzIx3EZhMwlOh62wXWzCtgJzHpxWEwm0VAVeLVy8esILaoQIzEz0uPWCBqBCV+TL4HZnMK WEsc/tLDDGIzC5hJfHl5mBXClpfYvOYtVFxcorn1JssERsFZSNpnIWmZhaRlFpKWBYwsqxhF UkuLc9Nziw31ihNzi0vz0vWS83M3MQIje9uxn5t3MF7aGHyIUYCDUYmH94bc2Ugh1sSy4src Q4wSHMxKIrz7jM9FCvGmJFZWpRblxxeV5qQWH2KU5mBREuft3bM6UkggPbEkNTs1tSC1CCbL xMEp1cBotrbku2cV2zGGsnm8LJdbmeSj1c0rPNs2/vz6cu/DQH5PgWUftaKddqU3nEj/uYtd 58s5pwtcV17VhTbtvmPzX2lqbFla1/kjVj6ZnJd4zx5dovrNXWhmwd6+5C0T2i8vL70cVXeM xbak6dtLfb9iHv75zh3M5v95AmsMG7jCllx/7c86u1CJpTgj0VCLuag4EQCOEhya6AIAAA== X-CMS-MailID: 20170929121352eucas1p1d2a433655951c075a61af1c83325c09a X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-CMS-RootMailID: 20170921115811epcas5p49012d8793fc765bb86830bfc377b6d36 X-RootMTR: 20170921115811epcas5p49012d8793fc765bb86830bfc377b6d36 References: <20170921085922.11659-1-ganapatrao.kulkarni@cavium.com> <20170921085922.11659-4-ganapatrao.kulkarni@cavium.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1457 Lines: 38 Hi Robin, On 2017-09-21 13:58, Robin Murphy wrote: > [+Christoph and Marek] > > On 21/09/17 09:59, Ganapatrao Kulkarni wrote: >> Introduce smmu_alloc_coherent and smmu_free_coherent functions to >> allocate/free dma coherent memory from NUMA node associated with SMMU. >> Replace all calls of dmam_alloc_coherent with smmu_alloc_coherent >> for SMMU stream tables and command queues. > This doesn't work - not only do you lose the 'managed' aspect and risk > leaking various tables on probe failure or device removal, but more > importantly, unless you add DMA syncs around all the CPU accesses to the > tables, you lose the critical 'coherent' aspect, and that's a horribly > invasive change that I really don't want to make. > > Christoph, Marek; how reasonable do you think it is to expect > dma_alloc_coherent() to be inherently NUMA-aware on NUMA-capable > systems? SWIOTLB looks fairly straightforward to fix up (for the simple > allocation case; I'm not sure it's even worth it for bounce-buffering), > but the likes of CMA might be a little trickier... I'm not sure if there is any dma-coherent implementation that is NUMA aware. Maybe author should provide some benchmarks, which show that those structures should be allocated in NUMA-aware way? On the other hand it is not that hard to add required dma_sync_* calls around all the code which updated those tables. > ... Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland