From patchwork Thu Nov 24 16:22:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 83942 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp225381obn; Thu, 24 Nov 2016 07:40:02 -0800 (PST) X-Received: by 10.55.221.29 with SMTP id n29mr3021576qki.114.1480002002744; Thu, 24 Nov 2016 07:40:02 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id o36si15412730qtb.21.2016.11.24.07.40.02; Thu, 24 Nov 2016 07:40:02 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 59B0C62DDF; Thu, 24 Nov 2016 15:40:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id D0CE562E09; Thu, 24 Nov 2016 15:26:42 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BB9D062DA6; Thu, 24 Nov 2016 15:26:12 +0000 (UTC) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by lists.linaro.org (Postfix) with ESMTPS id 858AC62DDB for ; Thu, 24 Nov 2016 15:23:10 +0000 (UTC) Received: by mail-lf0-f49.google.com with SMTP id b14so31143406lfg.2 for ; Thu, 24 Nov 2016 07:23:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H74iFCZaMz3FHjdZ70kUHV0U3XZaN3nk3xyRIfFnSlI=; b=ERAw8b9slKOiQ6khvWOvyvB3q7gMOVltbA+f/EV7cEreJ2tzEwbQUlfbUpKjHwTuij EptAmQJeKqOX94iW04Y9Szi+1c8pV+kmxgVqcbiaqLk0fsHL7FdNQ7Eko83K140szaMk f3HahhzJPixQVB3ZUgy6V2eFrjda9CXnWWkOQqaEiY9aZZ0O0fx/9qRbijuaCq6do+pv MvOlndRv6MHydosC9bgIuP7ami3vp69EY2KhzIuAppZYhC1BeunUj3D3qBdftiH/QGSV fy4G09Kv3qndN5Je3P3EhR4L3fIWfk/S0oDDqIYeM/yN8jveEJkuABka0MHE/D3Tpy0w FvOA== X-Gm-Message-State: AKaTC01H6xoVR0z1sPBO3kCaiflbDIXD2tn9mF+HYm4wLkgESo+yRqdVEp26ZWGclPu2JNdCSFk= X-Received: by 10.25.215.199 with SMTP id q68mr1068989lfi.47.1480000989347; Thu, 24 Nov 2016 07:23:09 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id x142sm8215976lfa.32.2016.11.24.07.23.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 Nov 2016 07:23:08 -0800 (PST) From: Christophe Milard To: maxim.uvarov@linaro.com, mike.holmes@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Thu, 24 Nov 2016 17:22:31 +0100 Message-Id: <1480004553-46760-14-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480004553-46760-1-git-send-email-christophe.milard@linaro.org> References: <1480004553-46760-1-git-send-email-christophe.milard@linaro.org> Subject: [lng-odp] [API-NEXT PATCHv9 13/15] linux-gen: _ishm: cleaning remaining block at odp_term_global X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Remaining (forgotten, not freed) blocks are gathered and related files cleaned when odp_term_global() is called. An error message is also issued so the application writters get to know about these blocks Signed-off-by: Christophe Milard --- platform/linux-generic/_ishm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.7.4 diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c index 7c373dc..b00f8f1 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -1505,12 +1505,25 @@ int _odp_ishm_term_local(void) int _odp_ishm_term_global(void) { int ret = 0; + int index; + ishm_block_t *block; if ((getpid() != odp_global_data.main_pid) || (syscall(SYS_gettid) != getpid())) ODP_ERR("odp_term_global() must be performed by the main " "ODP process!\n."); + /* cleanup possibly non freed memory (and complain a bit): */ + for (index = 0; index < ISHM_MAX_NB_BLOCKS; index++) { + block = &ishm_tbl->block[index]; + if (block->len != 0) { + ODP_ERR("block '%s' (file %s) was never freed " + "(cleaning up...).\n", + block->name, block->filename); + delete_file(block); + } + } + /* perform the last thread terminate which was postponed: */ ret = do_odp_ishm_term_local();