Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1114405pxx; Fri, 30 Oct 2020 02:22:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI3nPf8adn8dOGpNo4bpcFd8Di99WCMtfFyyTDVDRgykcAiOFLsbpnNwvq7Z0dMShfCy7S X-Received: by 2002:aa7:d38d:: with SMTP id x13mr1245792edq.355.1604049722499; Fri, 30 Oct 2020 02:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604049722; cv=none; d=google.com; s=arc-20160816; b=pMleVNwae0x0sghA3EzYBSQPuK5Bypoeh+QsFTbHn7eww488kFIIe+Peu0CXwGXjOe Sj7CZECliQy6Je2YbYyLc5/VBeTCn/J+MTpblnnem1KJBtbXUPsYElRa7eqgodFUvrqb Iteq9FAFTTmRQreEQ5dt9oYLzao4Quh3kD28d7LzakqtoTg6VA6ji8UJ4wIDMM+ItYhA ybr+2pLaue6Ipbcb7mmBLhPahnD/7qwZxTfi7XoFFpk0oszL4fXFwWBZ6RH/5R1n1BYm Gx8yPCBQLd1jZA0hrG+aFtfeEQA+nPvWg1gxWkcvBkhOmHIO4dax3hDep86s+eWnD9Tm /2dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=LnS4hx+1FHlae5ZfMNqhiTR5JFtorAfjMY40y9ARJwU=; b=xGrtD1DBHe7GVnz0LnpE+0PtaIiOUKFUUaBPa4g2aVV1yFCyebe1jrwUl/9wHiSQwq NGxsR4EJnJUo17GRyC3WEOIrvjAHR9nu+Z4gh+vBvzTD2N+bB/eqGB2kulL2zcsJX6Ii 32VI/vMWtJiAVkM3bw9tM7PJ4U2Y6qkAzq+Ifu5mrL4Ja/UljiOyZkPklTE+Oaz155DZ +FaYThW6TZIYwIWh60Ei0JatMO0ioBRpInNeVkBVedDvkoUhQpcYo8b7i+s+RAHfLnTP tamEXVRuYLC4RRO+JJL/bRa6bxgPlzTgfouvq3yqYSYBjf8qXSOl17ecvx64hUN/d3cd D2FQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 33si1162574edq.238.2020.10.30.02.21.39; Fri, 30 Oct 2020 02:22:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726294AbgJ3JS4 (ORCPT + 99 others); Fri, 30 Oct 2020 05:18:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbgJ3JS4 (ORCPT ); Fri, 30 Oct 2020 05:18:56 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50000C0613D7 for ; Fri, 30 Oct 2020 02:18:56 -0700 (PDT) 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 EE04D1F45AB3; Fri, 30 Oct 2020 09:18:53 +0000 (GMT) Date: Fri, 30 Oct 2020 10:18:50 +0100 From: Boris Brezillon To: Steven Price Cc: Daniel Vetter , David Airlie , Rob Herring , Tomeu Vizoso , Alyssa Rosenzweig , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/panfrost: Don't corrupt the queue mutex on open/close Message-ID: <20201030101850.3932c61b@collabora.com> In-Reply-To: <20201029170047.30564-1-steven.price@arm.com> References: <20201029170047.30564-1-steven.price@arm.com> Organization: Collabora X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Oct 2020 17:00:47 +0000 Steven Price wrote: > The mutex within the panfrost_queue_state should have the lifetime of > the queue, however it was erroneously initialised/destroyed during > panfrost_job_{open,close} which is called every time a client > opens/closes the drm node. > > Move the initialisation/destruction to panfrost_job_{init,fini} where it > belongs. > Queued to drm-misc-next. Thanks, Boris > Fixes: 1a11a88cfd9a ("drm/panfrost: Fix job timeout handling") > Signed-off-by: Steven Price > Reviewed-by: Boris Brezillon > --- > drivers/gpu/drm/panfrost/panfrost_job.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c > index cfb431624eea..145ad37eda6a 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_job.c > +++ b/drivers/gpu/drm/panfrost/panfrost_job.c > @@ -595,6 +595,8 @@ int panfrost_job_init(struct panfrost_device *pfdev) > } > > for (j = 0; j < NUM_JOB_SLOTS; j++) { > + mutex_init(&js->queue[j].lock); > + > js->queue[j].fence_context = dma_fence_context_alloc(1); > > ret = drm_sched_init(&js->queue[j].sched, > @@ -625,8 +627,10 @@ void panfrost_job_fini(struct panfrost_device *pfdev) > > job_write(pfdev, JOB_INT_MASK, 0); > > - for (j = 0; j < NUM_JOB_SLOTS; j++) > + for (j = 0; j < NUM_JOB_SLOTS; j++) { > drm_sched_fini(&js->queue[j].sched); > + mutex_destroy(&js->queue[j].lock); > + } > > } > > @@ -638,7 +642,6 @@ int panfrost_job_open(struct panfrost_file_priv *panfrost_priv) > int ret, i; > > for (i = 0; i < NUM_JOB_SLOTS; i++) { > - mutex_init(&js->queue[i].lock); > sched = &js->queue[i].sched; > ret = drm_sched_entity_init(&panfrost_priv->sched_entity[i], > DRM_SCHED_PRIORITY_NORMAL, &sched, > @@ -657,7 +660,6 @@ void panfrost_job_close(struct panfrost_file_priv *panfrost_priv) > > for (i = 0; i < NUM_JOB_SLOTS; i++) { > drm_sched_entity_destroy(&panfrost_priv->sched_entity[i]); > - mutex_destroy(&js->queue[i].lock); > /* Ensure any timeouts relating to this client have completed */ > flush_delayed_work(&js->queue[i].sched.work_tdr); > }