mbox series

[0/2] Allow assembly code to use BIT(), GENMASK(), etc. and clean-up arm64 header

Message ID 20190527083412.26651-1-yamada.masahiro@socionext.com
Headers show
Series Allow assembly code to use BIT(), GENMASK(), etc. and clean-up arm64 header | expand

Message

Masahiro Yamada May 27, 2019, 8:34 a.m. UTC
Some in-kernel headers use _BITUL() instead of BIT().

 arch/arm64/include/asm/sysreg.h
 arch/s390/include/asm/*.h

I think the reason is because BIT() is currently not available
in assembly. It hard-codes 1UL, which is not available in assembly.

1/2 replaced
   1UL -> UL(1)
   0UL -> UL(0)
   1ULL -> ULL(1)
   0ULL -> ULL(0)

With this, there is no more restriction that prevents assembly
code from using them.

2/2 is a clean-up as as example.

I can contribute to cleanups of arch/s390/, etc.
once this series lands in upstream.

I hope both patches can go in the arm64 tree.



Masahiro Yamada (2):
  linux/bits.h: make BIT(), GENMASK(), and friends available in assembly
  arm64: replace _BITUL() with BIT()

 arch/arm64/include/asm/sysreg.h | 82 ++++++++++++++++-----------------
 include/linux/bits.h            | 17 ++++---
 2 files changed, 51 insertions(+), 48 deletions(-)

-- 
2.17.1

Comments

Masahiro Yamada June 5, 2019, 6:19 a.m. UTC | #1
Hi Will,

Is this series applicable to arm64 tree?

Thanks.

On Mon, May 27, 2019 at 5:37 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>

>

> Some in-kernel headers use _BITUL() instead of BIT().

>

>  arch/arm64/include/asm/sysreg.h

>  arch/s390/include/asm/*.h

>

> I think the reason is because BIT() is currently not available

> in assembly. It hard-codes 1UL, which is not available in assembly.

>

> 1/2 replaced

>    1UL -> UL(1)

>    0UL -> UL(0)

>    1ULL -> ULL(1)

>    0ULL -> ULL(0)

>

> With this, there is no more restriction that prevents assembly

> code from using them.

>

> 2/2 is a clean-up as as example.

>

> I can contribute to cleanups of arch/s390/, etc.

> once this series lands in upstream.

>

> I hope both patches can go in the arm64 tree.

>

>

>

> Masahiro Yamada (2):

>   linux/bits.h: make BIT(), GENMASK(), and friends available in assembly

>   arm64: replace _BITUL() with BIT()

>

>  arch/arm64/include/asm/sysreg.h | 82 ++++++++++++++++-----------------

>  include/linux/bits.h            | 17 ++++---

>  2 files changed, 51 insertions(+), 48 deletions(-)

>

> --

> 2.17.1

>



-- 
Best Regards
Masahiro Yamada
Catalin Marinas June 5, 2019, 7:34 a.m. UTC | #2
On Mon, May 27, 2019 at 05:34:10PM +0900, Masahiro Yamada wrote:
> Some in-kernel headers use _BITUL() instead of BIT().

> 

>  arch/arm64/include/asm/sysreg.h

>  arch/s390/include/asm/*.h

> 

> I think the reason is because BIT() is currently not available

> in assembly. It hard-codes 1UL, which is not available in assembly.

[...]
> Masahiro Yamada (2):

>   linux/bits.h: make BIT(), GENMASK(), and friends available in assembly

>   arm64: replace _BITUL() with BIT()

> 

>  arch/arm64/include/asm/sysreg.h | 82 ++++++++++++++++-----------------

>  include/linux/bits.h            | 17 ++++---


I'm not sure it's worth the hassle. It's nice to have the same BIT macro
but a quick grep shows arc, arm64, s390 and x86 using _BITUL. Maybe a
tree-wide clean-up would be more appropriate.

-- 
Catalin
Masahiro Yamada June 5, 2019, 9:01 a.m. UTC | #3
On Wed, Jun 5, 2019 at 4:36 PM Catalin Marinas <catalin.marinas@arm.com> wrote:
>

> On Mon, May 27, 2019 at 05:34:10PM +0900, Masahiro Yamada wrote:

> > Some in-kernel headers use _BITUL() instead of BIT().

> >

> >  arch/arm64/include/asm/sysreg.h

> >  arch/s390/include/asm/*.h

> >

> > I think the reason is because BIT() is currently not available

> > in assembly. It hard-codes 1UL, which is not available in assembly.

> [...]

> > Masahiro Yamada (2):

> >   linux/bits.h: make BIT(), GENMASK(), and friends available in assembly

> >   arm64: replace _BITUL() with BIT()

> >

> >  arch/arm64/include/asm/sysreg.h | 82 ++++++++++++++++-----------------

> >  include/linux/bits.h            | 17 ++++---

>

> I'm not sure it's worth the hassle. It's nice to have the same BIT macro

> but a quick grep shows arc, arm64, s390 and x86 using _BITUL. Maybe a

> tree-wide clean-up would be more appropriate.



I am happy to clean-up the others
in the next development cycle
once 1/2 lands in the mainline.


Since there is no subsystem that
takes care of include/linux/bits.h,
I just asked Will to pick up both.
I planed per-arch patch submission
to reduce the possibility of merge conflict.


If you guys are not willing to pick up them,
is it better to send treewide conversion to Andrew?


-- 
Best Regards
Masahiro Yamada
Will Deacon June 11, 2019, 3:49 p.m. UTC | #4
On Wed, Jun 05, 2019 at 06:01:10PM +0900, Masahiro Yamada wrote:
> On Wed, Jun 5, 2019 at 4:36 PM Catalin Marinas <catalin.marinas@arm.com> wrote:

> >

> > On Mon, May 27, 2019 at 05:34:10PM +0900, Masahiro Yamada wrote:

> > > Some in-kernel headers use _BITUL() instead of BIT().

> > >

> > >  arch/arm64/include/asm/sysreg.h

> > >  arch/s390/include/asm/*.h

> > >

> > > I think the reason is because BIT() is currently not available

> > > in assembly. It hard-codes 1UL, which is not available in assembly.

> > [...]

> > > Masahiro Yamada (2):

> > >   linux/bits.h: make BIT(), GENMASK(), and friends available in assembly

> > >   arm64: replace _BITUL() with BIT()

> > >

> > >  arch/arm64/include/asm/sysreg.h | 82 ++++++++++++++++-----------------

> > >  include/linux/bits.h            | 17 ++++---

> >

> > I'm not sure it's worth the hassle. It's nice to have the same BIT macro

> > but a quick grep shows arc, arm64, s390 and x86 using _BITUL. Maybe a

> > tree-wide clean-up would be more appropriate.

> 

> 

> I am happy to clean-up the others

> in the next development cycle

> once 1/2 lands in the mainline.

> 

> 

> Since there is no subsystem that

> takes care of include/linux/bits.h,

> I just asked Will to pick up both.

> I planed per-arch patch submission

> to reduce the possibility of merge conflict.

> 

> 

> If you guys are not willing to pick up them,

> is it better to send treewide conversion to Andrew?


I'm happy either way, so I've acked both of the patches.

Will