Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2352289pxb; Mon, 20 Sep 2021 19:49:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlrHiNn5P4EtNO5lS4ARdFeQLEfjdkIO0BtLEZzQp3nYP4Pd3FdHVd8GGlXkfSqtkliYyj X-Received: by 2002:a17:906:4346:: with SMTP id z6mr32423837ejm.403.1632192560204; Mon, 20 Sep 2021 19:49:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192560; cv=none; d=google.com; s=arc-20160816; b=ddsdAt7ODZLu0eC/SZ8N21dVlN1j4adzZH40VzGdRvsFugtjcq4ebHkrLUE+4jQ9c8 +fHVemhICWJgF0TIWLkVcOOx8SrQxkGo9fv6iOjln86ALtVUxXixc7fI6WM7bdVWfhw0 BJVFdNYi/2VytSe1nEz3kb/HYwx0LqeWkpd8ZSMyCGn6xwKJ3nurxrV0FbUTfdXApmdK yl0G14Px5lzG/08+375dCRCT+h7q8f/ZSZmluat22J2w3XFB1FoRnHEvPb6pn3DcwAxe E7SnqNKTpP2mxH3RosfZkFoYMRbS3icHiR82j9MPM7ZGbyQqaijTCixasB2ws+xkL3mP I1uQ== 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=XI22o/zaUDq4/dfDqT//Y4b55WsQX0k5fjoxj+ru7ZU=; b=kRSvwgoNiUkMxnRPbAMh9YyCBK8xkfoB2yAJbAnEd/Z6266xod4qyLc/U/BD5vzwoF AW/3dxpTxtopZCdTmkRzPoTZFH6dhBMdnk5v3EQnukk/N+6YRj58tpZ0WnZ6WpmI+Iwa Nf4ZLE9Ff6UxumtRXtqjR5U88BHQq2ru+q26eAufEFnA0XyMzuIF+8ETJ+hJYepoz6+V BsbRJhPPc8g2kMELdKncNwDZv6FdVaJgyGZrRq01DkL3s+fFDUUrmiuQ90z3McuCzKNn s5PuTPfLUVC66u0K0GTQJ4Cf3Ilea4ACHkAPBF5YMBBFVmmHRO80GzoMTSIb+AHynC3A VAZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lEsTUIw3; 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 n18si7845633eda.528.2021.09.20.19.48.56; Mon, 20 Sep 2021 19:49:20 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lEsTUIw3; 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 S1348197AbhITSav (ORCPT + 99 others); Mon, 20 Sep 2021 14:30:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:44432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378271AbhITSYV (ORCPT ); Mon, 20 Sep 2021 14:24:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 766CC632B7; Mon, 20 Sep 2021 17:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158688; bh=vE2INCWV22/gVkyOdYeFrysmkn7Bb/vdTSS76qfAwEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lEsTUIw3jzCn/PuPn4xc3SeCbl3ode9U2hxQdFsdkJc5KumKnrRoliVL9BcQ5EkZC n80slcwJ8vFUL2sYhkSEIc3ZRvur6hIzGhtzC7TwY/V9uJWiTV3Xnlo4VAZfL4/093 lzn43/RAAyKkS1Ud5PtI1woAV3FWApnI9+vmEjVg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Michael Walle , Marek Vasut , Christian Gmeiner Subject: [PATCH 5.10 011/122] drm/etnaviv: put submit prev MMU context when it exists Date: Mon, 20 Sep 2021 18:43:03 +0200 Message-Id: <20210920163916.140266469@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@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: Lucas Stach commit cda7532916f7bc860b36a1806cb8352e6f63dacb upstream. The prev context is the MMU context at the time of the job queueing in hardware. As a job might be queued multiple times due to recovery after a GPU hang, we need to make sure to put the stale prev MMU context from a prior queuing, to avoid the reference and thus the MMU context leaking. Cc: stable@vger.kernel.org # 5.4 Signed-off-by: Lucas Stach Tested-by: Michael Walle Tested-by: Marek Vasut Reviewed-by: Christian Gmeiner Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -1356,6 +1356,8 @@ struct dma_fence *etnaviv_gpu_submit(str gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context); etnaviv_gpu_start_fe_idleloop(gpu); } else { + if (submit->prev_mmu_context) + etnaviv_iommu_context_put(submit->prev_mmu_context); submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context); }