[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFCwf130JhgqZq3tPkehorxJVve9cbQc7p--MGvKxB5JOzw7DA@mail.gmail.com>
Date: Fri, 11 Oct 2019 12:27:53 +0300
From: Oded Gabbay <oded.gabbay@...il.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Omer Shpigelman <oshpigelman@...ana.ai>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] habanalabs: support vmalloc memory mapping
On Fri, Oct 11, 2019 at 12:26 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> On Fri, Oct 11, 2019 at 12:19:36PM +0300, Oded Gabbay wrote:
> > We first allocate, using vmalloc_user, a certain memory block that
> > will be used by the ASIC and the user (ASIC is producer, user is
> > consumer).
> > After we use vmalloc_user, we map the *kernel* pointer we got from the
> > vmalloc_user() to the ASIC MMU. We reuse our driver's generic code
> > path to map host memory to ASIC MMU and that's why we need the patch
> > above. The user does NOT send us the pointer. He doesn't have this
> > pointer. It is internal to the kernel driver. To do this reuse, we
> > added a call to the is_vmalloc_addr(), so the function will know if it
> > is called to work on user pointers, or on vmalloc *kernel* pointers.
>
> But the function can't decided that. As I said before you can't just
> take a value that possibly contains user pointers and call
> is_vmalloc_addr on it, as kernel and user address can overlap on
> various architectures.
>
> You need to restructure your code to keep the kernel and user pointer
> code paths entirely separate.
ah, ok. I didn't know that.
Now I understand your point.
We will do that, thanks for the review and help.
Oded
Powered by blists - more mailing lists