* [PATCH 0/2] arch: enable GENERIC_FIND_FIRST_BIT for MIPS and ARM64 @ 2021-02-25 13:56 ` Yury Norov 0 siblings, 0 replies; 20+ messages in thread From: Yury Norov @ 2021-02-25 13:56 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips Cc: Yury Norov MIPS and ARM64 don't implement find_first_{zero}_bit in arch code and don't enable it in config. It leads to using find_next_bit() which is less efficient: It's beneficial to enable GENERIC_FIND_FIRST_BIT as this functionality is not new at all and well-tested. It provides more optimized code and saves .text memory: Alexander Lobakin (1): MIPS: enable GENERIC_FIND_FIRST_BIT Yury Norov (1): arm64: enable GENERIC_FIND_FIRST_BIT arch/arm64/Kconfig | 1 + arch/mips/Kconfig | 1 + 2 files changed, 2 insertions(+) -- 2.25.1 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 0/2] arch: enable GENERIC_FIND_FIRST_BIT for MIPS and ARM64 @ 2021-02-25 13:56 ` Yury Norov 0 siblings, 0 replies; 20+ messages in thread From: Yury Norov @ 2021-02-25 13:56 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips Cc: Yury Norov MIPS and ARM64 don't implement find_first_{zero}_bit in arch code and don't enable it in config. It leads to using find_next_bit() which is less efficient: It's beneficial to enable GENERIC_FIND_FIRST_BIT as this functionality is not new at all and well-tested. It provides more optimized code and saves .text memory: Alexander Lobakin (1): MIPS: enable GENERIC_FIND_FIRST_BIT Yury Norov (1): arm64: enable GENERIC_FIND_FIRST_BIT arch/arm64/Kconfig | 1 + arch/mips/Kconfig | 1 + 2 files changed, 2 insertions(+) -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 20+ messages in thread
* [RESEND PATCH 1/2] ARM64: enable GENERIC_FIND_FIRST_BIT 2021-02-25 13:56 ` Yury Norov @ 2021-02-25 13:56 ` Yury Norov -1 siblings, 0 replies; 20+ messages in thread From: Yury Norov @ 2021-02-25 13:56 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips Cc: Yury Norov ARM64 doesn't implement find_first_{zero}_bit in arch code and doesn't enable it in a config. It leads to using find_next_bit() which is less efficient: 0000000000000000 <find_first_bit>: 0: aa0003e4 mov x4, x0 4: aa0103e0 mov x0, x1 8: b4000181 cbz x1, 38 <find_first_bit+0x38> c: f9400083 ldr x3, [x4] 10: d2800802 mov x2, #0x40 // #64 14: 91002084 add x4, x4, #0x8 18: b40000c3 cbz x3, 30 <find_first_bit+0x30> 1c: 14000008 b 3c <find_first_bit+0x3c> 20: f8408483 ldr x3, [x4], #8 24: 91010045 add x5, x2, #0x40 28: b50000c3 cbnz x3, 40 <find_first_bit+0x40> 2c: aa0503e2 mov x2, x5 30: eb02001f cmp x0, x2 34: 54ffff68 b.hi 20 <find_first_bit+0x20> // b.pmore 38: d65f03c0 ret 3c: d2800002 mov x2, #0x0 // #0 40: dac00063 rbit x3, x3 44: dac01063 clz x3, x3 48: 8b020062 add x2, x3, x2 4c: eb02001f cmp x0, x2 50: 9a829000 csel x0, x0, x2, ls // ls = plast 54: d65f03c0 ret ... 0000000000000118 <_find_next_bit.constprop.1>: 118: eb02007f cmp x3, x2 11c: 540002e2 b.cs 178 <_find_next_bit.constprop.1+0x60> // b.hs, b.nlast 120: d346fc66 lsr x6, x3, #6 124: f8667805 ldr x5, [x0, x6, lsl #3] 128: b4000061 cbz x1, 134 <_find_next_bit.constprop.1+0x1c> 12c: f8667826 ldr x6, [x1, x6, lsl #3] 130: 8a0600a5 and x5, x5, x6 134: ca0400a6 eor x6, x5, x4 138: 92800005 mov x5, #0xffffffffffffffff // #-1 13c: 9ac320a5 lsl x5, x5, x3 140: 927ae463 and x3, x3, #0xffffffffffffffc0 144: ea0600a5 ands x5, x5, x6 148: 54000120 b.eq 16c <_find_next_bit.constprop.1+0x54> // b.none 14c: 1400000e b 184 <_find_next_bit.constprop.1+0x6c> 150: d346fc66 lsr x6, x3, #6 154: f8667805 ldr x5, [x0, x6, lsl #3] 158: b4000061 cbz x1, 164 <_find_next_bit.constprop.1+0x4c> 15c: f8667826 ldr x6, [x1, x6, lsl #3] 160: 8a0600a5 and x5, x5, x6 164: eb05009f cmp x4, x5 168: 540000c1 b.ne 180 <_find_next_bit.constprop.1+0x68> // b.any 16c: 91010063 add x3, x3, #0x40 170: eb03005f cmp x2, x3 174: 54fffee8 b.hi 150 <_find_next_bit.constprop.1+0x38> // b.pmore 178: aa0203e0 mov x0, x2 17c: d65f03c0 ret 180: ca050085 eor x5, x4, x5 184: dac000a5 rbit x5, x5 188: dac010a5 clz x5, x5 18c: 8b0300a3 add x3, x5, x3 190: eb03005f cmp x2, x3 194: 9a839042 csel x2, x2, x3, ls // ls = plast 198: aa0203e0 mov x0, x2 19c: d65f03c0 ret ... 0000000000000238 <find_next_bit>: 238: a9bf7bfd stp x29, x30, [sp, #-16]! 23c: aa0203e3 mov x3, x2 240: d2800004 mov x4, #0x0 // #0 244: aa0103e2 mov x2, x1 248: 910003fd mov x29, sp 24c: d2800001 mov x1, #0x0 // #0 250: 97ffffb2 bl 118 <_find_next_bit.constprop.1> 254: a8c17bfd ldp x29, x30, [sp], #16 258: d65f03c0 ret Enabling find_{first,next}_bit() would also benefit for_each_{set,clear}_bit(). On A-53 find_first_bit() is almost twice faster than find_next_bit(), according to lib/find_bit_benchmark (thanks to Alexey for testing): GENERIC_FIND_FIRST_BIT=n: [7126084.948181] find_first_bit: 47389224 ns, 16357 iterations [7126085.032315] find_first_bit: 19048193 ns, 655 iterations GENERIC_FIND_FIRST_BIT=y: [ 84.158068] find_first_bit: 27193319 ns, 16406 iterations [ 84.233005] find_first_bit: 11082437 ns, 656 iterations GENERIC_FIND_FIRST_BIT=n bloats the kernel despite that it disables generation of find_{first,next}_bit(): yury:linux$ scripts/bloat-o-meter vmlinux vmlinux.ffb add/remove: 4/1 grow/shrink: 19/251 up/down: 564/-1692 (-1128) ... Overall, GENERIC_FIND_FIRST_BIT=n is harmful both in terms of performance and code size, and it's better to have GENERIC_FIND_FIRST_BIT enabled. Tested-by: Alexey Klimov <aklimov@redhat.com> Signed-off-by: Yury Norov <yury.norov@gmail.com> --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 31bd885b79eb..5596eab04092 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -108,6 +108,7 @@ config ARM64 select GENERIC_CPU_AUTOPROBE select GENERIC_CPU_VULNERABILITIES select GENERIC_EARLY_IOREMAP + select GENERIC_FIND_FIRST_BIT select GENERIC_IDLE_POLL_SETUP select GENERIC_IRQ_IPI select GENERIC_IRQ_MULTI_HANDLER -- 2.25.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RESEND PATCH 1/2] ARM64: enable GENERIC_FIND_FIRST_BIT @ 2021-02-25 13:56 ` Yury Norov 0 siblings, 0 replies; 20+ messages in thread From: Yury Norov @ 2021-02-25 13:56 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips Cc: Yury Norov ARM64 doesn't implement find_first_{zero}_bit in arch code and doesn't enable it in a config. It leads to using find_next_bit() which is less efficient: 0000000000000000 <find_first_bit>: 0: aa0003e4 mov x4, x0 4: aa0103e0 mov x0, x1 8: b4000181 cbz x1, 38 <find_first_bit+0x38> c: f9400083 ldr x3, [x4] 10: d2800802 mov x2, #0x40 // #64 14: 91002084 add x4, x4, #0x8 18: b40000c3 cbz x3, 30 <find_first_bit+0x30> 1c: 14000008 b 3c <find_first_bit+0x3c> 20: f8408483 ldr x3, [x4], #8 24: 91010045 add x5, x2, #0x40 28: b50000c3 cbnz x3, 40 <find_first_bit+0x40> 2c: aa0503e2 mov x2, x5 30: eb02001f cmp x0, x2 34: 54ffff68 b.hi 20 <find_first_bit+0x20> // b.pmore 38: d65f03c0 ret 3c: d2800002 mov x2, #0x0 // #0 40: dac00063 rbit x3, x3 44: dac01063 clz x3, x3 48: 8b020062 add x2, x3, x2 4c: eb02001f cmp x0, x2 50: 9a829000 csel x0, x0, x2, ls // ls = plast 54: d65f03c0 ret ... 0000000000000118 <_find_next_bit.constprop.1>: 118: eb02007f cmp x3, x2 11c: 540002e2 b.cs 178 <_find_next_bit.constprop.1+0x60> // b.hs, b.nlast 120: d346fc66 lsr x6, x3, #6 124: f8667805 ldr x5, [x0, x6, lsl #3] 128: b4000061 cbz x1, 134 <_find_next_bit.constprop.1+0x1c> 12c: f8667826 ldr x6, [x1, x6, lsl #3] 130: 8a0600a5 and x5, x5, x6 134: ca0400a6 eor x6, x5, x4 138: 92800005 mov x5, #0xffffffffffffffff // #-1 13c: 9ac320a5 lsl x5, x5, x3 140: 927ae463 and x3, x3, #0xffffffffffffffc0 144: ea0600a5 ands x5, x5, x6 148: 54000120 b.eq 16c <_find_next_bit.constprop.1+0x54> // b.none 14c: 1400000e b 184 <_find_next_bit.constprop.1+0x6c> 150: d346fc66 lsr x6, x3, #6 154: f8667805 ldr x5, [x0, x6, lsl #3] 158: b4000061 cbz x1, 164 <_find_next_bit.constprop.1+0x4c> 15c: f8667826 ldr x6, [x1, x6, lsl #3] 160: 8a0600a5 and x5, x5, x6 164: eb05009f cmp x4, x5 168: 540000c1 b.ne 180 <_find_next_bit.constprop.1+0x68> // b.any 16c: 91010063 add x3, x3, #0x40 170: eb03005f cmp x2, x3 174: 54fffee8 b.hi 150 <_find_next_bit.constprop.1+0x38> // b.pmore 178: aa0203e0 mov x0, x2 17c: d65f03c0 ret 180: ca050085 eor x5, x4, x5 184: dac000a5 rbit x5, x5 188: dac010a5 clz x5, x5 18c: 8b0300a3 add x3, x5, x3 190: eb03005f cmp x2, x3 194: 9a839042 csel x2, x2, x3, ls // ls = plast 198: aa0203e0 mov x0, x2 19c: d65f03c0 ret ... 0000000000000238 <find_next_bit>: 238: a9bf7bfd stp x29, x30, [sp, #-16]! 23c: aa0203e3 mov x3, x2 240: d2800004 mov x4, #0x0 // #0 244: aa0103e2 mov x2, x1 248: 910003fd mov x29, sp 24c: d2800001 mov x1, #0x0 // #0 250: 97ffffb2 bl 118 <_find_next_bit.constprop.1> 254: a8c17bfd ldp x29, x30, [sp], #16 258: d65f03c0 ret Enabling find_{first,next}_bit() would also benefit for_each_{set,clear}_bit(). On A-53 find_first_bit() is almost twice faster than find_next_bit(), according to lib/find_bit_benchmark (thanks to Alexey for testing): GENERIC_FIND_FIRST_BIT=n: [7126084.948181] find_first_bit: 47389224 ns, 16357 iterations [7126085.032315] find_first_bit: 19048193 ns, 655 iterations GENERIC_FIND_FIRST_BIT=y: [ 84.158068] find_first_bit: 27193319 ns, 16406 iterations [ 84.233005] find_first_bit: 11082437 ns, 656 iterations GENERIC_FIND_FIRST_BIT=n bloats the kernel despite that it disables generation of find_{first,next}_bit(): yury:linux$ scripts/bloat-o-meter vmlinux vmlinux.ffb add/remove: 4/1 grow/shrink: 19/251 up/down: 564/-1692 (-1128) ... Overall, GENERIC_FIND_FIRST_BIT=n is harmful both in terms of performance and code size, and it's better to have GENERIC_FIND_FIRST_BIT enabled. Tested-by: Alexey Klimov <aklimov@redhat.com> Signed-off-by: Yury Norov <yury.norov@gmail.com> --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 31bd885b79eb..5596eab04092 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -108,6 +108,7 @@ config ARM64 select GENERIC_CPU_AUTOPROBE select GENERIC_CPU_VULNERABILITIES select GENERIC_EARLY_IOREMAP + select GENERIC_FIND_FIRST_BIT select GENERIC_IDLE_POLL_SETUP select GENERIC_IRQ_IPI select GENERIC_IRQ_MULTI_HANDLER -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [RESEND PATCH 1/2] ARM64: enable GENERIC_FIND_FIRST_BIT 2021-02-25 13:56 ` Yury Norov @ 2021-02-25 14:02 ` Will Deacon -1 siblings, 0 replies; 20+ messages in thread From: Will Deacon @ 2021-02-25 14:02 UTC (permalink / raw) To: Yury Norov Cc: Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips On Thu, Feb 25, 2021 at 05:56:59AM -0800, Yury Norov wrote: > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 31bd885b79eb..5596eab04092 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -108,6 +108,7 @@ config ARM64 > select GENERIC_CPU_AUTOPROBE > select GENERIC_CPU_VULNERABILITIES > select GENERIC_EARLY_IOREMAP > + select GENERIC_FIND_FIRST_BIT > select GENERIC_IDLE_POLL_SETUP > select GENERIC_IRQ_IPI > select GENERIC_IRQ_MULTI_HANDLER Acked-by: Will Deacon <will@kernel.org> Catalin can pick this up later in the cycle. Will ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [RESEND PATCH 1/2] ARM64: enable GENERIC_FIND_FIRST_BIT @ 2021-02-25 14:02 ` Will Deacon 0 siblings, 0 replies; 20+ messages in thread From: Will Deacon @ 2021-02-25 14:02 UTC (permalink / raw) To: Yury Norov Cc: linux-arch, Thomas Bogendoerfer, Alexander Lobakin, Catalin Marinas, linux-kernel, linux-mips, Alexey Klimov, linux-arm-kernel On Thu, Feb 25, 2021 at 05:56:59AM -0800, Yury Norov wrote: > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 31bd885b79eb..5596eab04092 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -108,6 +108,7 @@ config ARM64 > select GENERIC_CPU_AUTOPROBE > select GENERIC_CPU_VULNERABILITIES > select GENERIC_EARLY_IOREMAP > + select GENERIC_FIND_FIRST_BIT > select GENERIC_IDLE_POLL_SETUP > select GENERIC_IRQ_IPI > select GENERIC_IRQ_MULTI_HANDLER Acked-by: Will Deacon <will@kernel.org> Catalin can pick this up later in the cycle. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [RESEND PATCH 1/2] ARM64: enable GENERIC_FIND_FIRST_BIT 2021-02-25 14:02 ` Will Deacon @ 2021-03-03 22:17 ` Yury Norov -1 siblings, 0 replies; 20+ messages in thread From: Yury Norov @ 2021-03-03 22:17 UTC (permalink / raw) To: Will Deacon Cc: Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips On Thu, Feb 25, 2021 at 02:02:06PM +0000, Will Deacon wrote: > On Thu, Feb 25, 2021 at 05:56:59AM -0800, Yury Norov wrote: > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > > index 31bd885b79eb..5596eab04092 100644 > > --- a/arch/arm64/Kconfig > > +++ b/arch/arm64/Kconfig > > @@ -108,6 +108,7 @@ config ARM64 > > select GENERIC_CPU_AUTOPROBE > > select GENERIC_CPU_VULNERABILITIES > > select GENERIC_EARLY_IOREMAP > > + select GENERIC_FIND_FIRST_BIT > > select GENERIC_IDLE_POLL_SETUP > > select GENERIC_IRQ_IPI > > select GENERIC_IRQ_MULTI_HANDLER > > Acked-by: Will Deacon <will@kernel.org> > > Catalin can pick this up later in the cycle. > > Will Ping? ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [RESEND PATCH 1/2] ARM64: enable GENERIC_FIND_FIRST_BIT @ 2021-03-03 22:17 ` Yury Norov 0 siblings, 0 replies; 20+ messages in thread From: Yury Norov @ 2021-03-03 22:17 UTC (permalink / raw) To: Will Deacon Cc: Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips On Thu, Feb 25, 2021 at 02:02:06PM +0000, Will Deacon wrote: > On Thu, Feb 25, 2021 at 05:56:59AM -0800, Yury Norov wrote: > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > > index 31bd885b79eb..5596eab04092 100644 > > --- a/arch/arm64/Kconfig > > +++ b/arch/arm64/Kconfig > > @@ -108,6 +108,7 @@ config ARM64 > > select GENERIC_CPU_AUTOPROBE > > select GENERIC_CPU_VULNERABILITIES > > select GENERIC_EARLY_IOREMAP > > + select GENERIC_FIND_FIRST_BIT > > select GENERIC_IDLE_POLL_SETUP > > select GENERIC_IRQ_IPI > > select GENERIC_IRQ_MULTI_HANDLER > > Acked-by: Will Deacon <will@kernel.org> > > Catalin can pick this up later in the cycle. > > Will Ping? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [RESEND PATCH 1/2] ARM64: enable GENERIC_FIND_FIRST_BIT 2021-03-03 22:17 ` Yury Norov @ 2021-03-05 11:20 ` Catalin Marinas -1 siblings, 0 replies; 20+ messages in thread From: Catalin Marinas @ 2021-03-05 11:20 UTC (permalink / raw) To: Yury Norov Cc: Will Deacon, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips On Wed, Mar 03, 2021 at 02:17:41PM -0800, Yury Norov wrote: > On Thu, Feb 25, 2021 at 02:02:06PM +0000, Will Deacon wrote: > > On Thu, Feb 25, 2021 at 05:56:59AM -0800, Yury Norov wrote: > > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > > > index 31bd885b79eb..5596eab04092 100644 > > > --- a/arch/arm64/Kconfig > > > +++ b/arch/arm64/Kconfig > > > @@ -108,6 +108,7 @@ config ARM64 > > > select GENERIC_CPU_AUTOPROBE > > > select GENERIC_CPU_VULNERABILITIES > > > select GENERIC_EARLY_IOREMAP > > > + select GENERIC_FIND_FIRST_BIT > > > select GENERIC_IDLE_POLL_SETUP > > > select GENERIC_IRQ_IPI > > > select GENERIC_IRQ_MULTI_HANDLER > > > > Acked-by: Will Deacon <will@kernel.org> > > > > Catalin can pick this up later in the cycle. > > > > Will > > Ping? It's on my list for 5.13 but I'll only start queuing patches after -rc3. -- Catalin ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [RESEND PATCH 1/2] ARM64: enable GENERIC_FIND_FIRST_BIT @ 2021-03-05 11:20 ` Catalin Marinas 0 siblings, 0 replies; 20+ messages in thread From: Catalin Marinas @ 2021-03-05 11:20 UTC (permalink / raw) To: Yury Norov Cc: Will Deacon, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips On Wed, Mar 03, 2021 at 02:17:41PM -0800, Yury Norov wrote: > On Thu, Feb 25, 2021 at 02:02:06PM +0000, Will Deacon wrote: > > On Thu, Feb 25, 2021 at 05:56:59AM -0800, Yury Norov wrote: > > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > > > index 31bd885b79eb..5596eab04092 100644 > > > --- a/arch/arm64/Kconfig > > > +++ b/arch/arm64/Kconfig > > > @@ -108,6 +108,7 @@ config ARM64 > > > select GENERIC_CPU_AUTOPROBE > > > select GENERIC_CPU_VULNERABILITIES > > > select GENERIC_EARLY_IOREMAP > > > + select GENERIC_FIND_FIRST_BIT > > > select GENERIC_IDLE_POLL_SETUP > > > select GENERIC_IRQ_IPI > > > select GENERIC_IRQ_MULTI_HANDLER > > > > Acked-by: Will Deacon <will@kernel.org> > > > > Catalin can pick this up later in the cycle. > > > > Will > > Ping? It's on my list for 5.13 but I'll only start queuing patches after -rc3. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/2] MIPS: enable GENERIC_FIND_FIRST_BIT 2021-02-25 13:56 ` Yury Norov @ 2021-02-25 13:57 ` Yury Norov -1 siblings, 0 replies; 20+ messages in thread From: Yury Norov @ 2021-02-25 13:57 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips Cc: Yury Norov From: Alexander Lobakin <alobakin@pm.me> MIPS doesn't have architecture-optimized bitsearching functions, like find_{first,next}_bit() etc. It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this functionality is not new at all and well-tested. It provides more optimized code and saves some .text memory (32 R2): add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156) Users of for_each_set_bit() like hotpath gic_handle_shared_int() will also benefit from this. Suggested-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Alexander Lobakin <alobakin@pm.me> Signed-off-by: Yury Norov <yury.norov@gmail.com> --- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index d89efba3d8a4..164bdd715d4b 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -26,6 +26,7 @@ config MIPS select GENERIC_ATOMIC64 if !64BIT select GENERIC_CMOS_UPDATE select GENERIC_CPU_AUTOPROBE + select GENERIC_FIND_FIRST_BIT select GENERIC_GETTIMEOFDAY select GENERIC_IOMAP select GENERIC_IRQ_PROBE -- 2.25.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/2] MIPS: enable GENERIC_FIND_FIRST_BIT @ 2021-02-25 13:57 ` Yury Norov 0 siblings, 0 replies; 20+ messages in thread From: Yury Norov @ 2021-02-25 13:57 UTC (permalink / raw) To: Will Deacon, Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips Cc: Yury Norov From: Alexander Lobakin <alobakin@pm.me> MIPS doesn't have architecture-optimized bitsearching functions, like find_{first,next}_bit() etc. It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this functionality is not new at all and well-tested. It provides more optimized code and saves some .text memory (32 R2): add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156) Users of for_each_set_bit() like hotpath gic_handle_shared_int() will also benefit from this. Suggested-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Alexander Lobakin <alobakin@pm.me> Signed-off-by: Yury Norov <yury.norov@gmail.com> --- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index d89efba3d8a4..164bdd715d4b 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -26,6 +26,7 @@ config MIPS select GENERIC_ATOMIC64 if !64BIT select GENERIC_CMOS_UPDATE select GENERIC_CPU_AUTOPROBE + select GENERIC_FIND_FIRST_BIT select GENERIC_GETTIMEOFDAY select GENERIC_IOMAP select GENERIC_IRQ_PROBE -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] MIPS: enable GENERIC_FIND_FIRST_BIT 2021-02-25 13:57 ` Yury Norov @ 2021-02-26 1:22 ` Huacai Chen -1 siblings, 0 replies; 20+ messages in thread From: Huacai Chen @ 2021-02-26 1:22 UTC (permalink / raw) To: Yury Norov Cc: Will Deacon, Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, LKML, linux-arch, open list:MIPS Hi, Yury, On Thu, Feb 25, 2021 at 9:59 PM Yury Norov <yury.norov@gmail.com> wrote: > > From: Alexander Lobakin <alobakin@pm.me> > > MIPS doesn't have architecture-optimized bitsearching functions, > like find_{first,next}_bit() etc. Emm, I think MIPS can use clo/clz to optimize bitsearching functions. Huacai > It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this > functionality is not new at all and well-tested. It provides more > optimized code and saves some .text memory (32 R2): > > add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156) > > Users of for_each_set_bit() like hotpath gic_handle_shared_int() > will also benefit from this. > > Suggested-by: Yury Norov <yury.norov@gmail.com> > Signed-off-by: Alexander Lobakin <alobakin@pm.me> > Signed-off-by: Yury Norov <yury.norov@gmail.com> > --- > arch/mips/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig > index d89efba3d8a4..164bdd715d4b 100644 > --- a/arch/mips/Kconfig > +++ b/arch/mips/Kconfig > @@ -26,6 +26,7 @@ config MIPS > select GENERIC_ATOMIC64 if !64BIT > select GENERIC_CMOS_UPDATE > select GENERIC_CPU_AUTOPROBE > + select GENERIC_FIND_FIRST_BIT > select GENERIC_GETTIMEOFDAY > select GENERIC_IOMAP > select GENERIC_IRQ_PROBE > -- > 2.25.1 > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] MIPS: enable GENERIC_FIND_FIRST_BIT @ 2021-02-26 1:22 ` Huacai Chen 0 siblings, 0 replies; 20+ messages in thread From: Huacai Chen @ 2021-02-26 1:22 UTC (permalink / raw) To: Yury Norov Cc: linux-arch, Thomas Bogendoerfer, Alexander Lobakin, Catalin Marinas, LKML, open list:MIPS, Alexey Klimov, Will Deacon, linux-arm-kernel Hi, Yury, On Thu, Feb 25, 2021 at 9:59 PM Yury Norov <yury.norov@gmail.com> wrote: > > From: Alexander Lobakin <alobakin@pm.me> > > MIPS doesn't have architecture-optimized bitsearching functions, > like find_{first,next}_bit() etc. Emm, I think MIPS can use clo/clz to optimize bitsearching functions. Huacai > It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this > functionality is not new at all and well-tested. It provides more > optimized code and saves some .text memory (32 R2): > > add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156) > > Users of for_each_set_bit() like hotpath gic_handle_shared_int() > will also benefit from this. > > Suggested-by: Yury Norov <yury.norov@gmail.com> > Signed-off-by: Alexander Lobakin <alobakin@pm.me> > Signed-off-by: Yury Norov <yury.norov@gmail.com> > --- > arch/mips/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig > index d89efba3d8a4..164bdd715d4b 100644 > --- a/arch/mips/Kconfig > +++ b/arch/mips/Kconfig > @@ -26,6 +26,7 @@ config MIPS > select GENERIC_ATOMIC64 if !64BIT > select GENERIC_CMOS_UPDATE > select GENERIC_CPU_AUTOPROBE > + select GENERIC_FIND_FIRST_BIT > select GENERIC_GETTIMEOFDAY > select GENERIC_IOMAP > select GENERIC_IRQ_PROBE > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] MIPS: enable GENERIC_FIND_FIRST_BIT 2021-02-26 1:22 ` Huacai Chen @ 2021-02-26 4:07 ` Yury Norov -1 siblings, 0 replies; 20+ messages in thread From: Yury Norov @ 2021-02-26 4:07 UTC (permalink / raw) To: Huacai Chen Cc: Will Deacon, Catalin Marinas, Thomas Bogendoerfer, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, LKML, linux-arch, open list:MIPS On Fri, Feb 26, 2021 at 09:22:18AM +0800, Huacai Chen wrote: > Hi, Yury, > > On Thu, Feb 25, 2021 at 9:59 PM Yury Norov <yury.norov@gmail.com> wrote: > > > > From: Alexander Lobakin <alobakin@pm.me> > > > > MIPS doesn't have architecture-optimized bitsearching functions, > > like find_{first,next}_bit() etc. > Emm, I think MIPS can use clo/clz to optimize bitsearching functions. find_{first,next}_bit() is about manipulating the bitmaps bigger that a single word, and some arches (arm) implement their own find_bit() functions. find_bit() is not a replacement of __ffs() and ffz(). > Huacai > > > It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this > > functionality is not new at all and well-tested. It provides more > > optimized code and saves some .text memory (32 R2): > > > > add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156) > > > > Users of for_each_set_bit() like hotpath gic_handle_shared_int() > > will also benefit from this. > > > > Suggested-by: Yury Norov <yury.norov@gmail.com> > > Signed-off-by: Alexander Lobakin <alobakin@pm.me> > > Signed-off-by: Yury Norov <yury.norov@gmail.com> > > --- > > arch/mips/Kconfig | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig > > index d89efba3d8a4..164bdd715d4b 100644 > > --- a/arch/mips/Kconfig > > +++ b/arch/mips/Kconfig > > @@ -26,6 +26,7 @@ config MIPS > > select GENERIC_ATOMIC64 if !64BIT > > select GENERIC_CMOS_UPDATE > > select GENERIC_CPU_AUTOPROBE > > + select GENERIC_FIND_FIRST_BIT > > select GENERIC_GETTIMEOFDAY > > select GENERIC_IOMAP > > select GENERIC_IRQ_PROBE > > -- > > 2.25.1 > > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] MIPS: enable GENERIC_FIND_FIRST_BIT @ 2021-02-26 4:07 ` Yury Norov 0 siblings, 0 replies; 20+ messages in thread From: Yury Norov @ 2021-02-26 4:07 UTC (permalink / raw) To: Huacai Chen Cc: linux-arch, Thomas Bogendoerfer, Alexander Lobakin, Catalin Marinas, LKML, open list:MIPS, Alexey Klimov, Will Deacon, linux-arm-kernel On Fri, Feb 26, 2021 at 09:22:18AM +0800, Huacai Chen wrote: > Hi, Yury, > > On Thu, Feb 25, 2021 at 9:59 PM Yury Norov <yury.norov@gmail.com> wrote: > > > > From: Alexander Lobakin <alobakin@pm.me> > > > > MIPS doesn't have architecture-optimized bitsearching functions, > > like find_{first,next}_bit() etc. > Emm, I think MIPS can use clo/clz to optimize bitsearching functions. find_{first,next}_bit() is about manipulating the bitmaps bigger that a single word, and some arches (arm) implement their own find_bit() functions. find_bit() is not a replacement of __ffs() and ffz(). > Huacai > > > It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this > > functionality is not new at all and well-tested. It provides more > > optimized code and saves some .text memory (32 R2): > > > > add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156) > > > > Users of for_each_set_bit() like hotpath gic_handle_shared_int() > > will also benefit from this. > > > > Suggested-by: Yury Norov <yury.norov@gmail.com> > > Signed-off-by: Alexander Lobakin <alobakin@pm.me> > > Signed-off-by: Yury Norov <yury.norov@gmail.com> > > --- > > arch/mips/Kconfig | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig > > index d89efba3d8a4..164bdd715d4b 100644 > > --- a/arch/mips/Kconfig > > +++ b/arch/mips/Kconfig > > @@ -26,6 +26,7 @@ config MIPS > > select GENERIC_ATOMIC64 if !64BIT > > select GENERIC_CMOS_UPDATE > > select GENERIC_CPU_AUTOPROBE > > + select GENERIC_FIND_FIRST_BIT > > select GENERIC_GETTIMEOFDAY > > select GENERIC_IOMAP > > select GENERIC_IRQ_PROBE > > -- > > 2.25.1 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] MIPS: enable GENERIC_FIND_FIRST_BIT 2021-02-25 13:57 ` Yury Norov @ 2021-03-01 14:49 ` Thomas Bogendoerfer -1 siblings, 0 replies; 20+ messages in thread From: Thomas Bogendoerfer @ 2021-03-01 14:49 UTC (permalink / raw) To: Yury Norov Cc: Will Deacon, Catalin Marinas, Alexander Lobakin, Alexey Klimov, linux-arm-kernel, linux-kernel, linux-arch, linux-mips On Thu, Feb 25, 2021 at 05:57:00AM -0800, Yury Norov wrote: > From: Alexander Lobakin <alobakin@pm.me> > > MIPS doesn't have architecture-optimized bitsearching functions, > like find_{first,next}_bit() etc. > It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this > functionality is not new at all and well-tested. It provides more > optimized code and saves some .text memory (32 R2): > > add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156) > > Users of for_each_set_bit() like hotpath gic_handle_shared_int() > will also benefit from this. > > Suggested-by: Yury Norov <yury.norov@gmail.com> > Signed-off-by: Alexander Lobakin <alobakin@pm.me> > Signed-off-by: Yury Norov <yury.norov@gmail.com> > --- > arch/mips/Kconfig | 1 + > 1 file changed, 1 insertion(+) applied to mips-next. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ] ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] MIPS: enable GENERIC_FIND_FIRST_BIT @ 2021-03-01 14:49 ` Thomas Bogendoerfer 0 siblings, 0 replies; 20+ messages in thread From: Thomas Bogendoerfer @ 2021-03-01 14:49 UTC (permalink / raw) To: Yury Norov Cc: linux-arch, Alexander Lobakin, Catalin Marinas, linux-kernel, linux-mips, Alexey Klimov, Will Deacon, linux-arm-kernel On Thu, Feb 25, 2021 at 05:57:00AM -0800, Yury Norov wrote: > From: Alexander Lobakin <alobakin@pm.me> > > MIPS doesn't have architecture-optimized bitsearching functions, > like find_{first,next}_bit() etc. > It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this > functionality is not new at all and well-tested. It provides more > optimized code and saves some .text memory (32 R2): > > add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156) > > Users of for_each_set_bit() like hotpath gic_handle_shared_int() > will also benefit from this. > > Suggested-by: Yury Norov <yury.norov@gmail.com> > Signed-off-by: Alexander Lobakin <alobakin@pm.me> > Signed-off-by: Yury Norov <yury.norov@gmail.com> > --- > arch/mips/Kconfig | 1 + > 1 file changed, 1 insertion(+) applied to mips-next. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: (subset) [PATCH 0/2] arch: enable GENERIC_FIND_FIRST_BIT for MIPS and ARM64 2021-02-25 13:56 ` Yury Norov @ 2021-03-15 19:14 ` Catalin Marinas -1 siblings, 0 replies; 20+ messages in thread From: Catalin Marinas @ 2021-03-15 19:14 UTC (permalink / raw) To: linux-mips, linux-kernel, Yury Norov, linux-arm-kernel, Alexey Klimov, linux-arch, Will Deacon, Alexander Lobakin, Thomas Bogendoerfer On Thu, 25 Feb 2021 05:56:58 -0800, Yury Norov wrote: > MIPS and ARM64 don't implement find_first_{zero}_bit in arch code and > don't enable it in config. It leads to using find_next_bit() which is > less efficient: > > It's beneficial to enable GENERIC_FIND_FIRST_BIT as this functionality > is not new at all and well-tested. It provides more optimized code and > saves .text memory: > > [...] Applied to arm64 (for-next/misc), thanks! [1/2] ARM64: enable GENERIC_FIND_FIRST_BIT https://git.kernel.org/arm64/c/98c5ec77c7c5 -- Catalin ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: (subset) [PATCH 0/2] arch: enable GENERIC_FIND_FIRST_BIT for MIPS and ARM64 @ 2021-03-15 19:14 ` Catalin Marinas 0 siblings, 0 replies; 20+ messages in thread From: Catalin Marinas @ 2021-03-15 19:14 UTC (permalink / raw) To: linux-mips, linux-kernel, Yury Norov, linux-arm-kernel, Alexey Klimov, linux-arch, Will Deacon, Alexander Lobakin, Thomas Bogendoerfer On Thu, 25 Feb 2021 05:56:58 -0800, Yury Norov wrote: > MIPS and ARM64 don't implement find_first_{zero}_bit in arch code and > don't enable it in config. It leads to using find_next_bit() which is > less efficient: > > It's beneficial to enable GENERIC_FIND_FIRST_BIT as this functionality > is not new at all and well-tested. It provides more optimized code and > saves .text memory: > > [...] Applied to arm64 (for-next/misc), thanks! [1/2] ARM64: enable GENERIC_FIND_FIRST_BIT https://git.kernel.org/arm64/c/98c5ec77c7c5 -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2021-03-15 19:15 UTC | newest] Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-02-25 13:56 [PATCH 0/2] arch: enable GENERIC_FIND_FIRST_BIT for MIPS and ARM64 Yury Norov 2021-02-25 13:56 ` Yury Norov 2021-02-25 13:56 ` [RESEND PATCH 1/2] ARM64: enable GENERIC_FIND_FIRST_BIT Yury Norov 2021-02-25 13:56 ` Yury Norov 2021-02-25 14:02 ` Will Deacon 2021-02-25 14:02 ` Will Deacon 2021-03-03 22:17 ` Yury Norov 2021-03-03 22:17 ` Yury Norov 2021-03-05 11:20 ` Catalin Marinas 2021-03-05 11:20 ` Catalin Marinas 2021-02-25 13:57 ` [PATCH 2/2] MIPS: " Yury Norov 2021-02-25 13:57 ` Yury Norov 2021-02-26 1:22 ` Huacai Chen 2021-02-26 1:22 ` Huacai Chen 2021-02-26 4:07 ` Yury Norov 2021-02-26 4:07 ` Yury Norov 2021-03-01 14:49 ` Thomas Bogendoerfer 2021-03-01 14:49 ` Thomas Bogendoerfer 2021-03-15 19:14 ` (subset) [PATCH 0/2] arch: enable GENERIC_FIND_FIRST_BIT for MIPS and ARM64 Catalin Marinas 2021-03-15 19:14 ` Catalin Marinas
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.