Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1017171ybe; Wed, 4 Sep 2019 11:11:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/KTt3+EFNVlcOUxYf7vJS3SiLaQPCnIRPDsIVdoe2GH2Lz1M1veD0uJaT2gDfuAJbxSV2 X-Received: by 2002:aa7:96f3:: with SMTP id i19mr32008222pfq.32.1567620716931; Wed, 04 Sep 2019 11:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620716; cv=none; d=google.com; s=arc-20160816; b=B1+bZ5MwmnNQOiC7xpR37dNpjWZK6L85OYzmL4rmmTtrBSQHHm1owIpKKncYV2lN4y fFIHllBAfREppHLg+FkP/nZTVo8ladcQSj/fCfMTJdt6DnxgluXZ9ZNsQh9roiKlL3Vj 57FLfZMW8hMFH0WQKxmo4yHg303cdbirAdNgIEvZzh3nxSEPsnE6YQrLr+5loCe0hWKO y7NgEp2gKH7tsaWIMA8e8LOkyvBD+uqxjZZu7gBPSSTKMPzk+58Jck2gG7dIvtpaE6x2 mLT+hOsdFxl1K6he6+g2hiZcqz5DKRnTKULLjihFUD8FAeniET37Xhh+mPWIu8+d5fXO O5vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MQjPz8RVUIbbtLg3hTNzbMrv68zHSWQqBxilBQIjk5M=; b=ne4Y3qns3/tLWRBWf1QrOi8kz+hWbadF5m52q/PZMEvM44PrTwW5a8MRb+IXCwtfXB pFQaN2i6q1+Ha0yLweykhcl9EiDFJzZ0AUyovHWw7w/KXHxqfcaPqdLTBq9hcl10Zglj tu6urxv8cikx9Ry6EhBkCIM0Fa0jD6GAEQcq7uYUhULhqb4UmzOVSQqG+AH4i5k2xYh4 lvUDfRoGIJcIub1owWGjv33yDFbcvE1BMQRQEc+ky59N4XlIDJRKyPRasr+ur4wGBkG4 4Nf45TcAdZ0G/n+4oBpvBTZz714wCgW9c6DYGC7LKPlvqAgMu5TlgiX2nfxjD+OjcueA A90A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dtDKsixV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m100si45973pjb.83.2019.09.04.11.11.41; Wed, 04 Sep 2019 11:11:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dtDKsixV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389700AbfIDSKK (ORCPT + 99 others); Wed, 4 Sep 2019 14:10:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:53576 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389303AbfIDSKH (ORCPT ); Wed, 4 Sep 2019 14:10:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2E615206B8; Wed, 4 Sep 2019 18:10:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620606; bh=k9djja5ly5uwE2OFtHOxsuV0pvkx9VzB3lHm8awq8tY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dtDKsixV09BwaTW0FTgShtMyHOA8OunyFnCTU1d9jzhnmVz3ov+9RXEsjbTQlNdkl hVY+BXxAbgZ8d6UYV+WGIOmLoloVQO7kh8TgidsRXADbLyCEam+MvmILG/D6LPwKTT xLD709nR7Y+HEHbMZwAIG36WsS1bKBzqVOStQgUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomer Tayar , Oded Gabbay , Sasha Levin Subject: [PATCH 5.2 028/143] habanalabs: fix DRAM usage accounting on context tear down Date: Wed, 4 Sep 2019 19:52:51 +0200 Message-Id: <20190904175315.161061753@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit c8113756ba27298d6e95403c087dc5881b419a99 ] The patch fix the DRAM usage accounting by adding a missing update of the DRAM memory consumption, when a context is being torn down without an organized release of the allocated memory. Signed-off-by: Tomer Tayar Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin --- drivers/misc/habanalabs/memory.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/habanalabs/memory.c b/drivers/misc/habanalabs/memory.c index 693877e37fd87..924a438ba9736 100644 --- a/drivers/misc/habanalabs/memory.c +++ b/drivers/misc/habanalabs/memory.c @@ -1629,6 +1629,8 @@ void hl_vm_ctx_fini(struct hl_ctx *ctx) dev_dbg(hdev->dev, "page list 0x%p of asid %d is still alive\n", phys_pg_list, ctx->asid); + atomic64_sub(phys_pg_list->total_size, + &hdev->dram_used_mem); free_phys_pg_pack(hdev, phys_pg_list); idr_remove(&vm->phys_pg_pack_handles, i); } -- 2.20.1