From patchwork Thu Sep 17 00:29:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 53770 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 77E1C22A0D for ; Thu, 17 Sep 2015 00:29:38 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf1729313wic.1 for ; Wed, 16 Sep 2015 17:29:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=67VN/wGZTCHInx3GrZ6tOBHIzIGaVDzvBjJjlBUSjoQ=; b=MhaKhs+x2Om2lge1+PeJbD9/p+1sRg2L2Hx/5jWU8fj0vV1dPEsRCXM7KbkvyyGjJl U64V2g2jE4ycZ9FbkPvBNOrBosXgDBqcbSyvAY0aJrDrnk8wK9RbV5Ib9jrDQB+OxB84 MYj18xOirrQMs7vWH2Vx21j0IMIcdlnYcqDSwaL8oqPtUkbfa7diZCz86GwFc0Mar6ri XnfC4EKI6SQJ+QD1b5D+h2kyLcgFLRypxXuXwv84PMve8Icl5HglqoMYHQ27tTlfZt7r WFlqq6bC7n5G1bReWZvG4yxI79l3Ombpoo87GdNT4+MDmUGmGW+DkGgMmbbaK6ceCsWj 0/lQ== X-Gm-Message-State: ALoCoQm1aRbCt2zAHBpj/Ew9GVT57Z+mSolJdg9hyQVzDYK5zNTA37INHGo8mVmIQblCriYZcegc X-Received: by 10.180.87.199 with SMTP id ba7mr169896wib.5.1442449777816; Wed, 16 Sep 2015 17:29:37 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.228 with SMTP id b4ls12830lak.28.gmail; Wed, 16 Sep 2015 17:29:37 -0700 (PDT) X-Received: by 10.152.22.201 with SMTP id g9mr1673565laf.97.1442449777613; Wed, 16 Sep 2015 17:29:37 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id n3si377227lae.153.2015.09.16.17.29.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Sep 2015 17:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbcao8 with SMTP id ao8so1220063lbc.3 for ; Wed, 16 Sep 2015 17:29:37 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr32606385lbb.112.1442449777057; Wed, 16 Sep 2015 17:29:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2766343lbq; Wed, 16 Sep 2015 17:29:36 -0700 (PDT) X-Received: by 10.67.7.71 with SMTP id da7mr61194041pad.69.1442449776002; Wed, 16 Sep 2015 17:29:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id df2si982176pad.18.2015.09.16.17.29.35; Wed, 16 Sep 2015 17:29:35 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753201AbbIQA31 (ORCPT + 29 others); Wed, 16 Sep 2015 20:29:27 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:53413 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752640AbbIQA3Y (ORCPT ); Wed, 16 Sep 2015 20:29:24 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8H0TKmJ028032; Wed, 16 Sep 2015 19:29:20 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8H0TK1U023125; Wed, 16 Sep 2015 19:29:20 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Wed, 16 Sep 2015 19:29:21 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8H0TK1e020316; Wed, 16 Sep 2015 19:29:20 -0500 Received: from localhost (irmo.am.dhcp.ti.com [128.247.9.166]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id t8H0TK923786; Wed, 16 Sep 2015 19:29:20 -0500 (CDT) From: Suman Anna To: Ohad Ben-Cohen , "Michael S. Tsirkin" CC: , , Suman Anna Subject: [PATCH 2/2] remoteproc: fix memory leak of remoteproc ida cache layers Date: Wed, 16 Sep 2015 19:29:18 -0500 Message-ID: <1442449758-14594-3-git-send-email-s-anna@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442449758-14594-1-git-send-email-s-anna@ti.com> References: <1442449758-14594-1-git-send-email-s-anna@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: s-anna@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The remoteproc core uses a static ida named rproc_dev_index for assigning an automatic index number to a registered remoteproc. The ida core may allocate some internal idr cache layers and ida bitmap upon any ida allocation, and all these layers are truely freed only upon the ida destruction. The rproc_dev_index ida is not destroyed at present, leading to a memory leak when using the remoteproc core as a module and atleast one rproc device is registered and unregistered. Fix this by invoking ida_destroy() in the remoteproc core module exit. Cc: Ohad Ben-Cohen Signed-off-by: Suman Anna --- drivers/remoteproc/remoteproc_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 8b3130f22b42..9e03d158f411 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1478,6 +1478,8 @@ module_init(remoteproc_init); static void __exit remoteproc_exit(void) { + ida_destroy(&rproc_dev_index); + rproc_exit_debugfs(); } module_exit(remoteproc_exit);