From patchwork Fri Oct 9 11:58:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 54692 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 5907422DB6 for ; Fri, 9 Oct 2015 12:00:48 +0000 (UTC) Received: by wicgi15 with SMTP id gi15sf20289887wic.2 for ; Fri, 09 Oct 2015 05:00:47 -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:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=W+ZVKTryDFCyYbz6ocLQzxVI4norulOol9tCURpKtGc=; b=M2S3rlPzuWKOcGYb5DL5HamZh9vlBktRjCuAcTV/+T0pC1SR4eWhSki3Z2EvNTFne8 l7nPY0NgH0+z1mtryfNpNp6qNHU/vSxnjYNsJLhOpUwlypYE9Ika+rz7zugBVQhdpOrC dN+vtrm7aPy4oHrRUHrIPISWKhGgaWGI0lveRI+RBjcaf/Oo5FxnbT4v9eHSN/fZ1Kxl Rnm4CdOV24p6MYGMm7iBKJiCtyPTWhVUDa3wYsObtgy8IJET6jmD7Y+XU8xGy9cjTIAv 09LlDlAu/dKaWjQC/TZwba6y6hTPtB/EUE9HbgtOxqSjkXdQeUU3UfiTC818aS1S9Pzr qZBQ== X-Gm-Message-State: ALoCoQnzAG2KY8koPCEOSZLZshYNcCKbtj+TdXaKCV4S5Mp3FXEy2Ah6YkoVZ1XGgV37x+SaoN3F X-Received: by 10.112.55.69 with SMTP id q5mr2511457lbp.24.1444392047548; Fri, 09 Oct 2015 05:00:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.79.85 with SMTP id d82ls266192lfb.47.gmail; Fri, 09 Oct 2015 05:00:47 -0700 (PDT) X-Received: by 10.112.14.9 with SMTP id l9mr6355023lbc.91.1444392047405; Fri, 09 Oct 2015 05:00:47 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id k1si927725lbd.96.2015.10.09.05.00.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Oct 2015 05:00:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbcao8 with SMTP id ao8so78816070lbc.3 for ; Fri, 09 Oct 2015 05:00:47 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr6291833lbb.112.1444392047270; Fri, 09 Oct 2015 05:00:47 -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 w3csp1157003lbq; Fri, 9 Oct 2015 05:00:46 -0700 (PDT) X-Received: by 10.50.138.72 with SMTP id qo8mr10177431igb.46.1444392046231; Fri, 09 Oct 2015 05:00:46 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c2si2218825igt.74.2015.10.09.05.00.44; Fri, 09 Oct 2015 05:00:45 -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; Received: by lists.linaro.org (Postfix, from userid 109) id AAB6961AF3; Fri, 9 Oct 2015 12:00:44 +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, URIBL_BLOCKED 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 25A3661A4C; Fri, 9 Oct 2015 11:59:15 +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 C4A4F61A09; Fri, 9 Oct 2015 11:59:08 +0000 (UTC) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by lists.linaro.org (Postfix) with ESMTPS id C8A2F6180D for ; Fri, 9 Oct 2015 11:59:06 +0000 (UTC) Received: by lbcao8 with SMTP id ao8so78769325lbc.3 for ; Fri, 09 Oct 2015 04:59:05 -0700 (PDT) X-Received: by 10.25.25.76 with SMTP id 73mr4180181lfz.91.1444391945716; Fri, 09 Oct 2015 04:59:05 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-161-180.pppoe.mtu-net.ru. [91.76.161.180]) by smtp.gmail.com with ESMTPSA id v19sm235052lfd.7.2015.10.09.04.59.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Oct 2015 04:59:05 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 9 Oct 2015 14:58:58 +0300 Message-Id: <1444391944-20772-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444391944-20772-1-git-send-email-maxim.uvarov@linaro.org> References: <1444391944-20772-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv9 2/8] linux-generic: create internal pool create function with shm flags X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org 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.177 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 On init odp creates odp_sched_pool. We can not modify API to add new parameter to odp_pool_param_t and this pool should not be shared between different processes. To do that implemented internal linux-generic function with parameters to created shm. Note: create shm before and then provide it to the pool does not work because shm argument likely will be dropped from odp_pool_create() (patch already posted.). Signed-off-by: Maxim Uvarov --- platform/linux-generic/include/odp_pool_internal.h | 4 ++++ platform/linux-generic/odp_pool.c | 11 +++++++++-- platform/linux-generic/odp_schedule.c | 3 +-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h index 136db2c..6781703 100644 --- a/platform/linux-generic/include/odp_pool_internal.h +++ b/platform/linux-generic/include/odp_pool_internal.h @@ -347,6 +347,10 @@ static inline uint32_t odp_buffer_pool_tailroom(odp_pool_t pool) return odp_pool_to_entry(pool)->s.tailroom; } +odp_pool_t _pool_create(const char *name, + odp_pool_param_t *params, + uint32_t shmflags); + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 30d4b2b..2036c2a 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -144,7 +144,9 @@ int odp_pool_term_local(void) * Pool creation */ -odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params) +odp_pool_t _pool_create(const char *name, + odp_pool_param_t *params, + uint32_t shmflags) { odp_pool_t pool_hdl = ODP_POOL_INVALID; pool_entry_t *pool; @@ -290,7 +292,7 @@ odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params) shm = odp_shm_reserve(pool->s.name, pool->s.pool_size, - ODP_PAGE_SIZE, 0); + ODP_PAGE_SIZE, shmflags); if (shm == ODP_SHM_INVALID) { POOL_UNLOCK(&pool->s.lock); return ODP_POOL_INVALID; @@ -403,6 +405,11 @@ odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params) return pool_hdl; } +odp_pool_t odp_pool_create(const char *name, + odp_pool_param_t *params) +{ + return _pool_create(name, params, ODP_SHM_PROC); +} odp_pool_t odp_pool_lookup(const char *name) { diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 827fcf0..c66c177 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -140,8 +140,7 @@ int odp_schedule_init_global(void) params.buf.num = NUM_SCHED_CMD; params.type = ODP_POOL_BUFFER; - pool = odp_pool_create("odp_sched_pool", ¶ms); - + pool = _pool_create("odp_sched_pool", ¶ms, 0); if (pool == ODP_POOL_INVALID) { ODP_ERR("Schedule init: Pool create failed.\n"); return -1;