cxl: Keep track of mm struct associated with a context
authorChristophe Lombard <clombard@linux.vnet.ibm.com>
Fri, 7 Apr 2017 14:11:55 +0000 (16:11 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 13 Apr 2017 13:34:29 +0000 (23:34 +1000)
commit6dd2d23403396d8e6d153a6c9db56e1a1012bad8
tree86df0a8e3a28e262731291aafd5e60f9ec74b3af
parent66ef20c7834b7df18168b12a57ef01c6ae0d1a81
cxl: Keep track of mm struct associated with a context

The mm_struct corresponding to the current task is acquired each time
an interrupt is raised. So to simplify the code, we only get the
mm_struct when attaching an AFU context to the process.
The mm_count reference is increased to ensure that the mm_struct can't
be freed. The mm_struct will be released when the context is detached.
A reference on mm_users is not kept to avoid a circular dependency if
the process mmaps its cxl mmio and forget to unmap before exiting.
The field glpid (pid of the group leader associated with the pid), of
the structure cxl_context, is removed because it's no longer useful.

Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
drivers/misc/cxl/api.c
drivers/misc/cxl/context.c
drivers/misc/cxl/cxl.h
drivers/misc/cxl/fault.c
drivers/misc/cxl/file.c
drivers/misc/cxl/main.c