Skip to content
Permalink
Browse files
dma-buf: Stop using SLAB_TYPESAFE_BY_RCU in selftests
The only real-world user of SLAB_TYPESAFE_BY_RCU was i915 and it doesn't
use that anymore so there's no need to be testing it in selftests.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Christian König <christian.koenig@amd.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
  • Loading branch information
jekstrand authored and intel-lab-lkp committed Jun 16, 2021
1 parent f155186 commit c889567ea79d1ce55ff8868bae789bbb3223503d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 42 deletions.
@@ -19,36 +19,27 @@

#define CHAIN_SZ (4 << 10)

static struct kmem_cache *slab_fences;

static inline struct mock_fence {
struct mock_fence {
struct dma_fence base;
spinlock_t lock;
} *to_mock_fence(struct dma_fence *f) {
return container_of(f, struct mock_fence, base);
}
};

static const char *mock_name(struct dma_fence *f)
{
return "mock";
}

static void mock_fence_release(struct dma_fence *f)
{
kmem_cache_free(slab_fences, to_mock_fence(f));
}

static const struct dma_fence_ops mock_ops = {
.get_driver_name = mock_name,
.get_timeline_name = mock_name,
.release = mock_fence_release,
.release = dma_fence_free,
};

static struct dma_fence *mock_fence(void)
{
struct mock_fence *f;

f = kmem_cache_alloc(slab_fences, GFP_KERNEL);
f = kmalloc(sizeof(*f), GFP_KERNEL);
if (!f)
return NULL;

@@ -701,14 +692,7 @@ int dma_fence_chain(void)
pr_info("sizeof(dma_fence_chain)=%zu\n",
sizeof(struct dma_fence_chain));

slab_fences = KMEM_CACHE(mock_fence,
SLAB_TYPESAFE_BY_RCU |
SLAB_HWCACHE_ALIGN);
if (!slab_fences)
return -ENOMEM;

ret = subtests(tests, NULL);

kmem_cache_destroy(slab_fences);
return ret;
}
@@ -14,25 +14,16 @@

#include "selftest.h"

static struct kmem_cache *slab_fences;

static struct mock_fence {
struct mock_fence {
struct dma_fence base;
struct spinlock lock;
} *to_mock_fence(struct dma_fence *f) {
return container_of(f, struct mock_fence, base);
}
};

static const char *mock_name(struct dma_fence *f)
{
return "mock";
}

static void mock_fence_release(struct dma_fence *f)
{
kmem_cache_free(slab_fences, to_mock_fence(f));
}

struct wait_cb {
struct dma_fence_cb cb;
struct task_struct *task;
@@ -77,14 +68,14 @@ static const struct dma_fence_ops mock_ops = {
.get_driver_name = mock_name,
.get_timeline_name = mock_name,
.wait = mock_wait,
.release = mock_fence_release,
.release = dma_fence_free,
};

static struct dma_fence *mock_fence(void)
{
struct mock_fence *f;

f = kmem_cache_alloc(slab_fences, GFP_KERNEL);
f = kmalloc(sizeof(*f), GFP_KERNEL);
if (!f)
return NULL;

@@ -463,7 +454,7 @@ static int thread_signal_callback(void *arg)

rcu_read_lock();
do {
f2 = dma_fence_get_rcu_safe(&t->fences[!t->id]);
f2 = dma_fence_get_rcu(t->fences[!t->id]);
} while (!f2 && !kthread_should_stop());
rcu_read_unlock();

@@ -563,15 +554,7 @@ int dma_fence(void)

pr_info("sizeof(dma_fence)=%zu\n", sizeof(struct dma_fence));

slab_fences = KMEM_CACHE(mock_fence,
SLAB_TYPESAFE_BY_RCU |
SLAB_HWCACHE_ALIGN);
if (!slab_fences)
return -ENOMEM;

ret = subtests(tests, NULL);

kmem_cache_destroy(slab_fences);

return ret;
}

0 comments on commit c889567

Please sign in to comment.