From patchwork Thu Apr 26 16:06:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riccardo Ravaioli X-Patchwork-Id: 39048 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D91978E62; Thu, 26 Apr 2018 18:06:50 +0200 (CEST) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) by dpdk.org (Postfix) with ESMTP id 27EC38DA9 for ; Thu, 26 Apr 2018 18:06:49 +0200 (CEST) Received: by mail-it0-f42.google.com with SMTP id c3-v6so10378044itj.4 for ; Thu, 26 Apr 2018 09:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:sender:from:date:message-id:subject:to; bh=B9ZAS3Z/CTH5FW5ErMYDcVk4YoeHIR21nOQH8pkGYas=; b=QDhndVOQub2zDM1f0UuB1Bxub4l/zvuKR4YUyJPSeDRB1LXPHce55uK+xFBbboi7Nq 1aeUQzazEuaAECO5sELBOhNoroYULnAhEnRP6Q54xdagDndaQDUmGEEUrpBqjPc6/twu +zh/rXbGt/ctqgwEFymFswXfHy/tNfgJedt36Q6wAlOB3FJuPv0ulntMjAkBnCw9gWUP TTAAqIFYXw8Fo7qYBu3tlFiRENQrlHboUPvlORVStv03CvNAf27AOplejzn2gj3p0Icc DaKgk5hf0c0w1Vh54cFwA/+6VAYAf2HwDM5rBVDo4UF8y3ttD3X1221n/Lbfj2+U3xti ZSSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:sender:from:date :message-id:subject:to; bh=B9ZAS3Z/CTH5FW5ErMYDcVk4YoeHIR21nOQH8pkGYas=; b=YWvliee6MNH2jYqUA0YMnZplk2lhVBJXoCUxuyI18BGtDAXrFfWN2/Cm2zEKlDKPM1 BSbQOnXYjh9NjYoDnOc9mst8zIaVjegWi6aDOQ04YtZoiu9oMfzaaPzdkajlWl1moxkK McI/G3N8JoSOrZ9oVSnsFSLn7ViaptabukGeZiNvsJspOpD5APvm6LICy+aLyhd/isYy KBX8BUu2UrxbpUGZEz/atylBO3qRw5FbrLq4vP6I9SspJqKfxsyVVcvMThwuvHwy/CKR OopfBX28f1CEtfxS5BWYkpRPzEJHnQwVPsoJZTNP4g3kHQAlred3Z5wSY4X157I4IsFn X9ZQ== X-Gm-Message-State: ALQs6tDDs1CohkVQrHZmup7XTwo+ktRGhQjsM13wxL8CwEIYa+g1oCX6 psM91WuAkkd6nm9zzPY2WBEXjefiQ9aDrfOXe7IC9A== X-Google-Smtp-Source: AB8JxZotOHDQ84WTdD8WhjLnF/1qvBCp+xp63I4c0O4LU003C5nnWMENZvZruuRK35UaZOoxVNCN+mltPTrflbI0BW4= X-Received: by 2002:a24:2683:: with SMTP id v125-v6mr28766668itv.72.1524758807967; Thu, 26 Apr 2018 09:06:47 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:3e18:0:0:0:0:0 with HTTP; Thu, 26 Apr 2018 09:06:47 -0700 (PDT) From: Riccardo Ravaioli Date: Thu, 26 Apr 2018 18:06:47 +0200 X-Google-Sender-Auth: bd4Hwcs-AspwkzMsNbG8nsa28c8 Message-ID: To: dev@dpdk.org X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [PATCH] AVX check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: riccardoravaioli@gmail.com List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi all, I need to install DPDK on 64-bit Linux machines whose processors might or might not support AVX instructions. In my current configuration file, defconfig_x86-64-native-linuxapp-gcc, the parameter CONFIG_RTE_MACHINE is set to native. If I compile DPDK on a machine that supports AVX and then I install it (along with openvswitch) on a machine that does *not* support AVX, openvswitch won't start and will output an "illegal instruction" error. I'm proposing the following patch to fix this issue: The original check above is for SSE4, not for AVX, but the chosen function rte_net_crc_sse42_init does run AVX instructions. So I suggest making the check for AVX explicit, as outlined above. I tested this on a machine with an Intel Atom C3000 processor and openvswitch seems to function correctly. Are there any potential side effects? Thanks! Riccardo diff -r ac0f646132b8 src/lib/librte_net/rte_net_crc.c --- a/src/lib/librte_net/rte_net_crc.c Thu Apr 26 17:25:01 2018 +0200 +++ b/src/lib/librte_net/rte_net_crc.c Thu Apr 26 17:25:04 2018 +0200 @@ -212,8 +212,10 @@ rte_net_crc_scalar_init(); #ifdef X86_64_SSE42_PCLMULQDQ - alg = RTE_NET_CRC_SSE42; - rte_net_crc_sse42_init(); + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX)) { + alg = RTE_NET_CRC_SSE42; + rte_net_crc_sse42_init(); + } #elif defined ARM64_NEON_PMULL if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_PMULL)) { alg = RTE_NET_CRC_NEON;