Skip to content

Commit 9b141c0

Browse files
amd-morriszhanghkasivis
authored andcommitted
drm/amdkcl: fix kthread_use_mm/kthread_unuse_mm redefinition
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>
1 parent b16c305 commit 9b141c0

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

drivers/gpu/drm/amd/dkms/m4/kthread_use_mm.m4

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,21 @@ dnl # f5678e7f2ac3 kernel: better document the use_mm/unuse_mm API contract
33
dnl # 9bf5b9eb232b kernel: move use_mm/unuse_mm to kthread.c
44
dnl #
55
AC_DEFUN([AC_AMDGPU_KTHREAD_USE_MM], [
6-
AC_KERNEL_CHECK_SYMBOL_EXPORT([kthread_use_mm kthread_unuse_mm],
7-
[kernel/kthread.c], [
8-
AC_DEFINE(HAVE_KTHREAD_USE_MM, 1,
9-
[kthread_{use,unuse}_mm() is available])
6+
AC_KERNEL_DO_BACKGROUND([
7+
dnl #
8+
dnl # sle sp2 server distro inlines kthread_use_mm/kthread_unuse_mm
9+
dnl # in mmu_context.h
10+
dnl #
11+
AC_KERNEL_TRY_COMPILE([
12+
#include <linux/mm_types.h>
13+
#include <linux/kthread.h>
14+
#include <linux/mmu_context.h>
15+
], [
16+
kthread_use_mm(NULL);
17+
kthread_unuse_mm(NULL);
18+
], [
19+
AC_DEFINE(HAVE_KTHREAD_USE_MM, 1,
20+
[kthread_{use,unuse}_mm() is available])
21+
])
1022
])
1123
])

include/kcl/kcl_kthread.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
#include <linux/sched.h>
66
#include <linux/kthread.h>
7-
#ifndef HAVE_KTHREAD_USE_MM
87
#include <linux/mmu_context.h>
9-
#endif
108

119
#if !defined(HAVE___KTHREAD_SHOULD_PATK)
1210
extern bool __kcl_kthread_should_park(struct task_struct *k);

0 commit comments

Comments
 (0)