From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0088.outbound.protection.outlook.com [104.47.36.88]) by dpdk.org (Postfix) with ESMTP id BD1962BC8 for ; Thu, 18 May 2017 09:34:40 +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=RQhL70UhUSjwriLqiciovYouBtlVUT3ZdbYLBzXn9GMlhvnxw5XMrZAHzmDh/1OXUl2Q/Nag04L4PUxd4Eo+BrkNuxSYltxJ4AQqXGFznbFLNnQ+IijEgKrUbB7C02ZfkAtaykdX01sI8vLRd3Xkg6E8FXvJ78R790nyJlquKVc= 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 SN1PR07MB2429.namprd07.prod.outlook.com (10.169.127.141) 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 07:34:39 +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 00:34:25 -0700 Message-Id: <20170518073426.14920-2-ashwin.sekhar@caviumnetworks.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170518073426.14920-1-ashwin.sekhar@caviumnetworks.com> References: <20170517181949.12002-1-ashwin.sekhar@caviumnetworks.com> <20170518073426.14920-1-ashwin.sekhar@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: MWHPR15CA0064.namprd15.prod.outlook.com (10.174.254.26) To SN1PR07MB2429.namprd07.prod.outlook.com (10.169.127.141) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f71c1e59-abe4-43fc-d76c-08d49dc057a9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:SN1PR07MB2429; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2429; 3:9+1B2lXs6qNZ3yg6+c3PZ6Kg42fXnhHox5XrEn9BywscNBDjWXmECY/k4e8zJQN63LwWDaRrQ5xsWAcedgVQfa257QR43YwF8yrceWu4VeDDwlxYgwPY8CCuS7H8YBxOG7vghsL4FTyXVSRmI0UJbjRa8PljBXNos8q9AnNzZYtkhvhxR6IZ5mDd69YOQs5754zxwYsmbdqMzfCl7IaITXN8HxeCeI/GJGbwtOCYSzeoyDYGJ+dv9V/UH1MKSnZu/s8oepkxjUNh3KgAzuEG2HcpnMJUdS+YwEoO+//TwybWhrC03a5LPKMsJ+jaYOZ3HzlY7xD5S1ltYlYOtxvm+A==; 25:TH7fku0d71fOfMkk+gxRnHwsq1gkcXKFVZ84SVNeMK18yaWxbslerNCrLx1NwLCDV+GYqcEzpJIqMO5ytKQyuL/UmpeXncBgjhoXvUsZ5lEGNzTQoqA+y5QwAhEES9tqpC5DZRVGPqWpcIYxrizyCfbrRrOE1AuO5cYsEY+c5SHWYus6tVBa2P3f/PdU8uFn8HnI/mdqRfWNxcOaJBxpcWVwkEcyRIWAHUsugFkbVvwVYkuTz70dTNFhlxVBEnu14ujoyRk7zF74nq0gcCDwzWz6uKu8bKUgIbZ9j4vkYtglNiVk2enC2qri0MlMIjLTzKbbPsYyx7yycdrBUGtyotP5iLi2wwhiSH7t1BMF2MrDO5NkgB46jCCbLOt8GLXxwpH0pOrB5Ds/VtSC9rs1YPyE7XZHJ/Ysw9p+ZjzSejscyd2MdfW7SKb36LsizyLoSNQdQMTiMCni17iprRko1pMiFsd6yX2DikZmrp5kWxw= X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2429; 31:3YoSJXw8v4/qYyMWHRV4mXK2yqBSVLS7HoErvAwzP/Y0MoJSP0elO4ohbiHS7Ov9HjfhfC6h5+J1eytetxDVypuvPmND7B10KT2DXev2WDOVKbaFGQEdbz42W0+4cGcGTX1+bdggCnuAO/yq0oToszmEhZg548rKdlb4IEPLhD1B/0YVbMHYg4BuQaeAQ819wLwk1uaG/WJycI1w4nDNNwpBv5rFWTVrBMuSm+4pI3A=; 20:AJrtWzABu7YWYI3+sTlADifDKn0qY3iwguud05qHRFy6xssSVw7pd7HHIlJaXg7OWHVQ6xkMq6QVK+h/GdW6XFEqL9Zg/DFOqO1LRtPocF7Jem63JZXuyE5Qb0i8oQeURl9XB1pY6UxQpYfAnWd9gY1HvYPCC31B8v4hkPuVo+iJS0uozUO3iupP1+iDuf5cBCLl8zAUtFRaWwYAJzRDyhLOixoWDQdNYSORm6llHvwGFdMSQmMoKZlb2trtDCp9fuERn3aWCVChUE8zkzSoBcrOJCM5fRPzz/+1zCVG400/M2FNQhyr5g7isVZ3fn6X9h7PPsC1mIYG+GmrpudVruXAp0zFkjrnncFvF2ySrfwQi+nZtQND5nfCpPkUbPCMEvUK56nFILVXZOiZenhO+eaC1cUvp5/F2+HQBzpvYIigDJ/VOVeBahqiMhZWlZGeIsH8IAhJZpzx5Hzc1LGNpv2URzAHzNXB77Vj+4APr8Vl/en32EsDNh27ZUWN72LmxusiAZ7gMxbeE3Jb+1mruoRbUZ9WFZoxDRifRDfoKAhZDjIj2PZDx7PsoAuuiyxMi6C+r5UqyGLOrcRZ7AriEn48TCIJh/+ovpXiyBJJmaI= 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)(10201501046)(93006095)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123555025)(20161123562025)(20161123564025)(6072148); SRVR:SN1PR07MB2429; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2429; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2429; 4:ZWjeIhdJY27dUEFURMqNlXMuCtmduS2mxl5wWHTaNvHgkaAmevTbLAyXUG/pS6pdFUf+VyMWFdvy6CmwaM9uANdLeHwKj2lJNWAMCFeL1RIH7VWxxakStSAuFFqA5cljck8qnKMh7Y9nIAhdOynvUj9JRbZgPMtdYjjlwXp2x89opgUH/OjG0qx1gSAJG/PF9dgnrfSirl0n/oRDOsIg/uDdIJI9DIJZcgc/c8NALGIng2zPo8oVK3HBcwkdpVPgCE/yJ+jV8ZhPcFAvueesojpxKbyk7wG7eq8Uhw+lQX9ccw88zYaaH13Anao8ab+3R9yRyjWersdaBeqWwTGealeR3hB/qJVyd4wNxeU6NKX30TYKEZKug2r5qr8nSHtl+844aQm8iQtcVmoNErW6FrvNjRTD75SYMrcqQtu9kN/gP4WzVmEWYuIui4MYHYgHX1p/2JL9IwjfIKSvQpGk13Zhs7rEMpCFQl776nRqDBbjep1UoweWUPJEhDrhR3G8zT9T0zazUneC1FDKfYHXLY0IJIePS9qLYCvmB4+0+ezYfWdg9IeBeo5cf3vjc7YS7QvGo1pnshqZNKM08V5ncvOYVn1YOWbRDt93VS0k2HvqrqnoCxDMJbSNq9Ht4AVIgRI9nz/Ai9BBFURCAh08oka8Q6bCxRmAJsfg/SL8Y/PEq9byEd4+TXFDPkHyifGivbk+kl5Bee6CFw/d52t7ONFYxnRzrDEtiMIjmtSk9D8TUrHWbmEuhr9hUSjFR3aV87dZ17RdOUYzxKIOdwgZIQ== X-Forefront-PRVS: 0311124FA9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39850400002)(39450400003)(39840400002)(39400400002)(39410400002)(53936002)(72206003)(33646002)(53416004)(42186005)(6486002)(5660300001)(305945005)(7736002)(50226002)(4326008)(5003940100001)(189998001)(478600001)(1076002)(6666003)(81166006)(36756003)(8676002)(66066001)(38730400002)(110136004)(2906002)(48376002)(6512007)(47776003)(42882006)(6506006)(2950100002)(3846002)(25786009)(6116002)(50986999)(76176999); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2429; H:1scrb-1.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2429; 23:cOxMVvkkqL6kCtrfmzInllDU4hU06k3Z2nNUsAcO9?= =?us-ascii?Q?bmoe+fVqxEePyQCRLzZbdnBPLC/oF7HSLeQV/IHHljqeAWRpUJ//TkzGxo8Q?= =?us-ascii?Q?Ya/FDEeZdKE82eIyQJR5nYWiTLlKXlDF7UgvKB4WXfNQosyojTuPZ2uvCguB?= =?us-ascii?Q?AAl31ZhY25mH2Sqct4B93S6diA9aaOpPb0kqfnnz14zm/aIIN7MEa5KR6V2C?= =?us-ascii?Q?PLVBAXE173AAmBt518n1NsFVfaUw8tg40dMgzGZPbLd5raQ5SiHeqbDaDCNm?= =?us-ascii?Q?IJD4PsBdP3zSTVdNhf2g4IkV1qJxVVKuoeyyCOAv4P4JeEuzqaf7TigKB0Es?= =?us-ascii?Q?9bYTHZhAWLMYeLnNTZC6JwdMEo80TxBdAqfBq2cRUBzSMSyU80DyDYmPvmLd?= =?us-ascii?Q?HW7AqnRFatZWGT/DPg4ftD8xcebvgc821iZUHmMjCtRew1V+sPhQXDAWWvzD?= =?us-ascii?Q?aMuIz9pXjNt6ghZtN4sQE/Fi5PHIUFhTVYuOC074p/1PqpoALMzslJcLxpW5?= =?us-ascii?Q?+RO4lM/5Nj9KWLjGNRcTfC7ca69MFS+uVHZantBlxIL6v0CQE+pJ00p4KCac?= =?us-ascii?Q?HVFYw4xo75t1bCtcg6/ph553I1A8hPHiK+lFDWbTRSRo1lzk7U3K3s5y6k/T?= =?us-ascii?Q?DPftuPd0g08jkGvLq2Qdv7Lb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cQ==; 5:kmeQoa0YT7jzrCy1jjBBuH+V2mK33WFEFmCJ+/OkO6SmTQdRHsGZrd8gdVA5GOff1hrVDN5etMddinmT92tWzWHS8LuW0G8IN30UJkC17VNV/M0ju2UpGl9yndjICXgTGPElezEefzlzstwR5jifjQ==; 24:iw8YrcBWTeWgOTMM16bXTjrynMtwKCb2WoOHTUQDWKacIpRDIMpdsKIY0QFMzhXUE4nzZpZQ9Hc+eAkrWOgpBpD5kJNbJJgSPUbB4kGnqaM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2429; 7:xSfrEDWm2Gla5p28AMsMA0JBtaD50aHzhHctzsgtK117onzuO0lsQ4oYeKK7PQpgapnocEdWteH7b0WMLmV0T6pVP2c/zG2NEJz/lmg2a6aAkxzg8uc9OmITRwF+1L+OADwf1YyDH9/QENmD3om5hgJaZnGoQefpHNswlp/tKU2AtCwQ0ifKJrtGT32DtgG8xNd3dA8CXpoy7T5/NyU+mNCbUJO7q2H3PcmUcGFsP7k9QQSks8i5Mo/rX5Jc/0R5hYxmQG6ExGADgcBIidI+afj5mUlkphl3fYr4+o2RoZHhFvhK69vOi6LaTkR0OTVWiQirklVxt6mgo6nVxEJE/Q== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2017 07:34:39.1238 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2429 Subject: [dpdk-dev] [PATCH v2 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 07:34:41 -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