Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1740960 > unrolled thread
| Started by | Vijay Kumar <vijay.ac.kumar@oracle.com> |
|---|---|
| First post | 2017-09-27 21:30 +0200 |
| Last post | 2017-09-28 00:20 +0200 |
| Articles | 6 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 2/2] sparc64: Use lzcnt instruction for fls and __fls Vijay Kumar <vijay.ac.kumar@oracle.com> - 2017-09-27 21:30 +0200
Re: [PATCH v2 2/2] sparc64: Use lzcnt instruction for fls and __fls Sam Ravnborg <sam@ravnborg.org> - 2017-09-27 22:00 +0200
Re: [PATCH v2 2/2] sparc64: Use lzcnt instruction for fls and __fls Vijay Kumar <vijay.ac.kumar@oracle.com> - 2017-09-27 22:30 +0200
Re: [PATCH v2 2/2] sparc64: Use lzcnt instruction for fls and __fls David Miller <davem@davemloft.net> - 2017-09-27 23:10 +0200
Re: [PATCH v2 2/2] sparc64: Use lzcnt instruction for fls and __fls Anthony Yznaga <anthony.yznaga@oracle.com> - 2017-09-27 23:50 +0200
Re: [PATCH v2 2/2] sparc64: Use lzcnt instruction for fls and __fls David Miller <davem@davemloft.net> - 2017-09-28 00:20 +0200
| From | Vijay Kumar <vijay.ac.kumar@oracle.com> |
|---|---|
| Date | 2017-09-27 21:30 +0200 |
| Subject | [PATCH v2 2/2] sparc64: Use lzcnt instruction for fls and __fls |
| Message-ID | <uuqbU-7c0-15@gated-at.bofh.it> |
For T4 and above, patch fls and __fls functions at the boot time to use lzcnt instruction. Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com> Reviewed-by: Babu Moger <babu.moger@oracle.com> --- arch/sparc/Makefile | 1 + arch/sparc/kernel/head_64.S | 2 ++ arch/sparc/lib/Makefile | 3 +++ arch/sparc/lib/NG4fls.S | 30 ++++++++++++++++++++++++++++++ arch/sparc/lib/NG4patch.S | 9 +++++++++ 5 files changed, 45 insertions(+), 0 deletions(-) diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 8496a07..0763cd8 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -48,6 +48,7 @@ KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare KBUILD_CFLAGS += -Wa,--undeclared-regs KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3) KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs +KBUILD_AFLAGS += -Wa,-Asparc4 ifeq ($(CONFIG_MCOUNT),y) KBUILD_CFLAGS += -pg diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S index 78e0211..1165254 100644 --- a/arch/sparc/kernel/head_64.S +++ b/arch/sparc/kernel/head_64.S @@ -628,6 +628,8 @@ niagara4_patch: nop call niagara4_patch_pageops nop + call niagara4_patch_fls + nop ba,a,pt %xcc, 80f nop diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index eefbb9c..72d2d8c 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile @@ -46,3 +46,6 @@ lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o obj-$(CONFIG_SPARC64) += iomap.o obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o obj-$(CONFIG_SPARC64) += PeeCeeI.o + +obj-$(CONFIG_SPARC64) += fls.o +obj-$(CONFIG_SPARC64) += NG4fls.o diff --git a/arch/sparc/lib/NG4fls.S b/arch/sparc/lib/NG4fls.S new file mode 100644 index 0000000..eb239aa --- /dev/null +++ b/arch/sparc/lib/NG4fls.S @@ -0,0 +1,30 @@ +/* NG4fls.S: SPARC optimized fls and __fls for T4 and above. + * + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + */ + + .text + .align 32 + + .globl NG4fls + .globl __NG4fls + .type NG4fls, #function + .type __NG4fls, #function + +NG4fls: + lzcnt %o0, %o1 + mov 64, %o2 + retl + sub %o2, %o1, %o0 + .size NG4fls, .-NG4fls + +__NG4fls: + brz,pn %o0, 1f + mov %o0, %o1 + lzcnt %o1, %o0 + mov 63, %o2 + sub %o2, %o0, %o0 +1: + retl + nop + .size __NG4fls, .-__NG4fls diff --git a/arch/sparc/lib/NG4patch.S b/arch/sparc/lib/NG4patch.S index 3cc0f8c..1010d53 100644 --- a/arch/sparc/lib/NG4patch.S +++ b/arch/sparc/lib/NG4patch.S @@ -52,3 +52,12 @@ niagara4_patch_pageops: retl nop .size niagara4_patch_pageops,.-niagara4_patch_pageops + + .globl niagara4_patch_fls + .type niagara4_patch_fls,#function +niagara4_patch_fls: + NG_DO_PATCH(fls, NG4fls) + NG_DO_PATCH(__fls, __NG4fls) + retl + nop + .size niagara4_patch_fls,.-niagara4_patch_fls -- 1.7.1
[toc] | [next] | [standalone]
| From | Sam Ravnborg <sam@ravnborg.org> |
|---|---|
| Date | 2017-09-27 22:00 +0200 |
| Message-ID | <uuqEX-7nX-29@gated-at.bofh.it> |
| In reply to | #1740960 |
Hi Vijay. On Wed, Sep 27, 2017 at 01:25:26PM -0600, Vijay Kumar wrote: > For T4 and above, patch fls and __fls functions > at the boot time to use lzcnt instruction. > > Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com> > Reviewed-by: Babu Moger <babu.moger@oracle.com> > --- > arch/sparc/Makefile | 1 + > arch/sparc/kernel/head_64.S | 2 ++ > arch/sparc/lib/Makefile | 3 +++ > arch/sparc/lib/NG4fls.S | 30 ++++++++++++++++++++++++++++++ > arch/sparc/lib/NG4patch.S | 9 +++++++++ > 5 files changed, 45 insertions(+), 0 deletions(-) > > diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile > index 8496a07..0763cd8 100644 > --- a/arch/sparc/Makefile > +++ b/arch/sparc/Makefile > @@ -48,6 +48,7 @@ KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare > KBUILD_CFLAGS += -Wa,--undeclared-regs > KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3) > KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs > +KBUILD_AFLAGS += -Wa,-Asparc4 This change is not justified anywhere?? > > ifeq ($(CONFIG_MCOUNT),y) > KBUILD_CFLAGS += -pg > diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S > index 78e0211..1165254 100644 > --- a/arch/sparc/kernel/head_64.S > +++ b/arch/sparc/kernel/head_64.S > @@ -628,6 +628,8 @@ niagara4_patch: > nop > call niagara4_patch_pageops > nop > + call niagara4_patch_fls > + nop > > ba,a,pt %xcc, 80f > nop > diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile > index eefbb9c..72d2d8c 100644 > --- a/arch/sparc/lib/Makefile > +++ b/arch/sparc/lib/Makefile > @@ -46,3 +46,6 @@ lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o > obj-$(CONFIG_SPARC64) += iomap.o > obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o > obj-$(CONFIG_SPARC64) += PeeCeeI.o > + > +obj-$(CONFIG_SPARC64) += fls.o > +obj-$(CONFIG_SPARC64) += NG4fls.o > diff --git a/arch/sparc/lib/NG4fls.S b/arch/sparc/lib/NG4fls.S > new file mode 100644 > index 0000000..eb239aa > --- /dev/null > +++ b/arch/sparc/lib/NG4fls.S > @@ -0,0 +1,30 @@ > +/* NG4fls.S: SPARC optimized fls and __fls for T4 and above. > + * > + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. > + */ > + > + .text > + .align 32 > + > + .globl NG4fls > + .globl __NG4fls > + .type NG4fls, #function > + .type __NG4fls, #function Use ENTRY(), ENDPROC() as already mentioned. > +NG4fls: > + lzcnt %o0, %o1 > + mov 64, %o2 > + retl > + sub %o2, %o1, %o0 > + .size NG4fls, .-NG4fls > + > +__NG4fls: > + brz,pn %o0, 1f > + mov %o0, %o1 Use tabs for indent, not spaces. In this case one tab + one space. > + lzcnt %o1, %o0 > + mov 63, %o2 > + sub %o2, %o0, %o0 > +1: > + retl > + nop > + .size __NG4fls, .-__NG4fls > diff --git a/arch/sparc/lib/NG4patch.S b/arch/sparc/lib/NG4patch.S > index 3cc0f8c..1010d53 100644 > --- a/arch/sparc/lib/NG4patch.S > +++ b/arch/sparc/lib/NG4patch.S > @@ -52,3 +52,12 @@ niagara4_patch_pageops: > retl > nop > .size niagara4_patch_pageops,.-niagara4_patch_pageops > + > + .globl niagara4_patch_fls > + .type niagara4_patch_fls,#function > +niagara4_patch_fls: > + NG_DO_PATCH(fls, NG4fls) > + NG_DO_PATCH(__fls, __NG4fls) > + retl > + nop > + .size niagara4_patch_fls,.-niagara4_patch_fls Please path the remaining functions in this file with ENTRY(), ENDPROC() - in a separate patch. Sam
[toc] | [prev] | [next] | [standalone]
| From | Vijay Kumar <vijay.ac.kumar@oracle.com> |
|---|---|
| Date | 2017-09-27 22:30 +0200 |
| Message-ID | <uur7X-7Pc-1@gated-at.bofh.it> |
| In reply to | #1740984 |
Hi Sam, On 9/27/2017 2:56 PM, Sam Ravnborg wrote: >> .size niagara4_patch_pageops,.-niagara4_patch_pageops >> + >> + .globl niagara4_patch_fls >> + .type niagara4_patch_fls,#function >> +niagara4_patch_fls: >> + NG_DO_PATCH(fls, NG4fls) >> + NG_DO_PATCH(__fls, __NG4fls) >> + retl >> + nop >> + .size niagara4_patch_fls,.-niagara4_patch_fls > Please path the remaining functions in this file with ENTRY(), ENDPROC() - in a separate patch. Thanks for your comment. Sure, I will make the changes and address other comments as well in my revised version. - Vijay
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-09-27 23:10 +0200 |
| Message-ID | <uurKG-8gU-7@gated-at.bofh.it> |
| In reply to | #1740984 |
From: Sam Ravnborg <sam@ravnborg.org> Date: Wed, 27 Sep 2017 21:56:37 +0200 > Hi Vijay. > > On Wed, Sep 27, 2017 at 01:25:26PM -0600, Vijay Kumar wrote: >> For T4 and above, patch fls and __fls functions >> at the boot time to use lzcnt instruction. >> >> Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com> >> Reviewed-by: Babu Moger <babu.moger@oracle.com> >> --- >> arch/sparc/Makefile | 1 + >> arch/sparc/kernel/head_64.S | 2 ++ >> arch/sparc/lib/Makefile | 3 +++ >> arch/sparc/lib/NG4fls.S | 30 ++++++++++++++++++++++++++++++ >> arch/sparc/lib/NG4patch.S | 9 +++++++++ >> 5 files changed, 45 insertions(+), 0 deletions(-) >> >> diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile >> index 8496a07..0763cd8 100644 >> --- a/arch/sparc/Makefile >> +++ b/arch/sparc/Makefile >> @@ -48,6 +48,7 @@ KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare >> KBUILD_CFLAGS += -Wa,--undeclared-regs >> KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3) >> KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs >> +KBUILD_AFLAGS += -Wa,-Asparc4 > This change is not justified anywhere?? It also will likely break with older tools.
[toc] | [prev] | [next] | [standalone]
| From | Anthony Yznaga <anthony.yznaga@oracle.com> |
|---|---|
| Date | 2017-09-27 23:50 +0200 |
| Message-ID | <uusno-8uO-21@gated-at.bofh.it> |
| In reply to | #1740984 |
> On Sep 27, 2017, at 12:56 PM, Sam Ravnborg <sam@ravnborg.org> wrote: > > Hi Vijay. > > On Wed, Sep 27, 2017 at 01:25:26PM -0600, Vijay Kumar wrote: >> For T4 and above, patch fls and __fls functions >> at the boot time to use lzcnt instruction. >> >> Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com> >> Reviewed-by: Babu Moger <babu.moger@oracle.com> >> --- >> arch/sparc/Makefile | 1 + >> arch/sparc/kernel/head_64.S | 2 ++ >> arch/sparc/lib/Makefile | 3 +++ >> arch/sparc/lib/NG4fls.S | 30 ++++++++++++++++++++++++++++++ >> arch/sparc/lib/NG4patch.S | 9 +++++++++ >> 5 files changed, 45 insertions(+), 0 deletions(-) >> >> diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile >> index 8496a07..0763cd8 100644 >> --- a/arch/sparc/Makefile >> +++ b/arch/sparc/Makefile >> @@ -48,6 +48,7 @@ KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare >> KBUILD_CFLAGS += -Wa,--undeclared-regs >> KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3) >> KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs >> +KBUILD_AFLAGS += -Wa,-Asparc4 > This change is not justified anywhere?? It looks like this is to get the assembler to recognize the lzcnt instruction. Vijay, Older assemblers may not support this flag so you’ll need to hardcode the lzcnt instructions using .word directives. Anthony > >> >> ifeq ($(CONFIG_MCOUNT),y) >> KBUILD_CFLAGS += -pg >> diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S >> index 78e0211..1165254 100644 >> --- a/arch/sparc/kernel/head_64.S >> +++ b/arch/sparc/kernel/head_64.S >> @@ -628,6 +628,8 @@ niagara4_patch: >> nop >> call niagara4_patch_pageops >> nop >> + call niagara4_patch_fls >> + nop >> >> ba,a,pt %xcc, 80f >> nop >> diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile >> index eefbb9c..72d2d8c 100644 >> --- a/arch/sparc/lib/Makefile >> +++ b/arch/sparc/lib/Makefile >> @@ -46,3 +46,6 @@ lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o >> obj-$(CONFIG_SPARC64) += iomap.o >> obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o >> obj-$(CONFIG_SPARC64) += PeeCeeI.o >> + >> +obj-$(CONFIG_SPARC64) += fls.o >> +obj-$(CONFIG_SPARC64) += NG4fls.o >> diff --git a/arch/sparc/lib/NG4fls.S b/arch/sparc/lib/NG4fls.S >> new file mode 100644 >> index 0000000..eb239aa >> --- /dev/null >> +++ b/arch/sparc/lib/NG4fls.S >> @@ -0,0 +1,30 @@ >> +/* NG4fls.S: SPARC optimized fls and __fls for T4 and above. >> + * >> + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. >> + */ >> + >> + .text >> + .align 32 >> + >> + .globl NG4fls >> + .globl __NG4fls >> + .type NG4fls, #function >> + .type __NG4fls, #function > > Use ENTRY(), ENDPROC() as already mentioned. >> +NG4fls: >> + lzcnt %o0, %o1 >> + mov 64, %o2 >> + retl >> + sub %o2, %o1, %o0 >> + .size NG4fls, .-NG4fls >> + >> +__NG4fls: >> + brz,pn %o0, 1f >> + mov %o0, %o1 > Use tabs for indent, not spaces. In this case one tab + one space. > >> + lzcnt %o1, %o0 >> + mov 63, %o2 >> + sub %o2, %o0, %o0 >> +1: >> + retl >> + nop >> + .size __NG4fls, .-__NG4fls >> diff --git a/arch/sparc/lib/NG4patch.S b/arch/sparc/lib/NG4patch.S >> index 3cc0f8c..1010d53 100644 >> --- a/arch/sparc/lib/NG4patch.S >> +++ b/arch/sparc/lib/NG4patch.S >> @@ -52,3 +52,12 @@ niagara4_patch_pageops: >> retl >> nop >> .size niagara4_patch_pageops,.-niagara4_patch_pageops >> + >> + .globl niagara4_patch_fls >> + .type niagara4_patch_fls,#function >> +niagara4_patch_fls: >> + NG_DO_PATCH(fls, NG4fls) >> + NG_DO_PATCH(__fls, __NG4fls) >> + retl >> + nop >> + .size niagara4_patch_fls,.-niagara4_patch_fls > > Please path the remaining functions in this file with ENTRY(), ENDPROC() - in a separate patch. > > Sam > -- > To unsubscribe from this list: send the line "unsubscribe sparclinux" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-09-28 00:20 +0200 |
| Message-ID | <uusQp-sS-11@gated-at.bofh.it> |
| In reply to | #1741046 |
From: Anthony Yznaga <anthony.yznaga@oracle.com> Date: Wed, 27 Sep 2017 14:45:34 -0700 > Vijay, > Older assemblers may not support this flag so you’ll need to > hardcode the lzcnt instructions using .word directives. Right, older binutils do not support the T4 instructions. This is why we hardcode the opcodes for all of the crypto instructions used under arch/sparc64/crypto/, for example.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web