From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no 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 55D03C11F68 for ; Fri, 2 Jul 2021 10:52:41 +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 084476141C for ; Fri, 2 Jul 2021 10:52:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 084476141C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 834D36E0F7; Fri, 2 Jul 2021 10:52:40 +0000 (UTC) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8B0CD6E0F7 for ; Fri, 2 Jul 2021 10:52:38 +0000 (UTC) Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 1E89D1F40752; Fri, 2 Jul 2021 11:52:37 +0100 (BST) Date: Fri, 2 Jul 2021 12:52:34 +0200 From: Boris Brezillon To: Steven Price Subject: Re: [PATCH v2 4/7] drm/panfrost: Add the ability to create submit queues Message-ID: <20210702125234.14ab19fb@collabora.com> In-Reply-To: <700919f1-a0d0-d8fb-e871-915b56260f83@arm.com> References: <20210701091224.3209803-1-boris.brezillon@collabora.com> <20210701091224.3209803-5-boris.brezillon@collabora.com> <700919f1-a0d0-d8fb-e871-915b56260f83@arm.com> Organization: Collabora X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Ekstrand , Tomeu Vizoso , dri-devel@lists.freedesktop.org, Rob Herring , Alyssa Rosenzweig , Robin Murphy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, 2 Jul 2021 11:08:58 +0100 Steven Price wrote: > On 01/07/2021 10:12, Boris Brezillon wrote: > > Needed to keep VkQueues isolated from each other. > > One more comment I noticed when I tried this out: > > [...] > > +struct panfrost_submitqueue * > > +panfrost_submitqueue_create(struct panfrost_file_priv *ctx, > > + enum panfrost_submitqueue_priority priority, > > + u32 flags) > > +{ > > + struct panfrost_submitqueue *queue; > > + enum drm_sched_priority sched_prio; > > + int ret, i; > > + > > + if (flags || priority >= PANFROST_SUBMITQUEUE_PRIORITY_COUNT) > > + return ERR_PTR(-EINVAL); > > + > > + queue = kzalloc(sizeof(*queue), GFP_KERNEL); > > + if (!queue) > > + return ERR_PTR(-ENOMEM); > > + > > + queue->pfdev = ctx->pfdev; > > + sched_prio = to_sched_prio(priority); > > + for (i = 0; i < NUM_JOB_SLOTS; i++) { > > + struct drm_gpu_scheduler *sched; > > + > > + sched = panfrost_job_get_sched(ctx->pfdev, i); > > + ret = drm_sched_entity_init(&queue->sched_entity[i], > > + sched_prio, &sched, 1, NULL); > > + if (ret) > > + break; > > + } > > + > > + if (ret) { > > + for (i--; i >= 0; i--) > > + drm_sched_entity_destroy(&queue->sched_entity[i]); > > + > > + return ERR_PTR(ret); > > + } > > + > > + kref_init(&queue->refcount); > > + idr_lock(&ctx->queues); > > + ret = idr_alloc(&ctx->queues, queue, 0, INT_MAX, GFP_KERNEL); > > This makes lockdep complain. idr_lock() is a spinlock and GFP_KERNEL can > sleep. So either we need to bring our own mutex here or not use GFP_KERNEL. > Ouch! I wonder why I don't see that (I have lockdep enabled, and the igt tests should have exercised this path). > Steve