From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by dpdk.org (Postfix) with ESMTP id EC4BA591A for ; Thu, 27 Aug 2015 11:05:43 +0200 (CEST) Received: by wicgk12 with SMTP id gk12so2366741wic.1 for ; Thu, 27 Aug 2015 02:05:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=WjqdRnsuxY76tQRGe6XdRYDzRctehWUTRepwhkQYQhU=; b=hg0mnO0g65G6ASb/jEoYDhmD8DUZOZ+ise9jkF71MeNQN9CB772bLfdoLhmxt0gglW TI3Ao06dVPLwYfeFcQiOjSf96jXI2yrPey1F3TsCm2I/mkfeOPw4Md0aT5O4E1fezREH niGRSGJ6pTPhJepZYBCEfz+RE7DjcSXePB4gBB9CLxmzogTzO4Ccdja6Eu96XHVD1ySW 3gl6acHdekJfUllWu0P9feiZLZ9Oa4Cdol1816FPxYr8S0W77DB0jHZ3R63YSIzV1EQL sRs3zofIHMVMF9ZqSYBa9lKZjM01IsblOF47VTmJ8bNz3uaSiysuBgEKff+yCFEa1N19 RnMA== X-Gm-Message-State: ALoCoQl4qaQcHTy2gjRRCoUUrYlGQEoB35MaezPw7zCVcyQtOKJ0Bl5mEYnjvXMwXJidV+RIybwe X-Received: by 10.194.93.198 with SMTP id cw6mr3573035wjb.113.1440666343698; Thu, 27 Aug 2015 02:05:43 -0700 (PDT) Received: from xps13.localnet (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id p5sm11550092wiy.17.2015.08.27.02.05.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Aug 2015 02:05:43 -0700 (PDT) From: Thomas Monjalon To: Jerin Jacob Date: Thu, 27 Aug 2015 11:04:32 +0200 Message-ID: <1740827.rQGZo3YydZ@xps13> Organization: 6WIND User-Agent: KMail/4.14.8 (Linux/4.0.4-2-ARCH; KDE/4.14.8; x86_64; ; ) In-Reply-To: <20150827040839.GA5223@localhost.localdomain> References: <1439901605-31164-1-git-send-email-jerin.jacob@caviumnetworks.com> <1759749.jiktJN44xV@xps13> <20150827040839.GA5223@localhost.localdomain> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 3/3] app/test: enable test_red to build on non x86 platform X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2015 09:05:44 -0000 2015-08-27 09:38, Jerin Jacob: > On Tue, Aug 25, 2015 at 02:03:13PM +0200, Thomas Monjalon wrote: > > 2015-08-18 18:10, Jerin Jacob: > > > --- a/app/test/test_red.c > > > +++ b/app/test/test_red.c > > > +#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_X32) > > > #ifdef __PIC__ > > > asm volatile ( > > > "mov %%ebx, %%edi\n" > > > @@ -155,6 +156,7 @@ static inline void rdtsc_prof_start(struct rdtsc_prof *p) > > > #else > > > asm( "cpuid" : : : "%eax", "%ebx", "%ecx", "%edx" ); > > > #endif > > > +#endif > > > p->clk_start = rte_rdtsc(); > > > > The right fix would be to move that arch-specific code into an EAL abstraction. > > I agree. I thought the same. But I am not able to understand why 'cpuid' > instruction used here without any input/output parameters. What is the > role of 'cpuid' instruction in this specific function and what to > abstract in eal ? It is explained here: http://dpdk.org/ml/archives/dev/2014-January/001182.html I think it can be replaced by rte_rdtsc_precise() which was implemented after the above discussion. It uses rte_mb instead of cpuid. As explained in the following thread, memory fence can be used instead of cpuid: http://stackoverflow.com/a/12634857 As showed in the following threads, rdtscp can also be used: http://stackoverflow.com/a/27697754 http://dpdk.org/ml/archives/dev/2015-April/016770.html It reminds me that we should deprecate rte_rdtsc() and rte_get_tsc_cycles() in favor of a more generic name, e.g. rte_get_clock_cycles().