Received: by 10.213.65.16 with SMTP id m16csp14404imf; Sun, 11 Mar 2018 12:24:13 -0700 (PDT) X-Google-Smtp-Source: AG47ELsMM2MTRiKOF4SEGIhgVVLai+CR+OQPXeq23Z0eYPsSpPLD5ASkXh2Oz6PldDUOgtGFUYlA X-Received: by 10.99.119.137 with SMTP id s131mr4430529pgc.296.1520796253499; Sun, 11 Mar 2018 12:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520796253; cv=none; d=google.com; s=arc-20160816; b=usvqUPTcEwO4eZvIsxa5YkqjGgSNQnlBaZvd8xWtFtD+plzKRNEvRXT9BW/i8duh0U 6fYTTLFEotHsZUAVc5eO+bqOPwvTGcKP9AmpS4/a2lyBK3TLIwscREeh1Q2Z7GjJkCEc fSpHTOhU5BI8cPnfDuglVmgTCWxGUwpfId7257w2E1VZJbDk7XoEBXnXkm3QUg7JHH9V 6HFUnQkenq/zNEWmnHIrvICot3JASsJ8In1A+IyRygQk7GWdB/jCTdv2RhkWVQOC9u6S ExLlHh/wh/vs05YGCWpdg0UCNUJ6JY5sQY1oWn1BXRHRdS22IDTCeAj/KI5oPAeGbvfQ NZvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=nnHzWVcu3KKGKtCqymGL3Eouhaslv+xGk4ToMrUPLqk=; b=1K5MEcT09WjJSfuPgI9GoTmtHwvYQpPB2jeNwUzDO2wn/aZ70YNp/QAkOTliSTag2h br7HWlxxdKD1nOAwe57fQCE2dR9plSZurEAzznycTw9JyMaqXD0EHHCCywyLjvinhcqd wJORSVOECl/MeFmfM4hMegIAnrlovhsiuCvfcI1ogIAkyPhzOdbaxkDsZwI2VrPDQVuJ EkReB34UgroS3dkvp65ni7WrXjyfjuy1eLkmrWr5/SzVJbPgvvLdocfVWV38uHWDkQIU 297T8ocDhop6/2wk8rLT1Lh5AtLCAZFDnmYtUGzoZPqlvZIGLwQZkzHPLN7faKOy4G1w vAtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qo31HlAk; 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 p11si3931447pgs.537.2018.03.11.12.23.57; Sun, 11 Mar 2018 12:24:13 -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=Qo31HlAk; 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 S932209AbeCKTXC (ORCPT + 99 others); Sun, 11 Mar 2018 15:23:02 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36176 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932139AbeCKTXA (ORCPT ); Sun, 11 Mar 2018 15:23:00 -0400 Received: by mail-pf0-f196.google.com with SMTP id 68so3430395pfx.3; Sun, 11 Mar 2018 12:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nnHzWVcu3KKGKtCqymGL3Eouhaslv+xGk4ToMrUPLqk=; b=Qo31HlAkr4jYIOPTj9HaNUM6m5Z1QjNwlk2HHg4qxRnKEOINOZnMDjnFROaCym4Ym1 2UvIdrR3zthvdGuhafR6vow7f5Q5c+WnqdFK+GzY1rIBAGFXctsOs1FGNeAivrVHnAg/ djWKQtAqPiY0FtR7VZe2tDSm7bxEnwKr8hg3N9Jc8ZdpaCN9WjNtCaZ41i5ToPLp8ZMf sdNkZPfKUJ7cnwjufdZxJETFos1KBIji+n4WCRY7yi5IMw5KVmE6w2pZlfLcFvHXiE/V U1fJqnyjEzsUkmCGLIINUxYwlJHSIlzPtp4Z7YMxjKSmeZfmMLS6wgt2+2WqHneOiUO7 g9JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nnHzWVcu3KKGKtCqymGL3Eouhaslv+xGk4ToMrUPLqk=; b=HdAtUSLih39+PIuJ3atbnZw1m8omx3o6wJwoJ6nRc1jMwmzr60nrD1jN85PvzJumEL m3wO+UMUPDtiOlVO6YoyyqWB833Ilujw0cx1Uo9LVtWh8QAZijf0IgKPcEypYiqCLOem BhZGgqYjjQTlJvBwBGiq6IgkQE2AIiqJiFUxVLXsjuvs6MSYZzi3Icur60GYwacECvpw zkHfBgYs5qQLeuEDAoSJWMwPBUBaNxatD58IogeYI9oZ5/ngck0CT4OqbgCW55wTMgqz rT31X5wYKoGYHny5FVNon2lE4C20uXXY9qoLVuiIEj90ck4WqXexYAYvYZ6oZRN4LpeL L1xA== X-Gm-Message-State: AElRT7E9RteqnzY5IVfuyH/Gkh0Jpsq3SxsuQ0wqECkeL1rUNdSjn4fu 2HNjCnhF3SmNR1hWp6GR/KI= X-Received: by 10.101.92.6 with SMTP id u6mr4578879pgr.440.1520796180109; Sun, 11 Mar 2018 12:23:00 -0700 (PDT) Received: from zzz.localdomain (c-67-185-97-198.hsd1.wa.comcast.net. [67.185.97.198]) by smtp.gmail.com with ESMTPSA id m1sm13947434pfi.80.2018.03.11.12.22.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Mar 2018 12:22:58 -0700 (PDT) Date: Sun, 11 Mar 2018 12:22:56 -0700 From: Eric Biggers To: Nikolay Borisov Cc: Andiry Xu , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, 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 Subject: Re: [RFC v2 05/83] Add NOVA filesystem definitions and useful helper routines. Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0924a2b3-6f21-4aaf-224d-2f5accc21d10@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) 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 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. Eric