Skip to content

Commit

Permalink
drm/amdkcl: fix kthread_use_mm/kthread_unuse_mm redefinition
Browse files Browse the repository at this point in the history
error on sle sp2 server distro with kernel 5.3.18-24

define the kthread_use_mm for kcl only when it is
neither defined in kthread.c nor in mmu_context.h

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
  • Loading branch information
Shiwu Zhang authored and Harish Kasiviswanathan committed Dec 28, 2020
1 parent b16c305 commit 9b141c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 16 additions & 4 deletions drivers/gpu/drm/amd/dkms/m4/kthread_use_mm.m4
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@ 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])
AC_KERNEL_DO_BACKGROUND([
dnl #
dnl # sle sp2 server distro inlines kthread_use_mm/kthread_unuse_mm
dnl # in mmu_context.h
dnl #
AC_KERNEL_TRY_COMPILE([
#include <linux/mm_types.h>
#include <linux/kthread.h>
#include <linux/mmu_context.h>
], [
kthread_use_mm(NULL);
kthread_unuse_mm(NULL);
], [
AC_DEFINE(HAVE_KTHREAD_USE_MM, 1,
[kthread_{use,unuse}_mm() is available])
])
])
])
2 changes: 0 additions & 2 deletions include/kcl/kcl_kthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

#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 Down

0 comments on commit 9b141c0

Please sign in to comment.