From patchwork Thu May 21 15:32:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 48859 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 70A8721411 for ; Thu, 21 May 2015 15:34:25 +0000 (UTC) Received: by wivs14 with SMTP id s14sf4980027wiv.1 for ; Thu, 21 May 2015 08:34: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: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=KNI07yUEpDL7tWl7EQwtw8s659rqbd9nsjB8Crfjm14=; b=m7yA9IUZezEPYZqhLR2cRoaC3hxVVzWmUTheKB62ymL8HlDYPV8pigNbvMqgjYjcSJ roJjQFqT4xQzy00M48YFEiwOneLdRmuOGpsgRjprPctoRyqwIoMdFMP5rgbImXCCmeFq wcsXKeO71yZvXvA0DMZsYqRdKjfO0/UEDm24U3LIPa25bw0I8of437nZwTe8buboCJER gQViAsXwNZvPV4O2TDcK61C6Gv6kZFzrLRixZCBnuJuS/Shsi0R3G3IZN1mZQ2qGXYe3 1wG5P+bH8sBfALs6lU0h6rbnDOhFFdAaLxq/tOyz5MtU+QiceCPfxX2cnC2tDdfQDCZI 695Q== X-Gm-Message-State: ALoCoQkAkJN8o1MU9y0Dl3GoggtR9bdBufAdKHGesOUT45c2AKLslO5dWpKQEdYbEACCgiTYDNUw X-Received: by 10.180.10.136 with SMTP id i8mr3579019wib.7.1432222464423; Thu, 21 May 2015 08:34:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.81 with SMTP id v17ls413725laz.2.gmail; Thu, 21 May 2015 08:34:24 -0700 (PDT) X-Received: by 10.152.43.37 with SMTP id t5mr2713058lal.96.1432222464186; Thu, 21 May 2015 08:34:24 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id h1si13465193lam.172.2015.05.21.08.34.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 May 2015 08:34:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lagr1 with SMTP id r1so105363243lag.0 for ; Thu, 21 May 2015 08:34:24 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr2754999lbb.76.1432222464081; Thu, 21 May 2015 08:34:24 -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.108.230 with SMTP id hn6csp677596lbb; Thu, 21 May 2015 08:34:23 -0700 (PDT) X-Received: by 10.229.17.70 with SMTP id r6mr4752752qca.11.1432222462421; Thu, 21 May 2015 08:34:22 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 93si752841qkw.104.2015.05.21.08.34.20; Thu, 21 May 2015 08:34:22 -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 4EC1261D5A; Thu, 21 May 2015 15:34:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal 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 ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 040EC61CDF; Thu, 21 May 2015 15:33:01 +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 0840461D39; Thu, 21 May 2015 15:32:30 +0000 (UTC) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by lists.linaro.org (Postfix) with ESMTPS id 9559A61CDF for ; Thu, 21 May 2015 15:32:27 +0000 (UTC) Received: by lbbzk7 with SMTP id zk7so20929112lbb.0 for ; Thu, 21 May 2015 08:32:26 -0700 (PDT) X-Received: by 10.152.7.7 with SMTP id f7mr2802330laa.106.1432222346086; Thu, 21 May 2015 08:32:26 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-163-142.pppoe.mtu-net.ru. [91.76.163.142]) by mx.google.com with ESMTPSA id kb5sm5385410lbc.16.2015.05.21.08.32.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 May 2015 08:32:25 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 21 May 2015 18:32:10 +0300 Message-Id: <1432222332-21289-4-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432222332-21289-1-git-send-email-maxim.uvarov@linaro.org> References: <1432222332-21289-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv6 3/5] ipc: pool_create implement _ODP_SHM_NULL_LOCAL for linux-generic 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.215.44 as permitted sender) smtp.mail=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. Because of we can not modify API to add new parameter to odp_pool_param_t this pool should not be shared between different processes. To make that add special value to shm provided to pool saying that this pool should be in local memory only. Signed-off-by: Maxim Uvarov --- platform/linux-generic/include/odp/plat/shared_memory_types.h | 4 ++++ platform/linux-generic/odp_pool.c | 9 +++++++-- platform/linux-generic/odp_schedule.c | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/include/odp/plat/shared_memory_types.h b/platform/linux-generic/include/odp/plat/shared_memory_types.h index 4be7356..908bb2e 100644 --- a/platform/linux-generic/include/odp/plat/shared_memory_types.h +++ b/platform/linux-generic/include/odp/plat/shared_memory_types.h @@ -30,6 +30,10 @@ typedef ODP_HANDLE_T(odp_shm_t); #define ODP_SHM_INVALID _odp_cast_scalar(odp_shm_t, 0) #define ODP_SHM_NULL ODP_SHM_INVALID +/** NULL shared memory but do not create IPC object for it. + * Platfrom specific flag. + */ +#define _ODP_SHM_NULL_LOCAL _odp_cast_scalar(odp_shm_t, 0xffffffffULL - 1) /** Get printable format of odp_shm_t */ static inline uint64_t odp_shm_to_u64(odp_shm_t hdl) diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index cd2c449..b2f30dc 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -151,10 +151,14 @@ odp_pool_t odp_pool_create(const char *name, odp_pool_t pool_hdl = ODP_POOL_INVALID; pool_entry_t *pool; uint32_t i, headroom = 0, tailroom = 0; + uint32_t shm_flags = 0; if (params == NULL) return ODP_POOL_INVALID; + if (shm == ODP_SHM_NULL) + shm_flags = ODP_SHM_PROC; + /* Default size and align for timeouts */ if (params->type == ODP_POOL_TIMEOUT) { params->buf.size = 0; /* tmo.__res1 */ @@ -289,10 +293,11 @@ odp_pool_t odp_pool_create(const char *name, mdata_size + udata_size); - if (shm == ODP_SHM_NULL) { + if (shm == ODP_SHM_NULL || shm == _ODP_SHM_NULL_LOCAL) { shm = odp_shm_reserve(pool->s.name, pool->s.pool_size, - ODP_PAGE_SIZE, 0); + ODP_PAGE_SIZE, + shm_flags); if (shm == ODP_SHM_INVALID) { POOL_UNLOCK(&pool->s.lock); return ODP_POOL_INVALID; diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index a63f97a..07422bd 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -129,7 +129,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", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("odp_sched_pool", _ODP_SHM_NULL_LOCAL, ¶ms); if (pool == ODP_POOL_INVALID) { ODP_ERR("Schedule init: Pool create failed.\n");