From patchwork Fri Oct 28 15:16:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 79944 Delivered-To: patch@linaro.org Received: by 10.80.142.83 with SMTP id 19csp1239185edx; Fri, 28 Oct 2016 07:31:00 -0700 (PDT) X-Received: by 10.55.189.4 with SMTP id n4mr10899917qkf.209.1477665060352; Fri, 28 Oct 2016 07:31:00 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b14si8559296qkb.235.2016.10.28.07.31.00; Fri, 28 Oct 2016 07:31:00 -0700 (PDT) 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 EC22C60A26; Fri, 28 Oct 2016 14:30:59 +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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 8890B61F14; Fri, 28 Oct 2016 14:19:30 +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 A2DC961F0D; Fri, 28 Oct 2016 14:19:12 +0000 (UTC) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by lists.linaro.org (Postfix) with ESMTPS id 0F6A361EE1 for ; Fri, 28 Oct 2016 14:17:25 +0000 (UTC) Received: by mail-lf0-f44.google.com with SMTP id f134so52982891lfg.2 for ; Fri, 28 Oct 2016 07:17:24 -0700 (PDT) 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=4nu4NDNrFYmjh+q0x+5+PJx2NxIWZtLfBigThIibcDY=; b=Qpx6vA0phq68zCGBTevNQJKbF6rlWXMPqrWSv64aL0AQGoswi1PUIaHvOts5qSVIl1 1bmbOYHhQ+vkmfoLoOqb/kviWSxuukvAZoTQKDI2CeBtY1k5UxtYErC+IlSm2Q2ER2vE zwwf/XAxIeviEr2/ciHNbk73Cv127D+1yGV8ac8YsqK4XzOaKreV8o0hHA102qvtUDGo Q/QCf/xidXsJgzuiULGPXGFSxwXONPIqMwg32ehAR2DinXUItRIzK7jwfTLQFE76QxGK 9am/SofEr9mew+cDFCITjdZtznGcnDafN/LK+e2mFuGOhqghuvKjR7x1Sd1m7VVIcREZ AJ0Q== X-Gm-Message-State: ABUngvfBZ4yB4BXS23dlyveeSCZ/yplxd1vBpmCK9PpbS7G4CsXp3tuMTbzqnGV3wBVye7/PVc4= X-Received: by 10.25.168.70 with SMTP id r67mr82795lfe.8.1477664243837; Fri, 28 Oct 2016 07:17:23 -0700 (PDT) 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 92sm2102619lfu.6.2016.10.28.07.17.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Oct 2016 07:17:22 -0700 (PDT) From: Christophe Milard To: petri.savolainen@nokia.com, mike.holmes@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Fri, 28 Oct 2016 17:16:24 +0200 Message-Id: <1477667786-19330-12-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477667786-19330-1-git-send-email-christophe.milard@linaro.org> References: <1477667786-19330-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv5 11/13] 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 17b186f..0586a96 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();