RE: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-28 Thread David Laight
From: Simon Guo > Sent: 27 September 2017 19:34 ... > > On X86 all the AVX registers are caller saved, the system call > > entry could issue the instruction that invalidates them all. > > Kernel code running in the context of a user process could then > > use the registers without saving them. > >

Re: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-27 Thread Simon Guo
On Wed, Sep 27, 2017 at 09:43:44AM +, David Laight wrote: > From: Segher Boessenkool > > Sent: 27 September 2017 10:28 > ... > > You also need nasty code to deal with the start and end of strings, with > > conditional branches and whatnot, which quickly overwhelms the benefit > > of using

Re: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-27 Thread Simon Guo
Hi Michael, On Wed, Sep 27, 2017 at 01:38:09PM +1000, Michael Ellerman wrote: > Segher Boessenkool writes: > > > On Tue, Sep 26, 2017 at 03:34:36PM +1000, Michael Ellerman wrote: > >> Cyril Bur writes: > >> > This was written for userspace which

RE: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-27 Thread David Laight
From: Segher Boessenkool > Sent: 27 September 2017 10:28 ... > You also need nasty code to deal with the start and end of strings, with > conditional branches and whatnot, which quickly overwhelms the benefit > of using vector registers at all. This tradeoff also changes with newer > ISA

Re: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-27 Thread Segher Boessenkool
On Wed, Sep 27, 2017 at 01:38:09PM +1000, Michael Ellerman wrote: > Segher Boessenkool writes: > > A lot of userspace code uses V*X, more and more with newer CPUs and newer > > compiler versions. If you already paid the price for using vector > > registers you do not

Re: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-26 Thread Michael Ellerman
Segher Boessenkool writes: > On Tue, Sep 26, 2017 at 03:34:36PM +1000, Michael Ellerman wrote: >> Cyril Bur writes: >> > This was written for userspace which doesn't have to explicitly enable >> > VMX in order to use it - we need to be smarter in

Re: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-26 Thread Segher Boessenkool
On Tue, Sep 26, 2017 at 03:34:36PM +1000, Michael Ellerman wrote: > Cyril Bur writes: > > This was written for userspace which doesn't have to explicitly enable > > VMX in order to use it - we need to be smarter in the kernel. > > Well the kernel has to do it for them after a

Re: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-25 Thread Michael Ellerman
Cyril Bur writes: > On Sun, 2017-09-24 at 05:18 +0800, Simon Guo wrote: >> Hi Cyril, >> On Sat, Sep 23, 2017 at 12:06:48AM +1000, Cyril Bur wrote: >> > On Thu, 2017-09-21 at 07:34 +0800, wei.guo.si...@gmail.com wrote: >> > > From: Simon Guo >> > >

Re: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-25 Thread Cyril Bur
On Sun, 2017-09-24 at 05:18 +0800, Simon Guo wrote: > Hi Cyril, > On Sat, Sep 23, 2017 at 12:06:48AM +1000, Cyril Bur wrote: > > On Thu, 2017-09-21 at 07:34 +0800, wei.guo.si...@gmail.com wrote: > > > From: Simon Guo > > > > > > This patch add VMX primitives to do

Re: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-24 Thread Simon Guo
Hi Cyril, On Sat, Sep 23, 2017 at 12:06:48AM +1000, Cyril Bur wrote: > On Thu, 2017-09-21 at 07:34 +0800, wei.guo.si...@gmail.com wrote: > > From: Simon Guo > > > > This patch add VMX primitives to do memcmp() in case the compare size > > exceeds 4K bytes. > > > > Hi

Re: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-22 Thread Cyril Bur
On Thu, 2017-09-21 at 07:34 +0800, wei.guo.si...@gmail.com wrote: > From: Simon Guo > > This patch add VMX primitives to do memcmp() in case the compare size > exceeds 4K bytes. > Hi Simon, Sorry I didn't see this sooner, I've actually been working on a kernel version

Re: [PATCH v2 2/3] powerpc/64: enhance memcmp() with VMX instruction for long bytes comparision

2017-09-22 Thread Simon Guo
Hi, On Thu, Sep 21, 2017 at 07:34:39AM +0800, wei.guo.si...@gmail.com wrote: > From: Simon Guo > > This patch add VMX primitives to do memcmp() in case the compare size > exceeds 4K bytes. > > Test result with following test program(replace the "^>" with ""): > -- I