Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756019AbcCQRD7 (ORCPT ); Thu, 17 Mar 2016 13:03:59 -0400 Received: from mail-qg0-f43.google.com ([209.85.192.43]:33456 "EHLO mail-qg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbcCQRD5 (ORCPT ); Thu, 17 Mar 2016 13:03:57 -0400 Date: Thu, 17 Mar 2016 18:03:50 +0100 From: Jerome Glisse To: Olu Ogunbowale Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Linus Torvalds , Michel Lespinasse , Andrew Morton , Rik van Riel , Hugh Dickins , Russell King , Ralf Baechle , Paul Mundt , "David S. Miller" , Chris Metcalf , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Jackson DSouza Subject: Re: [PATCH] mm: Export symbols unmapped_area() & unmapped_area_topdown() Message-ID: <20160317170348.GB16297@gmail.com> References: <1458148234-4456-1-git-send-email-Olu.Ogunbowale@imgtec.com> <1458148234-4456-2-git-send-email-Olu.Ogunbowale@imgtec.com> <20160317143714.GA16297@gmail.com> <20160317154635.GA31608@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160317154635.GA31608@imgtec.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2210 Lines: 43 On Thu, Mar 17, 2016 at 03:46:35PM +0000, Olu Ogunbowale wrote: > On Thu, Mar 17, 2016 at 03:37:16PM +0100, Jerome Glisse wrote: > > What other driver do for non-buffer region is have the userspace side > > of the device driver mmap the device driver file and use vma range you > > get from that for those non-buffer region. On cpu access you can either > > chose to fault or to return a dummy page. With that trick no need to > > change kernel. > > Yes, this approach works for some designs however arbitrary VMA ranges > for non-buffer regions is not a feature of all mobile gpu designs for > performance, power, and area (PPA) reasons. Well trick still works, if driver is loaded early during userspace program initialization then you force mmap to specific range inside the driver userspace code. If driver is loaded after and program is already using those range then you can register a notifier to track when those range. If they get release by the program you can have the userspace driver force creation of new reserve vma again. > > > Note that i do not see how you can solve the issue of your GPU having > > less bits then the cpu. For instance, lets assume that you have 46bits > > for the GPU while the CPU have 48bits. Now an application start and do > > bunch of allocation that end up above (1 << 46), then same application > > load your driver and start using some API that allow to transparently > > use previously allocated memory -> fails. > > Yes, you are correct however for mobile SoC(s) though current top-end > specifications have 4GB/8GB of installed ram so the usable SVM range is > upper bound by this giving a fixed base hence the need for driver control > of VMA range. Well controling range into which VMA can be allocated is not something that you should do lightly (thing like address space randomization would be impacted). And no the SVM range is not upper bound by the amount of memory but by the physical bus size if it is 48bits nothing forbid to put all the program memory above 8GB and nothing below. We are talking virtual address here. By the way i think most 64 bit ARM are 40 bits and it seems a shame for GPU to not go as high as the CPU. Cheers, J?r?me