2017-08-10 08:43:17

by Kaushik Phatak

[permalink] [raw]
Subject: [PATCH] Unifying headers for AArch64 and ARM

Hi,
This patch is an attempt to unify the kernel header files for AArch64
and ARM. We have developed similar patch for glibc, which unifies the
headers in sysdeps. We plan to post that separately to libc-alpha.

This developed patch is similar to something that X86 does with the
macros (__x86_64__) and (__ILP32__).

We have noticed some activity in this area in recent times,
Linux patches by Yury Norov:
[07/20] arm64:uapi: set __BITS_PER_LONG correctly for ILP32 and LP64
https://patchwork.kernel.org/patch/9599053/

Glibc patches by Yury Norov (part of glibc-2.25):
[PATCH 13/27] [AARCH64] Set up wordsize for ILP32.
https://sourceware.org/ml/libc-alpha/2016-06/msg00750.html
and other similar patches for AARCH64

The idea is to have aarch64 work with the 32-bit systems, so the
toolchain can detect the correct macros like WORDSIZE irrespective
of the architecture.
The main issue here is that 32 and 64 bit ARM are in distinct folders
unlike X86, hence the changes are fairly extensive.

I have attached a patch here that attempts to do this. This is a
fairly large patch (~2K lines) so I can split it up if required.
Can someone provide any feedback on this approach for unifying the
headers via patch, or having a single folder like X86 to do the job?

Best Regards,
Kaushik M. Phatak

This message contains information that may be privileged or confidential and is the property of the KPIT Technologies Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Technologies Ltd. does not accept any liability for virus infected mails.


Attachments:
arm_aarch64_unify.diff (78.56 kB)
arm_aarch64_unify.diff

2017-09-01 12:24:16

by Kaushik Phatak

[permalink] [raw]
Subject: RE: [PATCH] Unifying headers for AArch64 and ARM

Ping for this patch:
https://lkml.org/lkml/2017/8/10/136

The patch can be viewed on the mail-archive link below,
https://www.mail-archive.com/[email protected]/msg1465874.html

Please let me know if anyone has any feedback on this.
Thanks.

Best Regards,
Kaushik M. Phatak

-----Original Message-----
From: Kaushik Phatak
Sent: Thursday, August 10, 2017 2:12 PM
To: '[email protected]' <[email protected]>
Subject: [PATCH] Unifying headers for AArch64 and ARM

Hi,
This patch is an attempt to unify the kernel header files for AArch64 and ARM. We have developed similar patch for glibc, which unifies the headers in sysdeps. We plan to post that separately to libc-alpha.

This developed patch is similar to something that X86 does with the macros (__x86_64__) and (__ILP32__).

We have noticed some activity in this area in recent times, Linux patches by Yury Norov:
[07/20] arm64:uapi: set __BITS_PER_LONG correctly for ILP32 and LP64 https://patchwork.kernel.org/patch/9599053/

This message contains information that may be privileged or confidential and is the property of the KPIT Technologies Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Technologies Ltd. does not accept any liability for virus infected mails.

2017-09-04 12:24:10

by Yury Norov

[permalink] [raw]
Subject: Re: [PATCH] Unifying headers for AArch64 and ARM

Hi Kaushik,

(CC arm and arch maintainers)

On Fri, Sep 01, 2017 at 12:24:08PM +0000, Kaushik Phatak wrote:
> Ping for this patch:
> https://lkml.org/lkml/2017/8/10/136
>
> The patch can be viewed on the mail-archive link below,
> https://www.mail-archive.com/[email protected]/msg1465874.html
>
> Please let me know if anyone has any feedback on this.
> Thanks.
>
> Best Regards,
> Kaushik M. Phatak
>
> -----Original Message-----
> From: Kaushik Phatak
> Sent: Thursday, August 10, 2017 2:12 PM
> To: '[email protected]' <[email protected]>
> Subject: [PATCH] Unifying headers for AArch64 and ARM
>
> Hi,
> This patch is an attempt to unify the kernel header files for AArch64 and ARM.
> We have developed similar patch for glibc, which unifies the headers in sysdeps.
> We plan to post that separately to libc-alpha.
>
> This developed patch is similar to something that X86 does with the macros
> (__x86_64__) and (__ILP32__).

scripts/checkpatch.pl reports 30 errors and 24 warnings on your patch.
Also, you didn't CC maintainers, so they most probably missed your
patch in LKML noise. I CCed some of them here.
scripts/get_maintainers.pl should point you to proper persons.

> We have noticed some activity in this area in recent times, Linux patches by Yury Norov:
> [07/20] arm64:uapi: set __BITS_PER_LONG correctly for ILP32 and LP64
> https://patchwork.kernel.org/patch/9599053/

arm64/ilp32 and arm64/lp64 is the single platform, and so lp64 and
ilp32 parts share the same installed kernel headers. That's why I had to
introduce #ifdef magic here and in other kernel and glibc headers.

Arm32 is different platform, so I don't understand what the benefit
in joining headers. Could you explain it in details.

Your patch has 2880 lines. It's quite difficult to read it at once
(and I didn't do that). Is it possible split in into the series?

Yury

2017-09-05 14:49:56

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] Unifying headers for AArch64 and ARM

On Mon, Sep 4, 2017 at 2:23 PM, Yury Norov <[email protected]> wrote:
> Hi Kaushik,
>
> (CC arm and arch maintainers)
>
> On Fri, Sep 01, 2017 at 12:24:08PM +0000, Kaushik Phatak wrote:
>> Ping for this patch:
>> https://lkml.org/lkml/2017/8/10/136
>>
>> The patch can be viewed on the mail-archive link below,
>> https://www.mail-archive.com/[email protected]/msg1465874.html
>>
>> Please let me know if anyone has any feedback on this.
>> Thanks.
>>
>
>> We have noticed some activity in this area in recent times, Linux patches by Yury Norov:
>> [07/20] arm64:uapi: set __BITS_PER_LONG correctly for ILP32 and LP64
>> https://patchwork.kernel.org/patch/9599053/
>
> arm64/ilp32 and arm64/lp64 is the single platform, and so lp64 and
> ilp32 parts share the same installed kernel headers. That's why I had to
> introduce #ifdef magic here and in other kernel and glibc headers.
>
> Arm32 is different platform, so I don't understand what the benefit
> in joining headers. Could you explain it in details.

I think in the proposed form, the patch makes no sense. The internal
headers do not benefit from being combined at all, as you'd never
include them from user space, and the kernel only ever uses one of them.

For the uabi headers, it can be beneficial to install both versions
simultaneously, but this is generally up to the distro. On Debian
and Ubuntu, the architecture specific uapi headers get installed
into /usr/arm-linux-gnueabi/include/asm/ and /usr/aarch64-linux-gnu/include/asm/
respectively, and the compiler looks for them in the right place.

We used to have some magic in scripts/headers_install.sh that
could generate something like

#ifdef __x86_64__
#include <asm-x86_64/signal.h>
#else
#include <asm-i386/signal.h>
#endif

but that should no longer be needed these days when the toolchain
is installed properly. It may be a problem on some distros that don't
normally ship with a compiler on the target, e.g. openembedded or
LEDE, but I think we are better off fixing it in the distros.

Arnd