Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp18456pxb; Fri, 15 Jan 2021 04:49:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5g1O4ktVcP/q0MxewHXv7uxRu+C8Rf7cYUDZUCfZVXf0BfCoVJVR6K3xT/BOI/yslsBJ6 X-Received: by 2002:a17:906:ca08:: with SMTP id jt8mr8252815ejb.368.1610714989585; Fri, 15 Jan 2021 04:49:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610714989; cv=none; d=google.com; s=arc-20160816; b=PS43YK/YCsjAWgrAl+L4hHratSGOtzZAjtPyiK7G3VSPfWlrvVqIDS7wZFsN9ZGueA O7XbnbP+na1JFFCxHKzO2zJaNpB0Q/FI0euT2d5DR3DttsBwKZcqpqgo8zjzQzvJJn2M zBUILEBR4efJ/YyAh1NG618DBbYx3l76/RwrPcDNKEszgm/WAEI32749/0ku5fiYyWby CTLxTuYB77vwNBVHu+csM98uJG3wQOeQRzmyn9+/+ioiHiEdbhdf327OlPID+Rx1Tygm oU7pngb0w9ARa0FyWoUrY11jaXC0Vh274anXYQfw2Rk+VOtVvpIZpBNiC09QiPYAvWhi cWIQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KOHJoi17+ciuUzfdpwzySi9eeRN0t9nRrNgFzrmaVcc=; b=kTVnGMFBiQwiHMFHyKCbJlvwCxk7agVY1TFYu0J0qA2ajPbIjxPSwUCCN4y4nxXtNW JhlYWSu7P/btzVtY6GnofAi7UC+NV4BpotoKmj14JpT2UTMtnxkgrzeF0MFEo78Tadzn qvHV5xomQJMkQ6qbzzE+NT7bIQK7vO/UpZlVr7DS/dWvRQnVey5QRbRkwaeqrupKP7DZ AGfOIU3kV6lQXB5xRaxRDqQlP7PPu/i7Hu74x6jn59typouGBgXdTvwVz0J4Zy1Zjokf hEhsYWUB7znLBE+ex41Y9D0RbaB11idNyv5HAuyKy9te6/bosqjqst86LQutTMXhq5PG 2xnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KsvRO9cp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de8si4005445edb.319.2021.01.15.04.49.26; Fri, 15 Jan 2021 04:49:49 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KsvRO9cp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388022AbhAOMhi (ORCPT + 99 others); Fri, 15 Jan 2021 07:37:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:44784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387997AbhAOMhb (ORCPT ); Fri, 15 Jan 2021 07:37:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F410522473; Fri, 15 Jan 2021 12:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714211; bh=zFgr4LD4Ax9y75P2OZd4JJTP0ouxnGyFBHYxHhyn9v8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KsvRO9cpD1Qoi/UozCyxXAIiN5DD2BuduJv6vnrJh5qA7jo7zrWFv7ARhpq+MrsfJ hZqmPwy40Ivk6Pfq78zGj9tOfWdoLZ3+ccHkljla00UgSC/cpjjk10ElsnETCB6jfn fftMD0FLNEF+Ymn6LUvvoy9eWeeJ8c/OtYH7p4Vs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steven Price , Boris Brezillon , Sasha Levin Subject: [PATCH 5.10 007/103] drm/panfrost: Dont corrupt the queue mutex on open/close Date: Fri, 15 Jan 2021 13:27:00 +0100 Message-Id: <20210115122006.408206973@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115122006.047132306@linuxfoundation.org> References: <20210115122006.047132306@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steven Price [ Upstream commit a17d609e3e216c406f7c0cec2a94086a4401ac06 ] 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. Fixes: 1a11a88cfd9a ("drm/panfrost: Fix job timeout handling") Signed-off-by: Steven Price Reviewed-by: Boris Brezillon Signed-off-by: Boris Brezillon Link: https://patchwork.freedesktop.org/patch/msgid/20201029170047.30564-1-steven.price@arm.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/panfrost/panfrost_job.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c index 1ce2001106e56..517dfb247a801 100644 --- a/drivers/gpu/drm/panfrost/panfrost_job.c +++ b/drivers/gpu/drm/panfrost/panfrost_job.c @@ -617,6 +617,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, @@ -647,8 +649,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); + } } @@ -660,7 +664,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, @@ -677,10 +680,8 @@ void panfrost_job_close(struct panfrost_file_priv *panfrost_priv) struct panfrost_job_slot *js = pfdev->js; int i; - for (i = 0; i < NUM_JOB_SLOTS; i++) { + for (i = 0; i < NUM_JOB_SLOTS; i++) drm_sched_entity_destroy(&panfrost_priv->sched_entity[i]); - mutex_destroy(&js->queue[i].lock); - } } int panfrost_job_is_idle(struct panfrost_device *pfdev) -- 2.27.0