Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2370116pxb; Mon, 20 Sep 2021 20:25:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhUD/5RM2Hjv7XH0+SodPbbHoHWsMtQkrG2TuYcRcS/YeOekJM/h5DjyW1aksr9IAQAXds X-Received: by 2002:a17:906:130a:: with SMTP id w10mr33356039ejb.87.1632194720203; Mon, 20 Sep 2021 20:25:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632194720; cv=none; d=google.com; s=arc-20160816; b=OCjBoxwRLv52/VzpTDLrBrnoNfvlv5T8YXHyodIn8K8uK0tgeVzE+0sTk2DxHETm7t v8Vhvd9ThJBHck16f3JBwEUgM9FpR7vvZbRi+1qXzwQryzXBO//+CIFJpIBrFo4lJ0EJ Z9yDJH3j/Bb531oX7vZcMXiRzO+DW3SX2mOEJjnf0Vll2KmHnYDpli2VojnZ0iZQSy+n R4Oxz7jJzwgZ/cD2rap5PlvqHjiJNndtrvjoLVZgTQ+5lu4Dp8ww/8xDgsHDDjcGr9Lo eQ/XdHgi87Xr7p/mLRrhUmh6huX7PvKRi1WPOnpZNNWaXvhl+GWuddPACJt5KTh7+Ypj Q5gQ== 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=BsAGqxLSnE8yXfERZVD0xDSsZYBxJhcYCjDh6TgsnPM=; b=jCbyFY7HIBWuJM8c5uMdtdCIWDNkm97DmRqy/e6SBsYBZXGyhNxO3mGsLJe/eq/mRD C7ko6NQcKmc4VILNHvKPhGj2FWc5oDss7/DPkiXcZK7tE+h12GSqOuruyKc8RLFIa/p4 1oTiyXQULlgbDVx/1hsJlidWY3cpTbCAGe0RH0WSPkXi4EngLHGBXTR2oZYVcEaA9/fM sklDIoBug2cEuLz9Se5ZIuZwZP2JYZG0ViY1okg0GehNWnrHR1SUNnKEkGdLm6rapIHL 9zrYti6lzbRI20L8pdUzLTG8LJ2jWZMseetVIMFNpQhESNEQkf5JzCwbvUN22jbAqmlL 0drw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KukjIhqt; 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 y11si13952616edj.69.2021.09.20.20.24.56; Mon, 20 Sep 2021 20:25: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=KukjIhqt; 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 S1346025AbhITSXn (ORCPT + 99 others); Mon, 20 Sep 2021 14:23:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:40564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376931AbhITSQX (ORCPT ); Mon, 20 Sep 2021 14:16:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6EDB163286; Mon, 20 Sep 2021 17:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158531; bh=SIzIuA0C55AjIVlCGH0zvIEwF0km2CkcEQVGwNITLyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KukjIhqtEHwkHGEaN4ZEVKtLAs4YWqOWA9nAVCNEe6zxezgfO3CB9JsROyke1dP/a aM3wzMdwoWthwKFsovQmuqxxISTNgg9BimkNn+Db0Xf92bMEe5i5IiXGobnFsZwqtY 19KeBPQ4JBydAtJtEfCewi+KpX/iPy6i/tLCfep4= 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.4 200/260] drm/etnaviv: put submit prev MMU context when it exists Date: Mon, 20 Sep 2021 18:43:38 +0200 Message-Id: <20210920163937.906726519@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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 @@ -1310,6 +1310,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); }