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 1F6D511A2 for ; Thu, 19 Mar 2015 09:10:44 +0100 (CET) Received: by wifj2 with SMTP id j2so61589073wif.1 for ; Thu, 19 Mar 2015 01:10:44 -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=ECyS0b2Cv5CY/i5oGMZPuhHDONqlPyjhI3VzEolQhGE=; b=gwBlLzHT/25ju9NwNXjEsvTtVCYUuvOBXKa95kU9vZA4d3fJ7NOme0d8wpfP7LmYAA OaY20DVUXc67jNXl+q4Gou7rHz0oYpAdfwTC+qAOm1qSNc6O5m2/MzLFj4mQhz0lvbLN R1qiAYDJnx+GZJu70tMKqt19JOwluv24x52H/zJ8Wv8RaQR2feuSlYTp8yt5XwOnPog5 e8uDFLBX2Lt98vEpmc+ph54vJRh9D4wdKn0Oll63aVpG4JvGX48NkGrHTFRwixEqSc71 Yl0uPotlQa/NqEEx71AvKY5ZDXjyyLKFjdQoStC1aXNr5svGGXNDMgj1vhhQ5lcz0w/M LfOA== X-Gm-Message-State: ALoCoQliPRVm/S0neJYsk6JTSrumye4ZY3nY6dqaE8+8lxvcWhpkGamCSmuk3en8fueZqZlZ3Edz X-Received: by 10.180.23.99 with SMTP id l3mr13770714wif.36.1426752644023; Thu, 19 Mar 2015 01:10:44 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id gt4sm1370084wib.21.2015.03.19.01.10.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 01:10:43 -0700 (PDT) From: Thomas Monjalon To: "Qiu, Michael" Date: Thu, 19 Mar 2015 09:10:06 +0100 Message-ID: <2427100.51HZplg4KW@xps13> Organization: 6WIND User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; ) In-Reply-To: <533710CFB86FA344BFBF2D6802E60286D1603B@SHSMSX101.ccr.corp.intel.com> References: <1425561339-13300-2-git-send-email-michael.qiu@intel.com> <9442704.dXlXz1iyK3@xps13> <533710CFB86FA344BFBF2D6802E60286D1603B@SHSMSX101.ccr.corp.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 1/3 v2] librte_hash: Fix unsupported instruction `crc32' in i686 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, 19 Mar 2015 08:10:44 -0000 2015-03-19 02:00, Qiu, Michael: > On 3/8/2015 2:39 AM, Thomas Monjalon wrote: > > 2015-03-06 01:39, Qiu, Michael: > >> On 3/6/2015 1:11 AM, Thomas Monjalon wrote: > >>> 2015-03-06 00:55, Michael Qiu: > >>>> CC rte_hash.o > >>>> Error: unsupported instruction `crc32' > >>>> > >>>> The root cause is that i686 platform does not support 'crc32q' > >>>> Need make it only available in x86_64 platform > >>>> > >>>> Signed-off-by: Michael Qiu > >>>> --- > >>>> v2 --> v1: > >>>> Make crc32 instruction only works in X86 platform > >>>> lib/librte_hash/rte_hash_crc.h | 12 ++++++++++++ > >>>> 1 file changed, 12 insertions(+) > >>>> > >>>> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h > >>>> index d28bb2a..c0a789e 100644 > >>>> --- a/lib/librte_hash/rte_hash_crc.h > >>>> +++ b/lib/librte_hash/rte_hash_crc.h > >>>> @@ -364,6 +364,7 @@ crc32c_2words(uint64_t data, uint32_t init_val) > >>>> return crc; > >>>> } > >>>> > >>>> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64 > >>>> static inline uint32_t > >>>> crc32c_sse42_u32(uint32_t data, uint32_t init_val) > >>>> { > >>>> @@ -373,7 +374,9 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val) > >>>> : [data] "rm" (data)); > >>>> return init_val; > >>>> } > >>>> +#endif > >>> Wouldn't it be more elegant to define a stub which returns 0 in #else > >>> in order to remove #ifdef below? > >>> Not sure, matter of taste. > >> It may be not a good idea, see rte_hash_crc_8byte(), if no crc32 > >> support, it will use crc32c_2words(), if we define a stub which returns > >> 0 in #else, then we need always check the return value whether it is > >> none-zero otherwise need fallback. > > I don't think so. > > The stub won't never been called because they are protected by the cpuflag > > condition. > > Hi, Thomas > > Indeed what I concerned occurs, when compile target i686 in X86_64 > platform, it will call the stub function Oh, you mean compiling for i686 and run it in x86_64 target, so the stub for crc32c_sse42_u64 is called? > Then, should I make a patch to fix, change the code as this one(V2) > Another choice is you could revert V3 and merge V2. > Or if have other solution? It's probably saner to submit a fix you have tested with ifdef like in v2. Thanks