Received: by 10.192.245.15 with SMTP id i15csp1142386imn; Sun, 11 Mar 2018 05:01:26 -0700 (PDT) X-Google-Smtp-Source: AG47ELvUMxunumUNOTdwstdT5nLXVxR/oNTTdFbsGGtj/OY7AHZiHko3oFUPRI1t1ty54cncIcE0 X-Received: by 10.101.82.1 with SMTP id o1mr3879998pgp.37.1520769686063; Sun, 11 Mar 2018 05:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520769686; cv=none; d=google.com; s=arc-20160816; b=O9olcIlcVoWFtwR1ftxhGXobLqzpQWBmrj/I0tbIlKWqYOZ94eYV84Ov/GcrB00O/j mZ9oPSxNE9vJFmywkRBIq991ZSNDs/D5TSXeyR1u+1hHfgy/eD8p8+gTAOEXjhi7eYFF VvtUt5EC4lHXZE/1zhbxlaDbHbwCYEFzzaqEGHD06StNW/8Uzf47RFU2uB/IfPgykdbB 28t9IakF6MPr49ffKyDNXZEtBsvGK5zXJYdw/GtIAuQWnjsPMY+yJN1M6Nq8/Of0cqa9 evVUsmG0AzUzLdSjb+tuwUh33MX1/m7mRijaV6zagkaS5AwaCPDafPYEc/7MxTZicvyR Onmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=8hp5/p19CuugcgOrGgTTPumJWDNXItSxzskheEIFSRY=; b=xi/vu7VA2KD8G+2V+VEIDnoe01dbv0A+2rRFTF1rjFnqaZF3BvMOaL9rjnhKtKMu9W /qneTsicXBKlHF/zqlCuEVYeXZB9mY9729Agec6qPxq9dATYudS33wkb9wIXZ/IYzUWO 9eYQbeU+7Jsd5tShX+FCBv13Md0Q7Crzrz7xSvCcsfjTZ9XHm32GHE/vLT7GUH/KOVaT Eh8iVbP3QJfeEAqWeq6WskgH+tlHdsaT4JYcfii4atbRgBKI5GZqdcwweNr42bcHHsGG 1Lj7D4DR1LPonAk39yhk2i8zVxUyMpOd2RyMBrbv2wHRkANOTfPNjR9rMgpF3iP+hd+S vndA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=smrlJOni; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10si3560865pgr.822.2018.03.11.05.01.11; Sun, 11 Mar 2018 05:01:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=smrlJOni; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932192AbeCKMAT (ORCPT + 99 others); Sun, 11 Mar 2018 08:00:19 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34756 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932126AbeCKMAR (ORCPT ); Sun, 11 Mar 2018 08:00:17 -0400 Received: by mail-wm0-f67.google.com with SMTP id a20so9430815wmd.1; Sun, 11 Mar 2018 05:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=8hp5/p19CuugcgOrGgTTPumJWDNXItSxzskheEIFSRY=; b=smrlJOni6oyVr+d1K4Zsg77HertcrFAx0nPnA54edxsPS5477JCdKSh8SaGA5zrJaE YNH/4yNtDPGjWzC8iSKfGGGwuSXsUarREwsD+fO1cls2BPsvDqgxMU9TcVL80AtoVJHR 3pkYZ6bZRVpzCCCmuKQcpqXc04CJFDf8nQ9EsHo9z+bTm4yeWbtR7oIsqaVqloInFATv agKiM3CRm6WplXrAwfG35JOHXoqHs3c8OXnF9ft1WOgkDIiWxGYbpZM69JLvp7JFOEpN EgdY7rh2KifNazUVNs1pvgucv4I9LSJVUsqJpwcavHm6RofcxXwD8YkwoURLblk1e7Uz SwoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8hp5/p19CuugcgOrGgTTPumJWDNXItSxzskheEIFSRY=; b=H74X+ddnvh33vlIZRI0dotEWVx2F5ut9PKXdGbqKB8i29NNAmPZ5fYvETIuKEqI8HI fljYg5ukfQEx4S83hr561z09Y2omf7DDwJ5NOVLoYsrEQRpPOn6jW31EmRx864YLE3cn b7dU4QWtksrSZU7SXE2kB/ypnJljCQqtonuBMZE+Q5gvpgNtYLvPpwKXgfEKkM8UDrTY agogztHKbBhm1bhKmzSACvbjrLCKxfZ+l2IE1N1oS4zCxwTPDN7g+dCIyFh12nr7/NUL P+d/oJ6vwMBooLfemxIXA/fitLLtnRXP4FAbFpIKXnjqlaHmHglRcMje9T2Wu3j5ekdS NFiw== X-Gm-Message-State: AElRT7EA6PkJkh3d4hzet299eOWwZYlwi/3p1tPcZIzVKi9iDC6M/U3Q EjWYOLrPqBdOpgQMzGj3xZY= X-Received: by 10.28.190.19 with SMTP id o19mr3055246wmf.53.1520769615862; Sun, 11 Mar 2018 05:00:15 -0700 (PDT) Received: from [10.20.1.223] (ivokamhome.ddns.nbis.net. [87.120.136.31]) by smtp.gmail.com with ESMTPSA id b28sm5045012wrg.66.2018.03.11.05.00.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Mar 2018 05:00:14 -0700 (PDT) Subject: Re: [RFC v2 05/83] Add NOVA filesystem definitions and useful helper routines. To: Andiry Xu , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org Cc: dan.j.williams@intel.com, andy.rudoff@intel.com, coughlan@redhat.com, swanson@cs.ucsd.edu, david@fromorbit.com, jack@suse.com, swhiteho@redhat.com, miklos@szeredi.hu, andiry.xu@gmail.com, Andiry Xu , herbert@gondor.apana.org.au References: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> <1520705944-6723-6-git-send-email-jix024@eng.ucsd.edu> From: Nikolay Borisov Message-ID: <0924a2b3-6f21-4aaf-224d-2f5accc21d10@gmail.com> Date: Sun, 11 Mar 2018 14:00:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1520705944-6723-6-git-send-email-jix024@eng.ucsd.edu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Adding Herbert Xu to CC since he is the maintainer of the crypto subsys maintainer] On 10.03.2018 20:17, Andiry Xu wrote: > +static inline u32 nova_crc32c(u32 crc, const u8 *data, size_t len) > +{ > + u8 *ptr = (u8 *) data; > + u64 acc = crc; /* accumulator, crc32c value in lower 32b */ > + u32 csum; > + > + /* x86 instruction crc32 is part of SSE-4.2 */ > + if (static_cpu_has(X86_FEATURE_XMM4_2)) { > + /* This inline assembly implementation should be equivalent > + * to the kernel's crc32c_intel_le_hw() function used by > + * crc32c(), but this performs better on test machines. > + */ > + while (len > 8) { > + asm volatile(/* 64b quad words */ > + "crc32q (%1), %0" > + : "=r" (acc) > + : "r" (ptr), "0" (acc) > + ); > + ptr += 8; > + len -= 8; > + } > + > + while (len > 0) { > + asm volatile(/* trailing bytes */ > + "crc32b (%1), %0" > + : "=r" (acc) > + : "r" (ptr), "0" (acc) > + ); > + ptr++; > + len--; > + } > + > + csum = (u32) acc; > + } else { > + /* The kernel's crc32c() function should also detect and use the > + * crc32 instruction of SSE-4.2. But calling in to this function > + * is about 3x to 5x slower than the inline assembly version on > + * some test machines. That is really odd. Did you try to characterize why this is the case? Is it purely the overhead of dispatching to the correct backend function? That's a rather big performance hit. > + */ > + csum = crc32c(crc, data, len); > + } > + > + return csum; > +} > +