Re: [PATCH 00/11] ARC atomics update
On Thu, Aug 05, 2021 at 07:04:32PM +0200, Peter Zijlstra wrote: > On Thu, Aug 05, 2021 at 04:18:29PM +, Vineet Gupta wrote: > > On 8/5/21 2:02 AM, Peter Zijlstra wrote: > > > On Wed, Aug 04, 2021 at 12:15:43PM -0700, Vineet Gupta wrote: > > > > > >> Vineet Gupta (10): > > >>ARC: atomics: disintegrate header > > >>ARC: atomic: !LLSC: remove hack in atomic_set() for for UP > > >>ARC: atomic: !LLSC: use int data type consistently > > >>ARC: atomic64: LLSC: elide unused atomic_{and,or,xor,andnot}_return > > >>ARC: atomics: implement relaxed variants > > >>ARC: bitops: fls/ffs to take int (vs long) per asm-generic defines > > >>ARC: xchg: !LLSC: remove UP micro-optimization/hack > > >>ARC: cmpxchg/xchg: rewrite as macros to make type safe > > >>ARC: cmpxchg/xchg: implement relaxed variants (LLSC config only) > > >>ARC: atomic_cmpxchg/atomic_xchg: implement relaxed variants > > >> > > >> Will Deacon (1): > > >>ARC: switch to generic bitops > > > > > > Didn't see any weird things: > > > > > > Acked-by: Peter Zijlstra (Intel) > > > > Thx Peter. A lot of this is your code anyways ;-) > > > > Any initial thoughts/comments on patch 06/11 - is there an obvious > > reason that generic bitops take signed @nr or the hurdle is need to be > > done consistently cross-arch. > > That does indeed seem daft and ready for a cleanup. Will any > recollection from when you touched this? I had a patch to fix this but it blew up in the robot and I didn't get round to reworking it: https://lore.kernel.org/patchwork/patch/124/ Will ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[arc:topic-mmu 27/32] arch/arc/include/asm/hugepage.h:29:36: error: implicit declaration of function 'pte_mknotpresent'; did you mean 'pte_present'?
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git topic-mmu head: aad84191703280f0aace986bff0afd917b77511e commit: 9832faa2ca147e7d3fa551f7cc43df19cf569111 [27/32] ARC: mm: remove unused pte accessors config: arc-allyesconfig (attached as .config) compiler: arceb-elf-gcc (GCC) 10.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git/commit/?id=9832faa2ca147e7d3fa551f7cc43df19cf569111 git remote add arc https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git git fetch --no-tags arc topic-mmu git checkout 9832faa2ca147e7d3fa551f7cc43df19cf569111 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from arch/arc/include/asm/bug.h:30, from include/linux/bug.h:5, from include/linux/mmdebug.h:5, from include/linux/gfp.h:5, from mm/debug_vm_pgtable.c:13: mm/debug_vm_pgtable.c: In function 'pmd_thp_tests': >> arch/arc/include/asm/hugepage.h:29:36: error: implicit declaration of >> function 'pte_mknotpresent'; did you mean 'pte_present'? >> [-Werror=implicit-function-declaration] 29 | #define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd))) |^~~~ include/asm-generic/bug.h:121:25: note: in definition of macro 'WARN_ON' 121 | int __ret_warn_on = !!(condition);\ | ^ include/asm-generic/pgtable-nop4d.h:40:24: note: in expansion of macro 'pgd_val' 40 | #define p4d_val(x)(pgd_val((x).pgd)) |^~~ include/asm-generic/pgtable-nopud.h:48:24: note: in expansion of macro 'p4d_val' 48 | #define pud_val(x)(p4d_val((x).p4d)) |^~~ include/asm-generic/pgtable-nopmd.h:50:24: note: in expansion of macro 'pud_val' 50 | #define pmd_val(x)(pud_val((x).pud)) |^~~ arch/arc/include/asm/hugepage.h:39:30: note: in expansion of macro 'pmd_val' 39 | #define pmd_trans_huge(pmd) (pmd_val(pmd) & _PAGE_HW_SZ) | ^~~ mm/debug_vm_pgtable.c:913:11: note: in expansion of macro 'pmd_trans_huge' 913 | WARN_ON(!pmd_trans_huge(pmd_mkinvalid(pmd_mkhuge(pmd; | ^~ mm/debug_vm_pgtable.c:913:26: note: in expansion of macro 'pmd_mkinvalid' 913 | WARN_ON(!pmd_trans_huge(pmd_mkinvalid(pmd_mkhuge(pmd; | ^ >> arch/arc/include/asm/hugepage.h:29:36: error: incompatible type for argument >> 1 of 'pte_pmd' 29 | #define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd))) |^~ || |int include/asm-generic/bug.h:121:25: note: in definition of macro 'WARN_ON' 121 | int __ret_warn_on = !!(condition);\ | ^ include/asm-generic/pgtable-nop4d.h:40:24: note: in expansion of macro 'pgd_val' 40 | #define p4d_val(x)(pgd_val((x).pgd)) |^~~ include/asm-generic/pgtable-nopud.h:48:24: note: in expansion of macro 'p4d_val' 48 | #define pud_val(x)(p4d_val((x).p4d)) |^~~ include/asm-generic/pgtable-nopmd.h:50:24: note: in expansion of macro 'pud_val' 50 | #define pmd_val(x)(pud_val((x).pud)) |^~~ arch/arc/include/asm/hugepage.h:39:30: note: in expansion of macro 'pmd_val' 39 | #define pmd_trans_huge(pmd) (pmd_val(pmd) & _PAGE_HW_SZ) | ^~~ mm/debug_vm_pgtable.c:913:11: note: in expansion of macro 'pmd_trans_huge' 913 | WARN_ON(!pmd_trans_huge(pmd_mkinvalid(pmd_mkhuge(pmd; | ^~ mm/debug_vm_pgtable.c:913:26: note: in expansion of macro 'pmd_mkinvalid' 913 | WARN_ON(!pmd_trans_huge(pmd_mkinvalid(pmd_mkhuge(pmd; | ^ In file included from arch/arc/include/asm/pgtable-bits-arcv2.h:145, from arch/arc/include/asm/pgtable.h:12, from include/linux/pgtable.h:6, from include/linux/mm.h:33, from include/linux/highmem.h:8, from mm/debug_vm_pgtable.c:14: arch/arc/include/asm/hugepa
Re: [RFC] bitops/non-atomic: make @nr unsigned to avoid any DIV
On Thu, Aug 05, 2021 at 12:14:08PM -0700, Vineet Gupta wrote: > signed math causes generation of costlier instructions such as DIV when > they could be done by barrerl shifter. > > Worse part is this is not caught by things like bloat-o-meter since > instruction length / symbols are typically same size. > > e.g. > > stock (signed math) > __ > > 919b4614 : > 919b4614: div r2,r0,0x20 > ^^^ > 919b4618: add2r2,0x920f6050,r2 > 919b4620: ld_sr2,[r2,0] > 919b4622: lsr r0,r2,r0 > 919b4626: j_s.d [blink] > 919b4628: bmsk_s r0,r0,0 > 919b462a: nop_s > > (patched) unsigned math > __ > > 919b4614 : > 919b4614: lsr r2,r0,0x5 @nr/32 > ^^^ > 919b4618: add2r2,0x920f6050,r2 > 919b4620: ld_sr2,[r2,0] > 919b4622: lsr r0,r2,r0 #test_bit() > 919b4626: j_s.d [blink] > 919b4628: bmsk_s r0,r0,0 > 919b462a: nop_s Just FYI, but on arm64 the existing codegen is alright as we have both arithmetic and logical shifts. > Signed-off-by: Vineet Gupta > --- > This is an RFC for feeback, I understand this impacts every arch, > but as of now it is only buld/run tested on ARC. > --- > --- > include/asm-generic/bitops/non-atomic.h | 14 +++--- > 1 file changed, 7 insertions(+), 7 deletions(-) Acked-by: Will Deacon We should really move test_bit() into the atomic header, but I failed to fix the resulting include mess last time I tried that. Will ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [RFC] bitops/non-atomic: make @nr unsigned to avoid any DIV
On 8/6/21 6:42 AM, Will Deacon wrote: > On Thu, Aug 05, 2021 at 12:14:08PM -0700, Vineet Gupta wrote: >> signed math causes generation of costlier instructions such as DIV when >> they could be done by barrerl shifter. >> >> Worse part is this is not caught by things like bloat-o-meter since >> instruction length / symbols are typically same size. >> >> e.g. >> >> stock (signed math) >> __ >> >> 919b4614 : >> 919b4614:div r2,r0,0x20 >> ^^^ >> 919b4618:add2r2,0x920f6050,r2 >> 919b4620:ld_sr2,[r2,0] >> 919b4622:lsr r0,r2,r0 >> 919b4626:j_s.d [blink] >> 919b4628:bmsk_s r0,r0,0 >> 919b462a:nop_s >> >> (patched) unsigned math >> __ >> >> 919b4614 : >> 919b4614:lsr r2,r0,0x5 @nr/32 >> ^^^ >> 919b4618:add2r2,0x920f6050,r2 >> 919b4620:ld_sr2,[r2,0] >> 919b4622:lsr r0,r2,r0 #test_bit() >> 919b4626:j_s.d [blink] >> 919b4628:bmsk_s r0,r0,0 >> 919b462a:nop_s > Just FYI, but on arm64 the existing codegen is alright as we have both > arithmetic and logical shifts. ARC does too: There's LSR (Logical shift right) and ASR (Arithmetic Shift Right). So perhaps something to be done in the compiler. >> Signed-off-by: Vineet Gupta >> --- >> This is an RFC for feeback, I understand this impacts every arch, >> but as of now it is only buld/run tested on ARC. >> --- >> --- >> include/asm-generic/bitops/non-atomic.h | 14 +++--- >> 1 file changed, 7 insertions(+), 7 deletions(-) > Acked-by: Will Deacon > > We should really move test_bit() into the atomic header, but I failed to fix > the resulting include mess last time I tried that. OK I'll give it a try too. ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [arc:topic-mmu 27/32] arch/arc/include/asm/hugepage.h:29:36: error: implicit declaration of function 'pte_mknotpresent'; did you mean 'pte_present'?
On 8/6/21 6:38 AM, kernel test robot wrote: > tree: > https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git__;!!A4F2R9G_pg!JkynKBqZimbhej1a4Vdszp5CSFVPGZRDksLBzwDbrZhdmsyGKSOySAh_3Qh53SoH$ > topic-mmu > head: aad84191703280f0aace986bff0afd917b77511e > commit: 9832faa2ca147e7d3fa551f7cc43df19cf569111 [27/32] ARC: mm: remove > unused pte accessors > config: arc-allyesconfig (attached as .config) > compiler: arceb-elf-gcc (GCC) 10.3.0 > reproduce (this is a W=1 build): > wget > https://urldefense.com/v3/__https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross__;!!A4F2R9G_pg!JkynKBqZimbhej1a4Vdszp5CSFVPGZRDksLBzwDbrZhdmsyGKSOySAh_3VPXG8J4$ > -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # > https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git/commit/?id=9832faa2ca147e7d3fa551f7cc43df19cf569111__;!!A4F2R9G_pg!JkynKBqZimbhej1a4Vdszp5CSFVPGZRDksLBzwDbrZhdmsyGKSOySAh_3bcRVHFe$ > git remote add arc > https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git__;!!A4F2R9G_pg!JkynKBqZimbhej1a4Vdszp5CSFVPGZRDksLBzwDbrZhdmsyGKSOySAh_3Qh53SoH$ > git fetch --no-tags arc topic-mmu > git checkout 9832faa2ca147e7d3fa551f7cc43df19cf569111 > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross > ARCH=arc > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot Thanks for this report. I love this testing. I wish I could buy you guys a beer (or a beverage of choice !) I've added the Reported-by tag for the ensuing fix. -Vineet > > All errors (new ones prefixed by >>): > > In file included from arch/arc/include/asm/bug.h:30, > from include/linux/bug.h:5, > from include/linux/mmdebug.h:5, > from include/linux/gfp.h:5, > from mm/debug_vm_pgtable.c:13: > mm/debug_vm_pgtable.c: In function 'pmd_thp_tests': >>> arch/arc/include/asm/hugepage.h:29:36: error: implicit declaration of >>> function 'pte_mknotpresent'; did you mean 'pte_present'? >>> [-Werror=implicit-function-declaration] >29 | #define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd))) > |^~~~ > include/asm-generic/bug.h:121:25: note: in definition of macro 'WARN_ON' > 121 | int __ret_warn_on = !!(condition);\ > | ^ > include/asm-generic/pgtable-nop4d.h:40:24: note: in expansion of macro > 'pgd_val' >40 | #define p4d_val(x)(pgd_val((x).pgd)) > |^~~ > include/asm-generic/pgtable-nopud.h:48:24: note: in expansion of macro > 'p4d_val' >48 | #define pud_val(x)(p4d_val((x).p4d)) > |^~~ > include/asm-generic/pgtable-nopmd.h:50:24: note: in expansion of macro > 'pud_val' >50 | #define pmd_val(x)(pud_val((x).pud)) > |^~~ > arch/arc/include/asm/hugepage.h:39:30: note: in expansion of macro > 'pmd_val' >39 | #define pmd_trans_huge(pmd) (pmd_val(pmd) & _PAGE_HW_SZ) > | ^~~ > mm/debug_vm_pgtable.c:913:11: note: in expansion of macro 'pmd_trans_huge' > 913 | WARN_ON(!pmd_trans_huge(pmd_mkinvalid(pmd_mkhuge(pmd; > | ^~ > mm/debug_vm_pgtable.c:913:26: note: in expansion of macro 'pmd_mkinvalid' > 913 | WARN_ON(!pmd_trans_huge(pmd_mkinvalid(pmd_mkhuge(pmd; > | ^ >>> arch/arc/include/asm/hugepage.h:29:36: error: incompatible type for >>> argument 1 of 'pte_pmd' >29 | #define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd))) > |^~ > || > |int > include/asm-generic/bug.h:121:25: note: in definition of macro 'WARN_ON' > 121 | int __ret_warn_on = !!(condition);\ > | ^ > include/asm-generic/pgtable-nop4d.h:40:24: note: in expansion of macro > 'pgd_val' >40 | #define p4d_val(x)(pgd_val((x).pgd)) > |^~~ > include/asm-generic/pgtable-nopud.h:48:24: note: in expansion of macro > 'p4d_val' >48 | #define pud_val(x)(p4d_val((x).p4d)) > |^~~ > include/asm-generic/pgtable-nopmd.h:50:24: note: in expansion of macro > 'pud_val' >50 | #define pmd_val(x)(pud_val((x).pud)) > |^~~ > arch/arc/include/asm/hugepage.h:39:30: note: in expansion of macr