From 40f951029595f422e6448fd2a62b080a49582639 Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 26 Jan 2022 04:18:05 +0000 Subject: [PATCH] implement might_alloc() using assertwaitok() --- sys/dev/pci/drm/i915/gt/intel_gtt.c | 4 +--- sys/dev/pci/drm/i915/i915_request.c | 3 +-- sys/dev/pci/drm/include/linux/sched/mm.h | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/sys/dev/pci/drm/i915/gt/intel_gtt.c b/sys/dev/pci/drm/i915/gt/intel_gtt.c index 260e7e13b2e..5ea9875b343 100644 --- a/sys/dev/pci/drm/i915/gt/intel_gtt.c +++ b/sys/dev/pci/drm/i915/gt/intel_gtt.c @@ -6,7 +6,7 @@ #include /* fault-inject.h is not standalone! */ #include -#include +#include #include "gem/i915_gem_lmem.h" #include "i915_trace.h" @@ -209,9 +209,7 @@ void i915_address_space_init(struct i915_address_space *vm, int subclass) * Add the annotation for this, we use trylock in shrinker. */ mutex_acquire(&vm->mutex.dep_map, 0, 0, _THIS_IP_); -#ifdef notyet might_alloc(GFP_KERNEL); -#endif mutex_release(&vm->mutex.dep_map, _THIS_IP_); } dma_resv_init(&vm->_resv); diff --git a/sys/dev/pci/drm/i915/i915_request.c b/sys/dev/pci/drm/i915/i915_request.c index 1a54c557cc3..0ea5f91b0f1 100644 --- a/sys/dev/pci/drm/i915/i915_request.c +++ b/sys/dev/pci/drm/i915/i915_request.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "gem/i915_gem_context.h" #include "gt/intel_breadcrumbs.h" @@ -919,9 +920,7 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp) u32 seqno; int ret; -#ifdef notyet might_alloc(gfp); -#endif /* Check that the caller provided an already pinned context */ __intel_context_pin(ce); diff --git a/sys/dev/pci/drm/include/linux/sched/mm.h b/sys/dev/pci/drm/include/linux/sched/mm.h index e69de29bb2d..4630781ff94 100644 --- a/sys/dev/pci/drm/include/linux/sched/mm.h +++ b/sys/dev/pci/drm/include/linux/sched/mm.h @@ -0,0 +1,17 @@ +/* Public domain. */ + +#ifndef _LINUX_SCHED_MM_H +#define _LINUX_SCHED_MM_H + +#include +#include +#include + +static inline void +might_alloc(const unsigned int flags) +{ + if (flags & M_WAITOK) + assertwaitok(); +} + +#endif -- 2.20.1