Skip to contentSkip to conversation

Disintegrate UAPI for arm64 [ver #2]

GIT PULL David Howells 2 participants 4 messages Oct 9, 2012

lore
Share & tools
lore
#0 lore raw

Can you merge the following branch into the arm64 tree please.

This is to complete part of the UAPI disintegration for which the preparatory patches were pulled recently.

Now that the fixups and the asm-generic chunk have been merged, I've regenerated the patches to get rid of those dependencies and to take account of any changes made so far in the merge window. If you have already pulled the older version of the branch aimed at you, then please feel free to ignore this request.

The following changes since commit 9e2d8656f5e8aa214e66b462680cf86b210b74a8:

Merge branch 'akpm' (Andrew's patch-bomb) (2012-10-09 16:23:15 +0900)

are available in the git repository at:

git://git.infradead.org/users/dhowells/linux-headers.git tags/disintegrate-arm64-20121009

for you to fetch changes up to a24b2da6de9a44f395c67219d300de21f66d0da3:

UAPI: (Scripted) Disintegrate arch/arm64/include/asm (2012-10-09 09:46:34 +0100)

----------------------------------------------------------------
UAPI Disintegration 2012-10-09

----------------------------------------------------------------
David Howells (1):
UAPI: (Scripted) Disintegrate arch/arm64/include/asm

 arch/arm64/include/asm/Kbuild                   |   2 -
 arch/arm64/include/asm/hwcap.h                  |  22 +----
 arch/arm64/include/asm/ptrace.h                 |  88 +------------------
 arch/arm64/include/asm/sigcontext.h             |  40 +--------
 arch/arm64/include/asm/stat.h                   |   5 +-
 arch/arm64/include/asm/unistd.h                 |   8 +-
 arch/arm64/include/uapi/asm/Kbuild              |  14 +++
 arch/arm64/include/{ => uapi}/asm/auxvec.h      |   0
 arch/arm64/include/{ => uapi}/asm/bitsperlong.h |   0
 arch/arm64/include/{ => uapi}/asm/byteorder.h   |   0
 arch/arm64/include/{ => uapi}/asm/fcntl.h       |   0
 arch/arm64/include/uapi/asm/hwcap.h             |  39 +++++++++
 arch/arm64/include/{ => uapi}/asm/param.h       |   0
 arch/arm64/include/uapi/asm/ptrace.h            | 110 ++++++++++++++++++++++++
 arch/arm64/include/{ => uapi}/asm/setup.h       |   0
 arch/arm64/include/uapi/asm/sigcontext.h        |  57 ++++++++++++
 arch/arm64/include/{ => uapi}/asm/siginfo.h     |   0
 arch/arm64/include/{ => uapi}/asm/signal.h      |   0
 arch/arm64/include/uapi/asm/stat.h              |  16 ++++
 arch/arm64/include/{ => uapi}/asm/statfs.h      |   0
 arch/arm64/include/uapi/asm/unistd.h            |  16 ++++
 21 files changed, 257 insertions(+), 160 deletions(-)
 rename arch/arm64/include/{ => uapi}/asm/auxvec.h (100%)
 rename arch/arm64/include/{ => uapi}/asm/bitsperlong.h (100%)
 rename arch/arm64/include/{ => uapi}/asm/byteorder.h (100%)
 rename arch/arm64/include/{ => uapi}/asm/fcntl.h (100%)
 create mode 100644 arch/arm64/include/uapi/asm/hwcap.h
 rename arch/arm64/include/{ => uapi}/asm/param.h (100%)
 create mode 100644 arch/arm64/include/uapi/asm/ptrace.h
 rename arch/arm64/include/{ => uapi}/asm/setup.h (100%)
 create mode 100644 arch/arm64/include/uapi/asm/sigcontext.h
 rename arch/arm64/include/{ => uapi}/asm/siginfo.h (100%)
 rename arch/arm64/include/{ => uapi}/asm/signal.h (100%)
 create mode 100644 arch/arm64/include/uapi/asm/stat.h
 rename arch/arm64/include/{ => uapi}/asm/statfs.h (100%)
 create mode 100644 arch/arm64/include/uapi/asm/unistd.h

.

#1 lore raw
Quoted 2 lines · David Howells

David Howells (1):
UAPI: (Scripted) Disintegrate arch/arm64/include/asm

It still fails on arm64. The reason is that I had a __SYSCALL_COMPAT guard to provide either the 32-bit syscalls or the 64-bit (generic) ones via asm/unistd.h. With this change:

Quoted 9 lines
arch/arm64/include/asm/unistd.h +0 -1
index 8f03dee..3d43b19 100644
@@ -13,13 +13,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-

arch/arm64/include/asm/unistd.h line 19

Quoted 10 lines
arch/arm64/include/asm/unistd.h +1 -6
-#ifndef __SYSCALL_COMPAT
-#include <asm-generic/unistd.h>
-#endif
-
-#ifdef __KERNEL__
 #ifdef CONFIG_COMPAT
 #include <asm/unistd32.h>
 #endif
-#endif
+#include <uapi/asm/unistd.h>

the guard disappears and I get conflicting entries between unistd32.h and unistd.h.

The solution is to either keep the __SYSCALL_COMPAT guard in place or rename all the __NR_* macros in unistd32.h to __NR_compat_* and include unistd32.h explicitly where needed (kernel-only header anyway). Since the arm64 kernel would not export 32-bit headers, I would go with the second solution (tried it already). But you need to re-generate the arm64 headers again.

BTW, I see the script generated some pretty much empty uapi/asm/unistd.h. Is it possible to using something like Kbuild and just add "generic-y += ..." to just point it to the include/uapi/asm-generic header?

Signature · 1 line
Catalin
#2 lore raw
Quoted 3 lines · Catalin Marinas

It still fails on arm64. The reason is that I had a __SYSCALL_COMPAT guard to provide either the 32-bit syscalls or the 64-bit (generic) ones via asm/unistd.h. With this change:

Hmmm.

Why does asm/unistd.h get #included for the compat bits at all? Looking in arch/arm64/kernel/sys32.S could the compat syscall table be generated by a direct #inclusion of asm/unistd32.h instead?

Is there a reason that asm/unistd32.h needs to declare __NR_ macros? Looking at signal32.c and sys_compat.c you only need:

	__ARM_NR_compat_cacheflush
	__ARM_NR_compat_set_tls

and:

__NR_sigreturn
__NR_rt_sigreturn
__NR_restart_syscall

could you define __ARM_NR_ versions of the last three and get rid of all the __NR_ constant definitions by putting the numbers directly into the __SYSCALL macros?

Quoted 5 lines

The solution is to either keep the __SYSCALL_COMPAT guard in place or rename all the __NR_* macros in unistd32.h to __NR_compat_* and include unistd32.h explicitly where needed (kernel-only header anyway). Since the arm64 kernel would not export 32-bit headers, I would go with the second solution (tried it already).

That sounds workable too... Certainly easier to do with a text editor than folding the compat __NR_ values into their __SYSCALL() macros.

Either way, you can then blithely always include unistd32.h without having to wriggle to avoid the duplicate symbols.

Quoted 1 line

But you need to re-generate the arm64 headers again.

Regeneration is certainly quick and (usually) easy, but I need to change the base to end up with a different result. Do you want me to rename all the __NR_* to __NR_compat_* before doing that (if you have a patch to do so, I can incorporate that on the arm64 branch prior to doing the disintegration).

Quoted 4 lines

BTW, I see the script generated some pretty much empty uapi/asm/unistd.h. Is it possible to using something like Kbuild and just add "generic-y += ..." to just point it to the include/uapi/asm-generic header?

Yes. Note that I was asked not to lose copyright notices if they were present, which is why you've ended up with that.

At this point, I'd rather not adjust the disintegration script, so fixing it up after would be simplest.

David

#3 lore raw
Quoted 11 lines · David Howells
Quoted 3 lines · Catalin Marinas

It still fails on arm64. The reason is that I had a __SYSCALL_COMPAT guard to provide either the 32-bit syscalls or the 64-bit (generic) ones via asm/unistd.h. With this change:

Hmmm.

Why does asm/unistd.h get #included for the compat bits at all? Looking in arch/arm64/kernel/sys32.S could the compat syscall table be generated by a direct #inclusion of asm/unistd32.h instead?

Yes, that's what I tried. But since unistd.h gets included indirectly as well, I have to change the __NR_* definitions in unistd32.h to avoid conflicts (once done, it's fine again).

Quoted 8 lines

Is there a reason that asm/unistd32.h needs to declare __NR_ macros? Looking at signal32.c and sys_compat.c you only need:

	__ARM_NR_compat_cacheflush
	__ARM_NR_compat_set_tls

and:

Quoted 7 lines

__NR_sigreturn
__NR_rt_sigreturn
__NR_restart_syscall

could you define __ARM_NR_ versions of the last three and get rid of all the __NR_ constant definitions by putting the numbers directly into the __SYSCALL macros?

I would name them __NR_compat_ rather than __ARM_NR_ as the latter usually means architecture-specific system call.

Quoted 12 lines
Quoted 5 lines

The solution is to either keep the __SYSCALL_COMPAT guard in place or rename all the __NR_* macros in unistd32.h to __NR_compat_* and include unistd32.h explicitly where needed (kernel-only header anyway). Since the arm64 kernel would not export 32-bit headers, I would go with the second solution (tried it already).

That sounds workable too... Certainly easier to do with a text editor than folding the compat __NR_ values into their __SYSCALL() macros.

Either way, you can then blithely always include unistd32.h without having to wriggle to avoid the duplicate symbols.

Quoted 6 lines
Quoted 1 line

But you need to re-generate the arm64 headers again.

Regeneration is certainly quick and (usually) easy, but I need to change the base to end up with a different result. Do you want me to rename all the __NR_* to __NR_compat_* before doing that (if you have a patch to do so, I can incorporate that on the arm64 branch prior to doing the disintegration).

I'll push a patch tomorrow so you can run your script on that branch. I can also fix things up after merging your current branch (it breaks bisectability but it doesn't matter much for arm64, it's only a few patches).

Quoted 10 lines
Quoted 4 lines

BTW, I see the script generated some pretty much empty uapi/asm/unistd.h. Is it possible to using something like Kbuild and just add "generic-y += ..." to just point it to the include/uapi/asm-generic header?

Yes. Note that I was asked not to lose copyright notices if they were present, which is why you've ended up with that.

At this point, I'd rather not adjust the disintegration script, so fixing it up after would be simplest.

OK, it makes sense.

Thanks.

Signature · 1 line
Catalin