From patchwork Tue Jul 4 22:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 107032 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp58298qge; Tue, 4 Jul 2017 15:03:00 -0700 (PDT) X-Received: by 10.55.104.78 with SMTP id d75mr50966460qkc.147.1499205780035; Tue, 04 Jul 2017 15:03:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499205780; cv=none; d=google.com; s=arc-20160816; b=OtwkBSPGyvBvZia2EVs02EYCak4nxjPf3tc4E1+zSMoEHIyDMBjNgXoa6wUK8rZ59g 7Gk4cVVwxofHYlCpI1ZDoQRSkUPqccoT/dlL/cxwHuV5UVjMUSaOR1upJeHBc83tQ5uI ypRBYYrfAKHi6Zx/Kh7Vxd+Bnw4O9GwK4gMZ3Gvx6+wpHDtl0C3o4TZBdMwVtevfbY7m uZPBpmMI7nKcVotzoyLdQ0Dr8qj8PxTxzn988GA5oq1ViiAIHVxcXUpADe7o9qLqDtzt PY65vCnVrEOpE0X5+kNsyMF4kqu2Mk7CaToIn95iwJ3yVd5MzLt0T0F96VNvDwYsGXBd EXzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=8cbC8VcrVPDcgGL6hpT7FXLjxnlxnZF6dhNp7g/mUdE=; b=DsBvOLsCJ76iGbRZ9SdWvp33RVU43HedYX6eJpOMo86JPDBGL9oGf35sZfEWXY2TFf 2giO6YLuBhx0h/2pfd8Zkl+leu2n0c6X01SprGxP1NIBBQhMxj4mBBg6NeLGavroaHRA C0fZxgoTSIHDJdyu15SFK9ggcBqD68z4GmbEVYd3elPd6xGNNGfBagG1j3d4tr2JR6bJ PznnZ+4jBeXEW5hRP5sXs2eeU14nyiY52tagbEJwJh2WTQoqu2zG2lqpMNLaIjFPcO8a wuDv4Zae4F0tZocLGawZZwyMtqoFh0KK2fUx4Bdc2XKIzSnttf1GBYj59xCALtvqwSSq QVdA== ARC-Authentication-Results: i=1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w27si19526094qtc.83.2017.07.04.15.02.59; Tue, 04 Jul 2017 15:03: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=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 9C6E460C10; Tue, 4 Jul 2017 22:02: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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 D43206018A; Tue, 4 Jul 2017 22:00:34 +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 4623660C1A; Tue, 4 Jul 2017 22:00:25 +0000 (UTC) Received: from forward3j.cmail.yandex.net (forward3j.cmail.yandex.net [5.255.227.21]) by lists.linaro.org (Postfix) with ESMTPS id 3CDF26071D for ; Tue, 4 Jul 2017 22:00:17 +0000 (UTC) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b6:7]) by forward3j.cmail.yandex.net (Yandex) with ESMTP id BE98120BCE for ; Wed, 5 Jul 2017 01:00:15 +0300 (MSK) Received: from smtp2p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp2p.mail.yandex.net (Yandex) with ESMTP id 9DEF01A80054 for ; Wed, 5 Jul 2017 01:00:15 +0300 (MSK) Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id b3wfOILtJj-0EP4d3K2; Wed, 05 Jul 2017 01:00:15 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Suid-Status: 1 0 From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 5 Jul 2017 01:00:05 +0300 Message-Id: <1499205607-30786-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499205607-30786-1-git-send-email-odpbot@yandex.ru> References: <1499205607-30786-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 67 Subject: [lng-odp] [PATCH v1 5/7] shm: use shm in /dev/shm instead of /tmp 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" From: Maxim Uvarov /tmp might be mounted to tmpfs or not mounted. If it's disk then some writes are loss there. At least ipc test shows missing packets in shm ring on 4.10.0-rc8+ kernel. Which is more likely kernel bug. Signed-off-by: Maxim Uvarov --- /** Email created from pull request 67 (muvarov:master_ipc_fixes) ** https://github.com/Linaro/odp/pull/67 ** Patch: https://github.com/Linaro/odp/pull/67.patch ** Base sha: ceeab69f3af67701adb524c7b9757d19cefb1110 ** Merge commit sha: 6f88e14c89b861d66bb7043b22f9b299b1f73ddf **/ platform/linux-generic/_fdserver.c | 2 +- platform/linux-generic/_ishm.c | 18 ++++++++++-------- platform/linux-generic/odp_init.c | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/platform/linux-generic/_fdserver.c b/platform/linux-generic/_fdserver.c index 9aed7a9f..20d6e233 100644 --- a/platform/linux-generic/_fdserver.c +++ b/platform/linux-generic/_fdserver.c @@ -58,7 +58,7 @@ #include #define FDSERVER_SOCKPATH_MAXLEN 32 -#define FDSERVER_SOCKPATH_FORMAT "/tmp/odp-%d-fdserver" +#define FDSERVER_SOCKPATH_FORMAT "/dev/shm/odp-%d-fdserver" #define FDSERVER_BACKLOG 5 #ifndef MAP_ANONYMOUS diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c index c1efd7d2..c0623f18 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -92,12 +92,13 @@ * Linux underlying file name: /odp--ishm- * The part may be replaced by a sequence number if no specific * name is given at reserve time - * is either /tmp or the hugepagefs mount point for default size. + * is either /dev/shm or the hugepagefs mount point for default + * size. * (searched at init time) */ #define ISHM_FILENAME_MAXLEN (ISHM_NAME_MAXLEN + 64) #define ISHM_FILENAME_FORMAT "%s/odp-%d-ishm-%s" -#define ISHM_FILENAME_NORMAL_PAGE_DIR "/tmp" +#define ISHM_FILENAME_NORMAL_PAGE_DIR "/dev/shm" /* * when the memory is to be shared with an external entity (such as another @@ -105,7 +106,7 @@ * export file is created describing the exported memory: this defines the * location and the filename format of this description file */ -#define ISHM_EXPTNAME_FORMAT "/tmp/odp-%d-shm-%s" +#define ISHM_EXPTNAME_FORMAT "/dev/shm/odp-%d-shm-%s" /* * At worse case the virtual space gets so fragmented that there is @@ -117,7 +118,7 @@ /* * when a memory block is to be exported outside its ODP instance, - * an block 'attribute file' is created in /tmp/odp--shm-. + * an block 'attribute file' is created in /dev/shm/odp--shm-. * The information given in this file is according to the following: */ #define EXPORT_FILE_LINE1_FMT "ODP exported shm block info:" @@ -401,7 +402,7 @@ static void free_fragment(ishm_fragment_t *fragmnt) /* * Create file with size len. returns -1 on error - * Creates a file to /tmp/odp-- (for normal pages) + * Creates a file to /dev/shm/odp-- (for normal pages) * or /mnt/huge/odp-- (for huge pages) * Return the new file descriptor, or -1 on error. */ @@ -412,7 +413,8 @@ static int create_file(int block_index, huge_flag_t huge, uint64_t len, int fd; ishm_block_t *new_block; /* entry in the main block table */ char seq_string[ISHM_FILENAME_MAXLEN]; /* used to construct filename*/ - char filename[ISHM_FILENAME_MAXLEN];/* filename in /tmp/ or /mnt/huge */ + char filename[ISHM_FILENAME_MAXLEN]; /* filename in /dev/shm or + * /mnt/huge */ int oflag = O_RDWR | O_CREAT | O_TRUNC; /* flags for open */ FILE *export_file; @@ -530,7 +532,7 @@ static void *do_map(int block_index, uint64_t len, uint32_t align, new_block = &ishm_tbl->block[block_index]; /* - * Creates a file to /tmp/odp-- (for normal pages) + * Creates a file to /dev/shm/odp-- (for normal pages) * or /mnt/huge/odp-- (for huge pages) * unless a fd was already given */ @@ -761,7 +763,7 @@ static void procsync(void) * If ok, allocate a new shared memory block and map the * provided fd in it (if fd >=0 was given). * If no fd is provided, a shared memory file desc named - * /tmp/odp--ishm- is created and mapped. + * /dev/shm/odp--ishm- is created and mapped. * (the name is different for huge page file as they must be on hugepagefs) * The function returns the index of the newly created block in the * main block table (>=0) or -1 on error. diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 06c61435..b4abb181 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -19,7 +19,7 @@ #include #define _ODP_FILES_FMT "odp-%d-" -#define _ODP_TMPDIR "/tmp" +#define _ODP_TMPDIR "/dev/shm" struct odp_global_data_s odp_global_data;