Skip to content

Commit

Permalink
drm/amdkcl: test kthread_{use,unuse}_mm()
Browse files Browse the repository at this point in the history
introduced in commit f5678e7 ("kernel: better document the
use_mm/unuse_mm API contract")

Signed-off-by: Flora Cui <flora.cui@amd.com>
  • Loading branch information
Flora Cui authored and Kent Russell committed Oct 21, 2020
1 parent 38cd43f commit 6cf15df
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/dkms/m4/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ AC_DEFUN([AC_CONFIG_KERNEL], [
AC_AMDGPU_DRM_HDCP_UPDATE_CONTENT_PROTECTION
AC_AMDGPU_DOWN_READ_KILLABLE
AC_AMDGPU_DRM_DRIVER_RELEASE
AC_AMDGPU_KTHREAD_USE_MM
AC_KERNEL_WAIT
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
Expand Down
11 changes: 11 additions & 0 deletions drivers/gpu/drm/amd/dkms/m4/kthread_use_mm.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dnl #
dnl # f5678e7f2ac3 kernel: better document the use_mm/unuse_mm API contract
dnl # 9bf5b9eb232b kernel: move use_mm/unuse_mm to kthread.c
dnl #
AC_DEFUN([AC_AMDGPU_KTHREAD_USE_MM], [
AC_KERNEL_CHECK_SYMBOL_EXPORT([kthread_use_mm kthread_unuse_mm],
[kernel/kthread.c], [
AC_DEFINE(HAVE_KTHREAD_USE_MM, 1,
[kthread_{use,unuse}_mm() is available])
])
])
17 changes: 17 additions & 0 deletions include/kcl/kcl_kthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#include <linux/sched.h>
#include <linux/kthread.h>
#ifndef HAVE_KTHREAD_USE_MM
#include <linux/mmu_context.h>
#endif

#if !defined(HAVE___KTHREAD_SHOULD_PATK)
extern bool __kcl_kthread_should_park(struct task_struct *k);
Expand All @@ -15,4 +18,18 @@ extern void (*_kcl_kthread_unpark)(struct task_struct *k);
extern int (*_kcl_kthread_park)(struct task_struct *k);
extern bool (*_kcl_kthread_should_park)(void);
#endif

#ifndef HAVE_KTHREAD_USE_MM
static inline
void kthread_use_mm(struct mm_struct *mm)
{
use_mm(mm);
}
static inline
void kthread_unuse_mm(struct mm_struct *mm)
{
unuse_mm(mm);
}
#endif

#endif /* AMDKCL_KTHREAD_H */

0 comments on commit 6cf15df

Please sign in to comment.