Re: [PATCH 1/2] habanalabs: support vmalloc memory mapping

From: Christoph Hellwig
Date: Thu Oct 10 2019 - 10:09:53 EST


On Thu, Oct 10, 2019 at 02:06:22PM +0000, Omer Shpigelman wrote:
> This patch adds support in mapping of vmalloc memory.
> In contrary to user memory, vmalloc memory is already pinned and has no
> vm_area structure. Therefore a new capability was needed in order to map
> this memory.

Unless I am missing something you mix user and kernel pointers in
your is_vmalloc_addr checks. That will break on those architectures
that have separate kernel and user address spaces.

> 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.