All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Chew <achew-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: CUDA fixed VA allocations and sparse mappings
Date: Wed, 8 Jul 2015 14:18:02 -0700	[thread overview]
Message-ID: <20150708211801.GA27080@achew-linux64.nvidia.com> (raw)
In-Reply-To: <20150708194004.GA8122-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

> > > Ah, I get what you're saying.  Sure, I think that might be okay.  Not sure
> > > how we would get at that information, though, and it would be horrible to
> > > just bake it in somewhere.  I'm looking into how nvgpu driver does it...
> > > maybe they have good reasons to do it the way they do.  Sorry if I go
> > > quiet for a little bit...
> > After a very quick look, it looks like the kernel defines a
> > PAGE_OFFSET macro which is the start of kernel virtual address space.
> 
> You need to be carefull here, first the hardware might not have as many bit
> as the CPU. For instance x86-64 have a 48bits for virtual address ie only
> 48bits of the address is meaning full, older radeon (<CI iirc) only have
> 40bits for the address bus. With such configuration you could not move all
> private kernel allocation inside the kernel zone.
> 
> Second issue is thing like 32bit process on 64bit kernel, in which case
> you have the usual 3GB userspace, 1GB kernel space split. So instead of
> using PAGE_OFFSET you might want to use TASK_SIZE which is a macro that
> will lookup the limit using the current (process struct pointer).
> 
> I think issue for nouveau is that kernel space already handle some
> allocation of virtual address, while for radeon the whole virtual address
> space is fully under the userspace control.
> 
> Given this, you might want to use trick on both side (kernel and user
> space). For instance you could mmap a region with PROT_NONE to reserve
> a range of virtual address from userspace, then tell the driver about
> that range and have the driver initialize the GPU and use that chunk
> for kernel private structure allocation.
> 
> Issue is that it is kind of a API violation for nouveau kernel driver.
> Thought i am not familiar enough, maybe you can do ioctl to nouveau
> before nouveau inialize and allocate the kernel private buffer (gr and
> other stuff). If so then problem solve i guess. Process that want to
> use CUDA will need to do the mmap dance and early ioctl.

I think we can have a nouveau ioctl to report the full address range that
the GPU supports.  Userspace can use this information to know what range
it can reserve.  The reservation part we can do with the original AS_ALLOC
and AS_FREE nouveau ioctls that I originally proposed, and in the CUDA case,
this reservation should happen before any channel for a particular context
gets created.
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2015-07-08 21:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07  0:42 CUDA fixed VA allocations and sparse mappings Andrew Chew
2015-07-07 15:29 ` [Nouveau] " Ilia Mirkin
     [not found]   ` <CAKb7UviePF2XcmyeKHQ2cv=hy=NZyYcMrWiTpajJxTFE+10LwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-07 17:27     ` Jerome Glisse
2015-07-09  9:26       ` [Nouveau] " Oded Gabbay
     [not found]         ` <CAFCwf11pEc7vq0aPxdCRypzcbuaJRgWb_55q4ZUQPAvw5zXzHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-10  0:31           ` Andrew Chew
2015-07-07 18:47     ` Andrew Chew
     [not found] ` <20150707004249.GC27924-hKyou4+EtHjTuHN6Nbh//0n48jw8i0AO@public.gmane.org>
2015-07-07 21:09   ` Ben Skeggs
     [not found]     ` <CACAvsv6=OwXnabpY5c_HHaMkumV-QqCvPd+zia15S_G+Oq29UA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-07 23:53       ` C Bergström
     [not found]         ` <CAOnawYpbqZ04-h2q4JpWjWfygPk5UQX9JWC4oj0RWNn7rzhcBA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-07 23:58           ` Ben Skeggs
     [not found]             ` <CACAvsv5ZrSLzb=N5kLpZP5fwbF+=S414O_QDgsNbi9FvvqxxLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-08  0:07               ` C Bergström
     [not found]                 ` <CAOnawYphTmUDxkKrEhUsVR6YRyLQj0P4hwgOkw2Jf4b0BZOSnw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-08  0:08                   ` Ilia Mirkin
     [not found]                     ` <CAKb7UviOx-rNJUkwYB4h8XyQ4x8qp3xAbeHOAeW++O+bHFuyKQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-08  0:11                       ` C Bergström
     [not found]                         ` <CAOnawYo=EFk6KhmudKWi3r-z_J4AHjswTrZSfyp_qZfdmQc=tw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-08  0:13                           ` Ilia Mirkin
     [not found]                             ` <CAKb7UvhOM+65x80HPAcdTsQB4KsPA780cKg8_30vOy5qWFZt4w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-08  0:15                               ` Andrew Chew
     [not found]                                 ` <20150708001559.GA30347-hKyou4+EtHjTuHN6Nbh//0n48jw8i0AO@public.gmane.org>
2015-07-08  0:18                                   ` Ben Skeggs
     [not found]                                     ` <CACAvsv5q5yJUmjPgJtxnv1dU--UzD1veePkJzvqjRyNtx=EEbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-08  0:31                                       ` Andrew Chew
     [not found]                                         ` <20150708003153.GA30426-hKyou4+EtHjTuHN6Nbh//0n48jw8i0AO@public.gmane.org>
2015-07-08  0:37                                           ` Ben Skeggs
     [not found]                                             ` <CACAvsv5DtA2WsBQkNWnxZMsonbHsvJ-oKA+frVd-btZXfgiAyw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-08  0:47                                               ` Andrew Chew
     [not found]                                                 ` <20150708004735.GA30570-hKyou4+EtHjTuHN6Nbh//0n48jw8i0AO@public.gmane.org>
2015-07-08  0:51                                                   ` Ben Skeggs
     [not found]                                                     ` <CACAvsv56doVLnMJKCfQyrPj-ijsW7yuAMv53kR0OKxJ0LKM5iQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-08 19:40                                                       ` Jerome Glisse
     [not found]                                                         ` <20150708194004.GA8122-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-07-08 21:18                                                           ` Andrew Chew [this message]
     [not found]                                                             ` <20150708211801.GA27080-hKyou4+EtHjTuHN6Nbh//0n48jw8i0AO@public.gmane.org>
2015-07-13 18:45                                                               ` Andrew Chew
2015-07-16  6:34                                                                 ` [Nouveau] " Alexandre Courbot
2015-07-08 18:27                                       ` Ken Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150708211801.GA27080@achew-linux64.nvidia.com \
    --to=achew-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.