[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191011081055.GA9052@infradead.org>
Date: Fri, 11 Oct 2019 01:10:55 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Omer Shpigelman <oshpigelman@...ana.ai>
Cc: Christoph Hellwig <hch@...radead.org>,
"oded.gabbay@...il.com" <oded.gabbay@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] habanalabs: support vmalloc memory mapping
On Thu, Oct 10, 2019 at 07:54:07PM +0000, Omer Shpigelman wrote:
> The is_vmalloc_addr checks are for user pointers and for memory which was allocated by the driver with vmalloc_user.
This does not make any sense whatsoever. vmalloc_user returns a kernel
address, it just does a GFP_USER instead of GFP_KERNEL allocation, which
is just accounting differences.
> > > Mapping vmalloc memory is needed for Gaudi ASIC.
> >
> > How does that ASIC pass in the vmalloc memory? I don't fully understand
> > the code, but it seems like the addresses are fed from ioctl, which means
> > they only come from userspace.
>
> The user pointers are indeed fed from ioctl for DMA purpose, but as I wrote above the vmalloc memory is allocated by the driver with vmalloc_user which will be mmapped later on in order to create a shared buffer between the driver and the userspace process.
Again, you can't pass pointers obtained from vmalloc* to userspace. You
can map the underlying pages into user pagetables, but is_vmalloc_addr
won't know that. I think you guys need to read up on virtual memory 101
first and then come back and actually explain what you are trying to do.
Powered by blists - more mailing lists