Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757429AbdDRP4R (ORCPT ); Tue, 18 Apr 2017 11:56:17 -0400 Received: from mail-qt0-f176.google.com ([209.85.216.176]:33214 "EHLO mail-qt0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752748AbdDRP4O (ORCPT ); Tue, 18 Apr 2017 11:56:14 -0400 Subject: =?UTF-8?Q?Re:_=e7=ad=94=e5=a4=8d:_Using_ion_memory_for_direct-io?= To: "Zengtao (B)" , "sumit.semwal@linaro.org" References: <678F3D1BB717D949B966B68EAEB446ED0BCCFFC4@dggeml511-mbs.china.huawei.com> <2b0d4915-3705-dce5-d9dd-066549050bfc@redhat.com> <678F3D1BB717D949B966B68EAEB446ED0BCD4CDF@dggeml511-mbs.china.huawei.com> Cc: "gregkh@linuxfoundation.org" , "arve@android.com" , "riandrews@android.com" , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" From: Laura Abbott Message-ID: <5cb47fc2-3c9b-c15c-af90-599525199f42@redhat.com> Date: Tue, 18 Apr 2017 08:56:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <678F3D1BB717D949B966B68EAEB446ED0BCD4CDF@dggeml511-mbs.china.huawei.com> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2683 Lines: 79 On 04/17/2017 07:05 PM, Zengtao (B) wrote: > Hi Laura: > >> -----?ʼ?ԭ??----- >> ??????: Laura Abbott [mailto:labbott@redhat.com] >> ????ʱ??: 2017??4??18?? 0:14 >> ?ռ???: Zengtao (B) ; sumit.semwal@linaro.org >> ????: gregkh@linuxfoundation.org; arve@android.com; >> riandrews@android.com; devel@driverdev.osuosl.org; >> linux-kernel@vger.kernel.org >> ????: Re: Using ion memory for direct-io >> >> On 04/14/2017 02:18 AM, Zengtao (B) wrote: >>> Hi >>> >>> Currently, the ion mapped to userspace will be forced with VM_IO and >> VM_PFNMAP flags. >>> When I use the ion memory to do the direct-io, it will fail when >>> reaching the get_user_pages, >>> >>> Back to the VM_IO and VM_PFNMAP flag, there two flags are introduced >>> by the remap_pfn_range called by the ion_heap_mmap_user. >>> >>> From my point of view, all ion memory(cma/vmalloc/system heap) are >>> managed by linux vm, it is not reasonable to have the VM_IO and >>> VM_PFNMAP flag, but I don't any suitable function to replace the >> remap_pfn_range, any suggestions? >>> >>> Thanks && Regards >>> >>> Zengtao >>> >> >> The carveout heap is omitted from your list of 'all ion memory'. At one >> time, carveout memory was not backed by struct pages so I suspect >> this is a holdover from then. This would probably be better served > Yes, you are right, I missed the carveout heap which needs the VM_IO and VM_PFNMAP, > and I think the carveout heap can implement its own map_user rather then using the common > ion_heap_map_user. > The carveout heap only uses memory with struct pages these days. My point was that the VM_IO and VFM_PFNMAP shouldn't need to be used at all anymore. Sorry for the confusion. >> by using vm_insert_page and handling higher order pages properly. > Your latest patch has remove the the page faulting support, I didn't deep into the reason, > but I think this conflicts with the vm_insert_page. > vm_insert_page should be able to be used outside the fault handler. >> >> Thanks, >> Laura > > I tried to use the similar way as the dma framework do(split the page and map_vm_area), but > the split will break the ion sg design, maybe we need a new lowlevel map function instead of directly > using the remap_pfn_range. Yes, I don't think we can directly copy what the dma framework does. I think we should be okay with allocating pages with __GFP_COMP and then just using vm_insert_page but I'm not 100% sure this would work with CMA. For completeness sake, I know the request is for direct-io but can you share a few more details about the driver/use case where you want to use direct-io with Ion buffers? > > Thanks > Zengtao > Thanks, Laura