Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1359960

Re: [PATCH] mm: Export symbols unmapped_area() & unmapped_area_topdown()

Path csiph.com!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Oded Gabbay <oded.gabbay@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mm: Export symbols unmapped_area() & unmapped_area_topdown()
Date Thu, 17 Mar 2016 16:40:02 +0100
Message-ID <rdIbM-Jr-27@gated-at.bofh.it> (permalink)
References <rdnh0-3tX-13@gated-at.bofh.it> <rdnh0-3tX-11@gated-at.bofh.it> <rdHfI-9X-17@gated-at.bofh.it>
X-Original-To Jerome Glisse <j.glisse@gmail.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ESZmr7z55dY4isGy7A6PciLZOP26zKxnyvIb4cq3Crk=; b=eyauCaW99NcsBw9iIwnrr5bkZXNyFhRFWBcKZ4cAT0c5um0JvBPDzKRRDEaJ4bGquV bAC4szkGAT9RYs97nCcPvijp6GCu+tTT512tVEzR+WoDGMSAhCjLw/GIzrnFk449HzYX RgcLVd36MAPU/3VZYSYMf/+olWXCtFgpcKQtA7YR4q9+JW+v7mkX9MGHUzmz/sk6d1kj ZdtWUKINTe4MiDKGd3yg1A11RXRT45ktrTXFcvaAOEPBcF73cxXri/Mf0GD9rNKNSHjs 7udPndvpAxRcGgDe9T+dodRUxe7eD5m6pagWVedzPLUuhRcguBzF728diW2f6uWdSz3Y St3Q==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ESZmr7z55dY4isGy7A6PciLZOP26zKxnyvIb4cq3Crk=; b=DL99vjUdSzDt3poUt30lt/YL3iJ/A/lUS5SvRIziawOVRlYkasUAgEjpKi4Ata1zig eE/fH4LQgjtXsdWPsnTSoouqw28YDWFAMjFdG/e+9W4o8qo9RuI622eTRytkQf5l58At 4iFIhYAdPzjmVxu/58CXDiDEln7UEm4fX2x15OvT61nbeVj0c2OO2zNajFIacWsAgC07 Byg/GWSdifA8UcywOes+U73N0iD+IiYEuNBRK1WggXhL4ZrSJxD+GSz9cVT9oTap7O1m 24z26kukVjRgOcGY6aNs5kp4je+emPYk49+Ghzsk8K1NdZBdWS7laFfp0Ha6Fg60SAt+ 7x0Q==
X-Gm-Message-State AD7BkJJMEfrSu5R+XezQQdkAY3jxuOfy04zWiteiKvon4GQQhD/dFhI3AVNUdJFKHrscx2wFIjyeg673QupQJg==
X-Received by 10.28.142.202 with SMTP id q193mr11161052wmd.60.1458229161958; Thu, 17 Mar 2016 08:39:21 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8BIT
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 55
Organization linux.* mail to news gateway
X-Original-Cc Olu Ogunbowale <Olu.Ogunbowale@imgtec.com>, linux-mm <linux-mm@kvack.org>, "Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>, Linus Torvalds <torvalds@linux-foundation.org>, Michel Lespinasse <walken@google.com>, Andrew Morton <akpm@linux-foundation.org>, Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>, Russell King <linux@arm.linux.org.uk>, Ralf Baechle <ralf@linux-mips.org>, Paul Mundt <lethal@linux-sh.org>, "David S. Miller" <davem@davemloft.net>, Chris Metcalf <cmetcalf@tilera.com>, Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>, "H. Peter Anvin" <hpa@zytor.com>
X-Original-Date Thu, 17 Mar 2016 17:38:52 +0200
X-Original-Message-ID <CAFCwf11pk_umjO7TirPPJCf6gpMvGg3bXHsDj707Dfr07xkgZg@mail.gmail.com>
X-Original-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>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1359960

Show key headers only | View raw


On Thu, Mar 17, 2016 at 4:37 PM, Jerome Glisse <j.glisse@gmail.com> wrote:
> On Wed, Mar 16, 2016 at 05:10:34PM +0000, Olu Ogunbowale wrote:
>> From: Olujide Ogunbowale <Olu.Ogunbowale@imgtec.com>
>>
>> Export the memory management functions, unmapped_area() &
>> unmapped_area_topdown(), as GPL symbols; this allows the kernel to
>> better support process address space mirroring on both CPU and device
>> for out-of-tree drivers by allowing the use of vm_unmapped_area() in a
>> driver's file operation get_unmapped_area().
>>
>> This is required by drivers that want to control or limit a process VMA
>> range into which shared-virtual-memory (SVM) buffers are mapped during
>> an mmap() call in order to ensure that said SVM VMA does not collide
>> with any pre-existing VMAs used by non-buffer regions on the device
>> because SVM buffers must have identical VMAs on both CPU and device.
>>
>> Exporting these functions is particularly useful for graphics devices as
>> SVM support is required by the OpenCL & HSA specifications and also SVM
>> support for 64-bit CPUs where the useable device SVM address range
>> is/maybe a subset of the full 64-bit range of the CPU. Exporting also
>> avoids the need to duplicate the VMA search code in such drivers.
>
> 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.
>
> 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.
>
> Unless you are in scheme were all allocation must go through some
> special allocator but i thought this was not the case for HSA. I know
> lower level of OpenCL allows that.
>
> Cheers,
> Jérôme

In amdkfd (AMD HSA kernel driver), for APU's where the CPU and GPU sit
on the same die, we don't need this as the GPU cores use the AMD IOMMU
(v2) to access the system memory. i.e. we don't need to use vram (gpu
memory) at all and we don't need to mirror address spaces.

For dGPU, it's a different story. On GPUs where there is only 40-bit
memory space, for example, GCN 1.0 and 1.1, I would assume a pass
through a special allocator is a must, while memory addresses below
the 40-bit limit will need to be reserved for HSA. Note that amdkfd
doesn't support dGPU at this time.

Thanks,
    Oded

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm: Export symbols unmapped_area() & unmapped_area_topdown() Olu Ogunbowale <Olu.Ogunbowale@imgtec.com> - 2016-03-16 18:20 +0100
  Re: [PATCH] mm: Export symbols unmapped_area() &  unmapped_area_topdown() Christoph Hellwig <hch@infradead.org> - 2016-03-16 21:40 +0100
    Re: [PATCH] mm: Export symbols unmapped_area() &  unmapped_area_topdown() Rik van Riel <riel@redhat.com> - 2016-03-16 22:10 +0100
      Re: [PATCH] mm: Export symbols unmapped_area() &  unmapped_area_topdown() Ingo Molnar <mingo@kernel.org> - 2016-03-17 08:30 +0100
      Re: [PATCH] mm: Export symbols unmapped_area() &  unmapped_area_topdown() Olu Ogunbowale <olu.ogunbowale@imgtec.com> - 2016-03-17 17:50 +0100
  Re: [PATCH] mm: Export symbols unmapped_area() &  unmapped_area_topdown() Jerome Glisse <j.glisse@gmail.com> - 2016-03-17 15:40 +0100
    Re: [PATCH] mm: Export symbols unmapped_area() & unmapped_area_topdown() Oded Gabbay <oded.gabbay@gmail.com> - 2016-03-17 16:40 +0100
    Re: [PATCH] mm: Export symbols unmapped_area() &  unmapped_area_topdown() Olu Ogunbowale <olu.ogunbowale@imgtec.com> - 2016-03-17 16:50 +0100
      Re: [PATCH] mm: Export symbols unmapped_area() &  unmapped_area_topdown() Jerome Glisse <j.glisse@gmail.com> - 2016-03-17 18:10 +0100
        Re: [PATCH] mm: Export symbols unmapped_area() &  unmapped_area_topdown() Olu Ogunbowale <olu.ogunbowale@imgtec.com> - 2016-03-17 18:50 +0100

csiph-web