From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0052.outbound.protection.outlook.com [104.47.37.52]) by dpdk.org (Postfix) with ESMTP id 758F22C3F for ; Thu, 18 May 2017 12:23:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=44W0jw5+O6zr1tD3V3yZfl7zFso2rxoXe7E/PD9v4TU=; b=VoTSCpnFvWuu02bSy+KfG6J60TAJ0+r+Ed68RfLFgo/rcRRpiB60YdGiG/7Zxs7raTMQrNbs/oCXqY49/S64dyRHSKgRQMTNBp/u86DHoN/Ns+/v5xu0jktVooLZ1uNsXzBrEHTH2OanpFoNxdwdYrLvna4TsMxLRsGBndoG4PI= Authentication-Results: caviumnetworks.com; dkim=none (message not signed) header.d=none;caviumnetworks.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from 1scrb-1.caveonetworks.com (50.233.148.156) by BL2PR07MB2420.namprd07.prod.outlook.com (10.167.101.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Thu, 18 May 2017 10:23:22 +0000 From: Ashwin Sekhar T K To: jerin.jacob@caviumnetworks.com, john.mcnamara@intel.com, jianbo.liu@linaro.org Cc: dev@dpdk.org, Ashwin Sekhar T K Date: Thu, 18 May 2017 03:21:50 -0700 Message-Id: <20170518102151.35504-2-ashwin.sekhar@caviumnetworks.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170518102151.35504-1-ashwin.sekhar@caviumnetworks.com> References: <20170517181949.12002-1-ashwin.sekhar@caviumnetworks.com> <20170518102151.35504-1-ashwin.sekhar@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: BN6PR08CA0065.namprd08.prod.outlook.com (10.172.144.27) To BL2PR07MB2420.namprd07.prod.outlook.com (10.167.101.144) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a16fd1cb-dd6a-4776-880d-08d49dd7e98b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BL2PR07MB2420; X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2420; 3:ENorRFX3+Ug85uU5A4Q9CGAWwz9ZX8dtd3LogwV9DDcnUAcRLRIzDUXM+SucZtxSYOvgYDGlltBOu4118zQdEmFng8WG6n/ylfsjsad4Qgb7geQP2L3b+Tjb5z9rVn6HycGrTl3cdDQaIizxypfXTSG9qpJ5p4h4vGKIm3H60VgHGnMQdXtQc4ejSCMrWSf5j5V4rI9VABEx/Zm0KeWIgfrwvdYiP8RGHZOXqMS0zUPsmkiQYtJQ2vvHdtlucobiKrmKHhgiw+Jaid0t59TTmyw0vrbP3wF4TgvGX8skMIqZeXj3m2TzGrvHZntVlK/7DtDI6uPxkL2PCkMnLQHBJg==; 25:6Ow2QrcgamSsle7F672tzzRs1eg9YIoCoPaOtrz6ydodaLWyHHBqY9UgHygn+S6K15Un0MqTcVr1bwkGE87zEHZBUfyU1mYNpTPyF46xubY533qo128IJTI3orlgJqYjKC37Gq8GgvW0blp+a7GFbZpjMOPex322BJoverXz1ucx7AzdkpsVN8whJh/j8Ir75wfRBbsrRN0TqE3xflwDXgweRvx3FqZ7jXy+gmbMPmTfY6Sc25APf2qn1XD0XPybsi0NG3wpdhR7HRnwDcmR3CuXgQ6BcJjf3rOOzG/N4QrIFV7z8eyPaRd9L6j3bojIzJ98t/5XMMRGNT02Wj4UkdPMwicx4olMHR+vzdNLZ6IXaOR7KAEqTGWltbVy2lh09YGf1/IxQsE4LWXYAND4+m+t+Pk7lL+ZD7Ri2i0qn4gkZ4ht3RY22c333g1mZBBcSPS02vQXR7jEVU13RuIZnSxFTuMzGeu8xT2d1EsXr38= X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2420; 31:TtEnmWjgWJ4lbpNhfvQY8S+Th1wxHYkCMzpOpwRzj4ZXccihZZWvkKyBoYpeW8zbDYHwvQTFzshZJ3eLfHHLnAXwDfDTdjWG+PBWpwxaUYgx4MKaE9hyFxqN+vswmj86C8Tbb+4QrbwEqqt6SrRZau8CBKqvHmMbQX7ysQQ2nXJEsClAmtmTrF4UxgwbMSSSKxkKX9EcgAmmawMO0Q5i2d7gFHSEhOV5Doup42OrBIk=; 20:jo48Od13wAq64HWOK4giWIeAfC4Pcgm/7DD60WtWtcn1KpGUrgIIgTnVVrvsFg8IMH61mOuNyw8pUAiztX5nthIYo2Rld+quVuTkUyT0d1Li6ZaXH8/syKWQDcmJhIMHrfHbpfMIfKf5gE1eon5keotkX57vazr88cTuUlzkcVYMGoPSPWu7LbCYaFFg1J1ysFM9cFtwidQeu33r6wHdK6Ej9uO2whuAsn7p3xiEkGUOOH0KEcy0mSBbpupqCecNq7jVMPXj5VJEbh4kSKqbf4j79O9nOT/hLlam2JndqLFDOHRDdsk1GlH8lPFI9tKo9UgYaKGLGE6RjaGejVqlxQyWJmA9+xGcwpW95j2oT0kqGpH1wi36hteHaDdrqFXZfnlJZCxh1B+e054fplNiFvnTtD6biL9y+dhJc7uYdsH/+Wa2Q++RRTz60eqK85CGPQ+k3EeCAR6N4RijYCIw0dfVgGPqx3WOr8TvpI44CeTES0+sjvZkzrew2szKSkK+cLHgIFSV/c7FXnBPO9mi01JP1nTUaLK5ahLwS7/5m/m3DNUNbbGBkgShUefIwkvKzOuhaeTBLA5cHWC0PsQiwSUuwEYmqFJ3XHS/v2ewpQw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123560025)(20161123558100)(20161123555025)(6072148); SRVR:BL2PR07MB2420; BCL:0; PCL:0; RULEID:; SRVR:BL2PR07MB2420; X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2420; 4:D/ADhHFmaAnAP6raTgCOIL6lu7zASGEMsiqdYVyUFGgkfmd5hY3X22ctMYm9OUY/1jVcux8/jBqxqKYLvAf8/G5YwvsXof1qrwsW7Snk8dFZflwsxcIFR2z+Et1RPRz9qP5fgxIEy3+tO0L48p/S3Yh+kssTHIPOfnNOqyNhduSvd7+7TrFOGEoi7spf1rPJWdeahebJ2VpTXaKmGXKOYATXVaYEnfAk+ChwK8Gg0/AIfcmNRgmcFiNT+evvTjbs0xwJ2b6AcvansHntesmD0uIio3hNxUcDgvAGm6kTX4hNyqKYSfSEyKXn2iXN86I0x++OyP07RB5OAfUGYCW9Xfi8q1AvDCZm1LtMVNr6LQ5e0ZxlXRTCQG976exgqiRfV0bqXw5xKIYXWzk6JlxzhBayA9BPRNtZelTN4fuOXrdgk2fiuFLr3a4zgwc020oljSgOEuOfl++YO5R3yQvlifrSM36GaU4X7xfUpKl2liu+mPb9wUUXml1LzAgociPaYz/YqlytKilmYakRg1XLY/f8CuKlfNUqv6BpuKLpJhUBYeN3dIN9ZyyPHGdprvWgsNGSxJn20NRVRZgJbSo9jUeShO7jgdOed+g0sBEW47Qt1KuNN69hCJcSjHgDqQv2G9Z1QGHhRthLonDClkFpYMmcupF/irlOBocF5mhqSKyUTknYhNwPwoEKyVBXrlnwIzswopVRqTXcUZyb4ILw5dfeYy4dpsBYrU3hGlSNfqrAEU7Tk1I4h3lC1SuyIX+TCYkU99XjoyGKsTl7AoJy8A== X-Forefront-PRVS: 0311124FA9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39840400002)(39400400002)(39410400002)(39450400003)(39850400002)(81166006)(5660300001)(25786009)(110136004)(6116002)(4326008)(7736002)(66066001)(53416004)(189998001)(50986999)(76176999)(8676002)(3846002)(50226002)(72206003)(33646002)(53936002)(36756003)(6512007)(38730400002)(107886003)(478600001)(42186005)(6666003)(48376002)(1076002)(5003940100001)(6486002)(2950100002)(6506006)(50466002)(42882006); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR07MB2420; H:1scrb-1.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR07MB2420; 23:WLU1zCn1CgzdMx/ut/eke3LuSThuA/SyHurncBerc?= =?us-ascii?Q?YnHxKvELKYMQ++tnurIf9/PaC3KP1sVNyXuvUxvm6PBULDFClfdwdiIwzEMy?= =?us-ascii?Q?w+PIz5l3J8dkJ2pnEG8Ipq0qAYe+Zph6bSO50UvI7/5UbIEz9LAeX7SAgU61?= =?us-ascii?Q?BlO0udnOxfzOy+k36vvhMO3BIndX6SS8QqdsGYf5ayslbNYvEXDXdCZRDehJ?= =?us-ascii?Q?+CG8icHaQQjT6lR9RTKhvunJmtC8nhiyYgVPvmcQbZoVKiEM1qCaS7yYYljm?= =?us-ascii?Q?WwEtmpP9Mm42Q3q2XXGOvq81vEF1LU3j+cGRHNXzhHVlcCxV81ozFJsqUyy1?= =?us-ascii?Q?5O+OWpi4N6CBXmFdtrwAB/3KWNty0fttVgFVGe6wYIRnPb49d0W4fgQKhnNz?= =?us-ascii?Q?yZM8epPyy/kkkAeCChgg2jdnOZYr6co5SclPSUzuJq8jJFwuiyqggNn31swl?= =?us-ascii?Q?rKsv1VF68V1sI7v9fZ0T6RyHmN0WIf9bf6nFoQEimCsvdHbyPG74KsBx/nLO?= =?us-ascii?Q?kK7ZyGZsY+gTJK50bWYf7WWUAhvyj+7sBzmHcyD/JjHBTUEMPxFC/hqn49MN?= =?us-ascii?Q?vaaZTLrp24yj3gmQXicrfYJkfC3kkyxrnwGEMvPd/ZlGyPYjr8h/t53gV1Fz?= =?us-ascii?Q?gVF+dGajiv031ZM7n8p/kKCQ4PcG12CGmD/A7B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MP880JvfPLgMJZsbZ7NJ1ZRoI45ERTGkxk2TsC0kIa/1qiX6cAmd4owwfFEF4z6FnlU8vSktE7a2v8SOZK+2NkIn3SaveKR4tlwXa3Pg8E6e8Lg==; 24:9vnWAnIn/p9/k3A/njj/vHe7Ljp2dKpMZzgOquyey2r8u2kTqjdqZCL3U+Ymgb2rsTd3EwxrC5GM1cVGBcVQCoMzfyEL0TQsoVU789soHQ4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2420; 7:ihUVAKEZ6YW0bdOYJladm2G6wezmMAjlhg48mJc4dFukyCQK5vUebSn+9E22iY80zvapbq2Vq24jmjtXCYtj+j+6EkVwsfhP/oyD3MRJ1ZDOjRf0OQE//si02+u2Vqv6TXwi0tVybcgeOkCoBbvVbN5gBAZTPS4umi6n8jOOIKzHTt3es9QLKvcjdSHiPRZL+K3jdb9THo42hGQekBeYn+wSx1cXetqwZ3gCu23ryuWRTaN0/mL+MgWB/H02aAKZ1LaEFNKZFQA9o/N68frBJqUJT8Fsox8QEI5/HaHHB28tXoVHPf4Ycq05pi+KA1wWeTv/mHBCijEPi2BgRxjhwg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2017 10:23:22.2573 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR07MB2420 Subject: [dpdk-dev] [PATCH v3 1/2] examples/performance-thread: reorganise arch dependent code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 May 2017 10:23:25 -0000 Moved the architecture dependent stack set code to architecture specific directory. Signed-off-by: Ashwin Sekhar T K --- .../performance-thread/common/arch/x86/stack.h | 66 ++++++++++++++++++++++ examples/performance-thread/common/common.mk | 8 ++- examples/performance-thread/common/lthread.c | 11 +--- 3 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 examples/performance-thread/common/arch/x86/stack.h diff --git a/examples/performance-thread/common/arch/x86/stack.h b/examples/performance-thread/common/arch/x86/stack.h new file mode 100644 index 000000000..80c06bf1c --- /dev/null +++ b/examples/performance-thread/common/arch/x86/stack.h @@ -0,0 +1,66 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2015 Intel Corporation. All rights reserved. + * Copyright(c) Cavium networks Ltd. 2017. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#ifndef STACK_H +#define STACK_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "lthread_int.h" + +/* + * Sets up the initial stack for the lthread. + */ +static inline void +arch_set_stack(struct lthread *lt, void *func) +{ + char *stack_top = (char *)(lt->stack) + lt->stack_size; + void **s = (void **)stack_top; + + /* set initial context */ + s[-3] = NULL; + s[-2] = (void *)lt; + lt->ctx.rsp = (void *)(stack_top - (4 * sizeof(void *))); + lt->ctx.rbp = (void *)(stack_top - (3 * sizeof(void *))); + lt->ctx.rip = func; +} + +#ifdef __cplusplus +} +#endif + +#endif /* STACK_H_ */ diff --git a/examples/performance-thread/common/common.mk b/examples/performance-thread/common/common.mk index f6cab7718..532dbf61d 100644 --- a/examples/performance-thread/common/common.mk +++ b/examples/performance-thread/common/common.mk @@ -37,8 +37,12 @@ MKFILE_PATH=$(abspath $(dir $(lastword $(MAKEFILE_LIST)))) -VPATH := $(MKFILE_PATH) $(MKFILE_PATH)/arch/x86 +ifeq ($(CONFIG_RTE_ARCH_X86_64),y) +ARCH_PATH += $(MKFILE_PATH)/arch/x86 +endif + +VPATH := $(MKFILE_PATH) $(ARCH_PATH) SRCS-y += lthread.c lthread_sched.c lthread_cond.c lthread_tls.c lthread_mutex.c lthread_diag.c ctx.c -INCLUDES += -I$(MKFILE_PATH) -I$(MKFILE_PATH)/arch/x86/ +INCLUDES += -I$(MKFILE_PATH) -I$(ARCH_PATH) diff --git a/examples/performance-thread/common/lthread.c b/examples/performance-thread/common/lthread.c index 062275a43..7d76c8c46 100644 --- a/examples/performance-thread/common/lthread.c +++ b/examples/performance-thread/common/lthread.c @@ -76,6 +76,7 @@ #include #include +#include #include "lthread_api.h" #include "lthread.h" @@ -190,19 +191,11 @@ _lthread_init(struct lthread *lt, */ void _lthread_set_stack(struct lthread *lt, void *stack, size_t stack_size) { - char *stack_top = (char *)stack + stack_size; - void **s = (void **)stack_top; - /* set stack */ lt->stack = stack; lt->stack_size = stack_size; - /* set initial context */ - s[-3] = NULL; - s[-2] = (void *)lt; - lt->ctx.rsp = (void *)(stack_top - (4 * sizeof(void *))); - lt->ctx.rbp = (void *)(stack_top - (3 * sizeof(void *))); - lt->ctx.rip = (void *)_lthread_exec; + arch_set_stack(lt, _lthread_exec); } /* -- 2.12.2