From patchwork Wed Jun 9 21:29:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 12311259 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D9F5C48BCD for ; Wed, 9 Jun 2021 21:30:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61952613EF for ; Wed, 9 Jun 2021 21:30:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61952613EF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jlekstrand.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 868576EB6F; Wed, 9 Jun 2021 21:30:14 +0000 (UTC) Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by gabe.freedesktop.org (Postfix) with ESMTPS id B6BC96EB6C for ; Wed, 9 Jun 2021 21:30:12 +0000 (UTC) Received: by mail-pl1-x634.google.com with SMTP id x10so13425617plg.3 for ; Wed, 09 Jun 2021 14:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jlekstrand-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JwH9BvcWQRM9Pbc0qvOae7i4EU7PPki/fj1kY1abKhQ=; b=vMpyc5vC6KwPg9tkOGnmFg5fdJ+apN1nFhKlt0jLKNoUzJgtYR3ETOK+7pQNTPMiQK BRSJuUPDHQHk9uXoPECKDNMMux5Ac4/gKzj6F8/aYwBlIvL9YyH+g4GOI2l3rM0q1/SQ U2/ztTlJ1iHqtceoEhB9BCq0LSoFmoQMq3PJScjso/0fOqbBUL5L6Ph8/4ahWk47w5MV 7y4BltVRQQ0AKXKmkWxSy3rnbnqkBbtzwH4DuB1cSawdwHxPptAM7EhbBOCp4irYZYYM n7ybadOCx+LDrhEiTyxaXDAY2Mcr1Ei7EtdmRcVHx4uaWQYqPesYXiby34YwJVg8N0Bn zQIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JwH9BvcWQRM9Pbc0qvOae7i4EU7PPki/fj1kY1abKhQ=; b=mXR0PnNx/sTNvRPsUXtpeNZSLZ6DJa8rgAMaXskddejxGGIeb+i8nsF4OheP6fmF/W O9nP2Y06W0u42fWexLe27G7qtYdKqG708LJyVHXHtUJma+q6Ox12fKN3mKnpNF0DNArO ziEHOS7N3H6/HhC9poT1uNTJj6F2Nl7HmSXF9kRHH+7tJTDBJqbzqRmW6ra1QNicQVSM 7l7JR1aAOkIy9AVZ/IHDpDQYtZuZXDudl5bJ1x1xA3g/u0Ey9EfBCU+j4CmdNH9wjbdy qvLET3ii5sLcfZs7ArqNcDt9TCnQ7EnwLlxLq96iGbnt2dBeZD3vsFxstTmIOkuBTkvq y13A== X-Gm-Message-State: AOAM532TF32AHSCqtJrxhvGLTe6gpiG75yomsmvaR7JKqWUBnpo4DA9g JuMHw5CSmoe/zOEDIRrNgNRrPw== X-Google-Smtp-Source: ABdhPJwGjhYeJkB8rrm1/R1AZmcp2jX5EPi12XfY9jYSLgOHeNj6siylXNjqy5X/GIpx8dGl3XK+vg== X-Received: by 2002:a17:90a:e506:: with SMTP id t6mr1604852pjy.59.1623274211998; Wed, 09 Jun 2021 14:30:11 -0700 (PDT) Received: from omlet.lan (jfdmzpr04-ext.jf.intel.com. [134.134.137.73]) by smtp.gmail.com with ESMTPSA id u14sm519133pjx.14.2021.06.09.14.30.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 14:30:11 -0700 (PDT) From: Jason Ekstrand To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Wed, 9 Jun 2021 16:29:58 -0500 Message-Id: <20210609212959.471209-5-jason@jlekstrand.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210609212959.471209-1-jason@jlekstrand.net> References: <20210609212959.471209-1-jason@jlekstrand.net> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 4/5] dma-buf: Stop using SLAB_TYPESAFE_BY_RCU in selftests X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , =?utf-8?q?Christian_K=C3=B6nig?= , Matthew Auld Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 Cc: Daniel Vetter Cc: Christian König Cc: Matthew Auld Cc: Maarten Lankhorst Reported-by: kernel test robot --- drivers/dma-buf/st-dma-fence-chain.c | 24 ++++-------------------- drivers/dma-buf/st-dma-fence.c | 27 +++++---------------------- 2 files changed, 9 insertions(+), 42 deletions(-) diff --git a/drivers/dma-buf/st-dma-fence-chain.c b/drivers/dma-buf/st-dma-fence-chain.c index 9525f7f561194..73010184559fe 100644 --- a/drivers/dma-buf/st-dma-fence-chain.c +++ b/drivers/dma-buf/st-dma-fence-chain.c @@ -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; } diff --git a/drivers/dma-buf/st-dma-fence.c b/drivers/dma-buf/st-dma-fence.c index c8a12d7ad71ab..ca98cb0b9525b 100644 --- a/drivers/dma-buf/st-dma-fence.c +++ b/drivers/dma-buf/st-dma-fence.c @@ -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; }