Received: by 10.213.65.68 with SMTP id h4csp1767218imn; Mon, 19 Mar 2018 12:41:48 -0700 (PDT) X-Google-Smtp-Source: AG47ELuwrQH2IFQVy4M1ij2jSBG4sCZTjQRtkueS3hIfmmzi3gzk7rA19NnaQUniOOK/l+wfDz1z X-Received: by 10.101.81.75 with SMTP id g11mr4164799pgq.143.1521488507940; Mon, 19 Mar 2018 12:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521488507; cv=none; d=google.com; s=arc-20160816; b=owK8zBL9vwGTCulMp/DnS/HrrM23+7LgZljSiWARCvMYJz4d5f4EWCgd6CHYBpDdSy fd49nLmU6lqhbPPN3WnTqLAEdKdD+/ebqbzXrgGtcuUNkvdK2qFolaSaRLTB7gUi0xoM jnL3EN22mpwn5s8ORXjYtj3ab4ecKqPrAXk5gGec1zZMoDrudSRrzLVLZo+STLEVKgeY ZcS796atAIE9/UO8UMpyL7B0PN5thEcT5NGl/7MOJBlJniVoJH8ktKRnQdHrrabL+zcL St20w+9tuVKL+wRI+6SORS2JT1RdYYyuAyfQJ03IWm2Hs+nToP5u4q7i6dJZsAaULEKG Z9Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=7pnJN+I3rQeQdW/py3xqQU8uTWTI4xC0nXMjd3RA+vA=; b=H73h5MDHeNJ5V+ByZVHBqvfbf44ZmqB9duYpW4IQMXreL3GXq/3nePiFBIys+uqRm/ t1ACftKxT7Wr8hsz03kEZBfZ/bIDBXXuZKubj+U4rhrnflf6wWKJAMx2VGjPX3i+qgcD 2Whi05+8OllYm3B5gQqeP3mUaq+PgZkZObFjReQVckXOWYra4ttBUeaK5mwyRbyXCREI 18KLLp3F3YxpTHi4aV+Ut5g25euzBr2jqFvz7ef0u6WwbI5QhRNNjsykAU4TPiu1X6T4 I08DAYvCxK7wRh33ArPNI4JJfOdD62kXTLcs8V+L4bNrRWJ8Hgbmj6jNV9QqTOyOuHTw K2XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@eng.ucsd.edu header.s=google header.b=RV9jmApx; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1-v6si555255plt.54.2018.03.19.12.41.33; Mon, 19 Mar 2018 12:41:47 -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=@eng.ucsd.edu header.s=google header.b=RV9jmApx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968924AbeCSTkH (ORCPT + 99 others); Mon, 19 Mar 2018 15:40:07 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:37523 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936131AbeCSTj5 (ORCPT ); Mon, 19 Mar 2018 15:39:57 -0400 Received: by mail-it0-f67.google.com with SMTP id k79-v6so11774850ita.2 for ; Mon, 19 Mar 2018 12:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eng.ucsd.edu; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=7pnJN+I3rQeQdW/py3xqQU8uTWTI4xC0nXMjd3RA+vA=; b=RV9jmApxWCWcgoxPQxbtfWZqIccRq4i+XVbyv307dmycfzGNAoYTCsW7Bw7JUVaLEI LveKVvzuoqV0ndRwI8C3ue4qAtp3B9LJy1wxHBFDiDAYSDcRO0vklLVdWv9iFdRt6S5b 0fqH4Bdh6bOe0ue2bsLU3UHS8zLxrSVCrGoC0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7pnJN+I3rQeQdW/py3xqQU8uTWTI4xC0nXMjd3RA+vA=; b=loygEpOMA4BU+JA9+N/KiCAsL1lFxVTeQ7gklqKuoX2o4iaB7EZKfj+cclpnZMTtGn C7TR0xfD2AuGGJtj6OkCdcoZ7ZTk0lj8Ri7XKMlNLXHmGhT/YxiJUMQmVshlN3IGE020 hpmr6OrrnJDEy3oGY1EhJQCFMzxqbGP4MiVXJXZd9+3WhLnRNg0yvQq61h1ke5k46PP2 COxs/25EUIVyiQ+L4x7OdeaIUDp4Bpl22QcSdioeh8M24n0LEddphj12/A5TGnfM42an z+VstHIoikcnTRI7HvSwEuYXaXoduCXNV1w66Yxg3O/RBl8I3UAunlKQXRwjd7Z1DY2s oYiA== X-Gm-Message-State: AElRT7HkUjvKbteaa3icjD5Sk0L3Bu+6qrd40D6MB4jTvofU6VUzNppf UiKxYSnxrT63qHOvVwXtrnojVEQ/LmFDUkh8u4IbsQ== X-Received: by 2002:a24:6f04:: with SMTP id x4-v6mr686396itb.147.1521488396752; Mon, 19 Mar 2018 12:39:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.195.72 with HTTP; Mon, 19 Mar 2018 12:39:55 -0700 (PDT) In-Reply-To: <20180311192256.GA630@zzz.localdomain> References: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> <1520705944-6723-6-git-send-email-jix024@eng.ucsd.edu> <0924a2b3-6f21-4aaf-224d-2f5accc21d10@gmail.com> <20180311192256.GA630@zzz.localdomain> From: Andiry Xu Date: Mon, 19 Mar 2018 12:39:55 -0700 Message-ID: Subject: Re: [RFC v2 05/83] Add NOVA filesystem definitions and useful helper routines. To: Eric Biggers Cc: Nikolay Borisov , Linux FS Devel , Linux Kernel Mailing List , "linux-nvdimm@lists.01.org" , Dan Williams , "Rudoff, Andy" , coughlan@redhat.com, Steven Swanson , Dave Chinner , Jan Kara , swhiteho@redhat.com, miklos@szeredi.hu, Jian Xu , Andiry Xu , Herbert Xu Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 11, 2018 at 12:22 PM, Eric Biggers wrote: > On Sun, Mar 11, 2018 at 02:00:13PM +0200, Nikolay Borisov wrote: >> [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; >> > +} >> > + > > Are you sure that CONFIG_CRYPTO_CRC32C_INTEL was enabled during your tests and > that the accelerated version was being called? Or, perhaps CRC32C_PCL_BREAKEVEN > (defined in arch/x86/crypto/crc32c-intel_glue.c) needs to be adjusted. Please > don't hack around performance problems like this; if they exist, they need to be > fixed for everyone. > I have performed the crc32c test on a Xeon X5647 at 2.93GHz, 14G DDR3 memory at 1066MHz platform. You are right that enabling CONFIG_CRYPTO_CRC32C_INTEL improves the performance significantly. nova_crc32c() is still slightly faster than crc32c() with the flag enabled. Result numbers are follows: data size in bytes, latency in ns, column 3 is crc32c() with CONFIG_CRYPTO_CRC32C_INTEL enabled and column 4 disabled. data size (bytes) nova_crc32c() crc32c() -enabled crc32c() -disabled 64 19 21 56 128 28 29 99 256 46 43 182 512 82 149 354 1024 157 232 728 2048 305 415 1440 4096 603 725 2869 Thanks, Andiry