Received: by 10.213.65.68 with SMTP id h4csp1209735imn; Wed, 21 Mar 2018 05:31:34 -0700 (PDT) X-Google-Smtp-Source: AG47ELsdrRclxJCgiw0MayrWL7avqEpWVJESwQcP3qkWEW0QmAnMD3MKAe5smsp8ElE/SoUtUad+ X-Received: by 2002:a17:902:444:: with SMTP id 62-v6mr20999890ple.127.1521635493984; Wed, 21 Mar 2018 05:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521635493; cv=none; d=google.com; s=arc-20160816; b=AjvOXzGKxyO3CzUeXx6mPARe7+jO6zT/t/+7w2WRGUZN6CugjUlCpmUiw6z1o5ks5U USQhLXGLV69yc/pJ+sIZoDyX69zhaqIAg9CXwvjMlSHX8izm63lABz6X8shmlHU8OpKj HeYA2RiwwTKz2mghG87zldB78wjuJYpA2tDaRPWRR8p4bboFf7Vq8dHYxdSgKsIcycJU j0jTjYsfVtXKHKECqtYo70sU/U/DT0WICGFwVfddqkj+X/lqzWMKOO1EFCcIoXkuT8ox 85UFqfbCgZqo54TMZAt3wLLPRtlDmPrXuwXDURZ1IFcYwXE6kWrUHTH0L3xDnl6DTVy6 6CUA== 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:arc-authentication-results; bh=t/YYbXh1fCCNyCHrA1s7O3aD/qJ8CdjpSbkz0/e9j9E=; b=snW/KKPjoGxOpH+UcIR99mijVJXf4cBrNOkwPhw/8hPNRLqz+gYBYt2LJLFfbw1IgF /DV2+0n1S/PJkXtLNz/k8aYzACa1yKu8/xy8hG0MgtQ1ri9sOcfEiH08g1XJOwPMyMMH mdHuIJ+B1SbtAGRod/Iwe5UjyrZZ9T+dtp9I1D+fq94x7gacEhty/OJoSW2g128M8/pi 7cbD+kRu2fqGYI31kQCfaM9MxRmziMQmO150LuI/lCLwfB+G2ZaqKA14yBl8Iw42jxKr 0Ew9sSE4pPamDq+zvBNGIdoAdVtsHtGQSYqEKcfphmvdI+A6cQQIt7KjElYjyUJMNYLs XGgA== ARC-Authentication-Results: i=1; mx.google.com; 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 p190si3003300pfb.383.2018.03.21.05.31.19; Wed, 21 Mar 2018 05:31:33 -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; 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 S1752121AbeCUM34 (ORCPT + 99 others); Wed, 21 Mar 2018 08:29:56 -0400 Received: from stargate.chelsio.com ([12.32.117.8]:30090 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751688AbeCUM3x (ORCPT ); Wed, 21 Mar 2018 08:29:53 -0400 Received: from localhost (scalar.blr.asicdesigners.com [10.193.185.94]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w2LCTYcQ024760; Wed, 21 Mar 2018 05:29:34 -0700 Date: Wed, 21 Mar 2018 17:58:54 +0530 From: Rahul Lakkireddy To: Alexander Duyck Cc: Thomas Gleixner , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "mingo@redhat.com" , "hpa@zytor.com" , "davem@davemloft.net" , "akpm@linux-foundation.org" , "torvalds@linux-foundation.org" , Ganesh GR , Nirranjan Kirubaharan , Indranil Choudhury Subject: Re: [RFC PATCH 2/3] x86/io: implement 256-bit IO read and write Message-ID: <20180321122853.GC3245@chelsio.com> References: <6ec3e7e0c70e85a804933f27bb4275d5363c044b.1521469118.git.rahul.lakkireddy@chelsio.com> <20180320133206.GB25574@chelsio.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, March 03/20/18, 2018 at 20:12:15 +0530, Alexander Duyck wrote: > On Tue, Mar 20, 2018 at 6:32 AM, Rahul Lakkireddy > wrote: > > On Monday, March 03/19/18, 2018 at 20:13:10 +0530, Thomas Gleixner wrote: > >> On Mon, 19 Mar 2018, Rahul Lakkireddy wrote: > >> > >> > Use VMOVDQU AVX CPU instruction when available to do 256-bit > >> > IO read and write. > >> > >> That's not what the patch does. See below. > >> > >> > Signed-off-by: Rahul Lakkireddy > >> > Signed-off-by: Ganesh Goudar > >> > >> That Signed-off-by chain is wrong.... > >> > >> > +#ifdef CONFIG_AS_AVX > >> > +#include > >> > + > >> > +static inline u256 __readqq(const volatile void __iomem *addr) > >> > +{ > >> > + u256 ret; > >> > + > >> > + kernel_fpu_begin(); > >> > + asm volatile("vmovdqu %0, %%ymm0" : > >> > + : "m" (*(volatile u256 __force *)addr)); > >> > + asm volatile("vmovdqu %%ymm0, %0" : "=m" (ret)); > >> > + kernel_fpu_end(); > >> > + return ret; > >> > >> You _cannot_ assume that the instruction is available just because > >> CONFIG_AS_AVX is set. The availability is determined by the runtime > >> evaluated CPU feature flags, i.e. X86_FEATURE_AVX. > >> > > > > Ok. Will add boot_cpu_has(X86_FEATURE_AVX) check as well. > > > >> Aside of that I very much doubt that this is faster than 4 consecutive > >> 64bit reads/writes as you have the full overhead of > >> kernel_fpu_begin()/end() for each access. > >> > >> You did not provide any numbers for this so its even harder to > >> determine. > >> > > > > Sorry about that. Here are the numbers with and without this series. > > > > When reading up to 2 GB on-chip memory via MMIO, the time taken: > > > > Without Series With Series > > (64-bit read) (256-bit read) > > > > 52 seconds 26 seconds > > > > As can be seen, we see good improvement with doing 256-bits at a > > time. > > Instead of framing this as an enhanced version of the read/write ops > why not look at replacing or extending something like the > memcpy_fromio or memcpy_toio operations? It would probably be more > comparable to what you are doing if you are wanting to move large > chunks of memory from one region to another, and it should translate > into something like AVX instructions once the CPU optimizations kick > in for a memcpy. > Ok. Will look into this approach. Thanks, Rahul