Skip to contentSkip to conversation

timerfd: wire the new timerfd API to the x86 family

PATCH New [email protected] 8 participants 10 messages Feb 5, 2008 – Feb 6, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 12/265 timerfd: wire the new timerfd API to the x86 family

From: Davide Libenzi <[email protected]>

Wires up the new timerfd API to the x86 family.

---

 arch/x86/ia32/ia32entry.S          |    4 +++-
 arch/x86/kernel/syscall_table_32.S |    4 +++-
 include/asm-x86/unistd_32.h        |    4 +++-
 include/asm-x86/unistd_64.h        |    9 +++++++--
 4 files changed, 16 insertions(+), 5 deletions(-)
arch/x86/ia32/ia32entry.S renamed from arch/x86/ia32/ia32entry.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family +3 -1
diff -puN arch/x86/ia32/ia32entry.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family arch/x86/ia32/ia32entry.S
@@ -722,7 +722,9 @@ ia32_sys_call_table:
 	.quad sys_epoll_pwait
 	.quad compat_sys_utimensat	/* 320 */
 	.quad compat_sys_signalfd
-	.quad compat_sys_timerfd
+	.quad sys_timerfd_create
 	.quad sys_eventfd
 	.quad sys32_fallocate
+	.quad compat_sys_timerfd_settime	/* 325 */
+	.quad compat_sys_timerfd_gettime
 ia32_syscall_end:
arch/x86/kernel/syscall_table_32.S renamed from arch/x86/kernel/syscall_table_32.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family +3 -1
diff -puN arch/x86/kernel/syscall_table_32.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family arch/x86/kernel/syscall_table_32.S
@@ -321,6 +321,8 @@ ENTRY(sys_call_table)
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
 	.long sys_signalfd
-	.long sys_timerfd
+	.long sys_timerfd_create
 	.long sys_eventfd
 	.long sys_fallocate
+	.long sys_timerfd_settime	/* 325 */
+	.long sys_timerfd_gettime
include/asm-x86/unistd_32.h renamed from include/asm-x86/unistd_32.h~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family +3 -1
diff -puN include/asm-x86/unistd_32.h~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family include/asm-x86/unistd_32.h
@@ -327,9 +327,11 @@
 #define __NR_epoll_pwait	319
 #define __NR_utimensat		320
 #define __NR_signalfd		321
-#define __NR_timerfd		322
+#define __NR_timerfd_create	322
 #define __NR_eventfd		323
 #define __NR_fallocate		324
+#define __NR_timerfd_settime	325
+#define __NR_timerfd_gettime	326
 
 #ifdef __KERNEL__
 
include/asm-x86/unistd_64.h renamed from include/asm-x86/unistd_64.h~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family +7 -2
diff -puN include/asm-x86/unistd_64.h~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family include/asm-x86/unistd_64.h
@@ -629,12 +629,17 @@ __SYSCALL(__NR_utimensat, sys_utimensat)
 __SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
 #define __NR_signalfd				282
 __SYSCALL(__NR_signalfd, sys_signalfd)
-#define __NR_timerfd				283
-__SYSCALL(__NR_timerfd, sys_timerfd)
+#define __NR_timerfd_create			283
+__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
 #define __NR_eventfd				284
 __SYSCALL(__NR_eventfd, sys_eventfd)
 #define __NR_fallocate				285
 __SYSCALL(__NR_fallocate, sys_fallocate)
+#define __NR_timerfd_settime			286
+__SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
+#define __NR_timerfd_gettime			287
+__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
+
 
 #ifndef __NO_STUBS
 #define __ARCH_WANT_OLD_READDIR

_

#1 lore raw

PATCH 1/1 Fix timerfd breakage on avr32

sys_timerfd() has been removed, but avr32 still references it from its syscall table.

---

Quoted 3 lines · On Mon, 04 Feb 2008 22:27:28 -0800 [email protected] wrote:

From: Davide Libenzi <[email protected]>

Wires up the new timerfd API to the x86 family.

Just one thing...

arch/x86/kernel/syscall_table_32.S ENTRY(sys_call_table) · line 324

Quoted 8 lines

diff -puN arch/x86/kernel/syscall_table_32.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family arch/x86/kernel/syscall_table_32.S

arch/x86/kernel/syscall_table_32.S renamed from arch/x86/kernel/syscall_table_32.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family +0 -1
@@ -321,6 +321,8 @@ ENTRY(sys_call_table)
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
 	.long sys_signalfd
-	.long sys_timerfd

The next time you go and remove a system call, could you _please_ post a HUGE warning to linux-arch? Or just do a quick grep and fix it up.

Judging by the number of -fix patches in -mm, timerfd-v3-new-timerfd-api.patch broke almost every single architecture in the tree. And not only is this potential breakage never mentioned in the patch description, the patch that actually removes the sys_timerfd() implementation was never Cc'ed linux-arch.

While I agree that new syscalls don't necessarily have to come wired up and ready to use on all architectures, you need to take a lot more care when removing syscalls that have already been wired up.

The patch below fixes avr32. Please apply.

 arch/avr32/kernel/syscall_table.S |    2 +-
 include/asm-avr32/unistd.h        |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/avr32/kernel/syscall_table.S renamed from arch/avr32/kernel/syscall_table.S~fix-timerfd-breakage-on-avr32-was-re-fix-variable-use-in-avr32-pte_alloc_one +1 -1
diff -puN arch/avr32/kernel/syscall_table.S~fix-timerfd-breakage-on-avr32-was-re-fix-variable-use-in-avr32-pte_alloc_one arch/avr32/kernel/syscall_table.S
@@ -293,6 +293,6 @@ sys_call_table:
 	.long	sys_shmctl
 	.long	sys_utimensat
 	.long	sys_signalfd
-	.long	sys_timerfd		/* 280 */
+	.long	sys_ni_syscall		/* 280, was sys_timerfd */
 	.long	sys_eventfd
 	.long	sys_ni_syscall		/* r8 is saturated at nr_syscalls */
include/asm-avr32/unistd.h renamed from include/asm-avr32/unistd.h~fix-timerfd-breakage-on-avr32-was-re-fix-variable-use-in-avr32-pte_alloc_one +1 -1
diff -puN include/asm-avr32/unistd.h~fix-timerfd-breakage-on-avr32-was-re-fix-variable-use-in-avr32-pte_alloc_one include/asm-avr32/unistd.h
@@ -297,7 +297,7 @@
 
 #define __NR_utimensat		278
 #define __NR_signalfd		279
-#define __NR_timerfd		280
+/* 280 was __NR_timerfd */
 #define __NR_eventfd		281
 
 #ifdef __KERNEL__
#2 lore raw

Re: [PATCH] Fix timerfd breakage on avr32

Quoted 2 lines · On Tue, 5 Feb 2008 10:54:54 +0100 Haavard Skinnemoen <[email protected]>…

The next time you go and remove a system call, could you _please_ post a HUGE warning to linux-arch? Or just do a quick grep and fix it up.

Btw, a quick grep through 2.6.24-mm1 shows

arch/frv/kernel/entry.S: .long sys_timerfd
arch/m32r/kernel/syscall_table.S: .long sys_timerfd
arch/sh/kernel/syscalls_32.S: .long sys_timerfd
arch/sh/kernel/syscalls_64.S: .long sys_timerfd /* 350 */

so frv, m32r and sh are probably broken too.

Haavard

#3 lore raw

Re: [PATCH] Fix timerfd breakage on avr32

Quoted 6 lines · On Tue, 5 Feb 2008 11:03:47 +0100 Haavard Skinnemoen <[email protected]>…
Quoted 2 lines · On Tue, 5 Feb 2008 10:54:54 +0100 Haavard Skinnemoen <[email protected]>…

The next time you go and remove a system call, could you _please_ post a HUGE warning to linux-arch? Or just do a quick grep and fix it up.

Quoted 9 lines

Btw, a quick grep through 2.6.24-mm1 shows

arch/frv/kernel/entry.S: .long sys_timerfd
arch/m32r/kernel/syscall_table.S: .long sys_timerfd
arch/sh/kernel/syscalls_32.S: .long sys_timerfd
arch/sh/kernel/syscalls_64.S: .long sys_timerfd /* 350 */

so frv, m32r and sh are probably broken too.

argh. After fixing so many architectures I asked for a grepped fix :(

This?

 arch/frv/kernel/entry.S          |    2 +-
 arch/m32r/kernel/syscall_table.S |    2 +-
 arch/sh/kernel/syscalls_32.S     |    2 +-
 arch/sh/kernel/syscalls_64.S     |    2 +-
 include/asm-frv/unistd.h         |    2 +-
 include/asm-m32r/unistd.h        |    2 +-
 include/asm-sh/unistd_32.h       |    2 +-
 include/asm-sh/unistd_64.h       |    2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
arch/frv/kernel/entry.S renamed from arch/frv/kernel/entry.S~timerfd-fix-remaining-architectures +1 -1
diff -puN arch/frv/kernel/entry.S~timerfd-fix-remaining-architectures arch/frv/kernel/entry.S
@@ -1494,7 +1494,7 @@ sys_call_table:
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
 	.long sys_signalfd
-	.long sys_timerfd
+	.long sys_ni_syscall
 	.long sys_eventfd
 	.long sys_fallocate
 
arch/m32r/kernel/syscall_table.S renamed from arch/m32r/kernel/syscall_table.S~timerfd-fix-remaining-architectures +1 -1
diff -puN arch/m32r/kernel/syscall_table.S~timerfd-fix-remaining-architectures arch/m32r/kernel/syscall_table.S
@@ -321,6 +321,6 @@ ENTRY(sys_call_table)
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
 	.long sys_signalfd
-	.long sys_timerfd
+	.long sys_ni_syscall
 	.long sys_eventfd
 	.long sys_fallocate
arch/sh/kernel/syscalls_32.S renamed from arch/sh/kernel/syscalls_32.S~timerfd-fix-remaining-architectures +1 -1
diff -puN arch/sh/kernel/syscalls_32.S~timerfd-fix-remaining-architectures arch/sh/kernel/syscalls_32.S
@@ -338,6 +338,6 @@ ENTRY(sys_call_table)
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
 	.long sys_signalfd
-	.long sys_timerfd
+	.long sys_ni_syscall
 	.long sys_eventfd
 	.long sys_fallocate
arch/sh/kernel/syscalls_64.S renamed from arch/sh/kernel/syscalls_64.S~timerfd-fix-remaining-architectures +1 -1
diff -puN arch/sh/kernel/syscalls_64.S~timerfd-fix-remaining-architectures arch/sh/kernel/syscalls_64.S
@@ -376,6 +376,6 @@ sys_call_table:
 	.long sys_epoll_pwait
 	.long sys_utimensat
 	.long sys_signalfd
-	.long sys_timerfd		/* 350 */
+	.long sys_ni_syscall		/* 350 */
 	.long sys_eventfd
 	.long sys_fallocate
include/asm-frv/unistd.h renamed from include/asm-frv/unistd.h~timerfd-fix-remaining-architectures +1 -1
diff -puN include/asm-frv/unistd.h~timerfd-fix-remaining-architectures include/asm-frv/unistd.h
@@ -328,7 +328,7 @@
 #define __NR_epoll_pwait	319
 #define __NR_utimensat		320
 #define __NR_signalfd		321
-#define __NR_timerfd		322
+/* #define __NR_timerfd		322 removed */
 #define __NR_eventfd		323
 #define __NR_fallocate		324
 
include/asm-m32r/unistd.h renamed from include/asm-m32r/unistd.h~timerfd-fix-remaining-architectures +1 -1
diff -puN include/asm-m32r/unistd.h~timerfd-fix-remaining-architectures include/asm-m32r/unistd.h
@@ -327,7 +327,7 @@
 #define __NR_epoll_pwait	319
 #define __NR_utimensat		320
 #define __NR_signalfd		321
-#define __NR_timerfd		322
+/* #define __NR_timerfd		322 removed */
 #define __NR_eventfd		323
 #define __NR_fallocate		324
 

diff -puN include/asm-sh/unistd.h~timerfd-fix-remaining-architectures include/asm-sh/unistd.h

include/asm-sh/unistd_32.h renamed from include/asm-sh/unistd_32.h~timerfd-fix-remaining-architectures +1 -1
diff -puN include/asm-sh/unistd_32.h~timerfd-fix-remaining-architectures include/asm-sh/unistd_32.h
@@ -330,7 +330,7 @@
 #define __NR_epoll_pwait	319
 #define __NR_utimensat		320
 #define __NR_signalfd		321
-#define __NR_timerfd		322
+/* #define __NR_timerfd		322 removed */
 #define __NR_eventfd		323
 #define __NR_fallocate		324
 
include/asm-sh/unistd_64.h renamed from include/asm-sh/unistd_64.h~timerfd-fix-remaining-architectures +1 -1
diff -puN include/asm-sh/unistd_64.h~timerfd-fix-remaining-architectures include/asm-sh/unistd_64.h
@@ -370,7 +370,7 @@
 #define __NR_epoll_pwait	347
 #define __NR_utimensat		348
 #define __NR_signalfd		349
-#define __NR_timerfd		350
+/* #define __NR_timerfd		350 removed */
 #define __NR_eventfd		351
 #define __NR_fallocate		352
 

_

#4 lore raw

Re: [PATCH] Fix timerfd breakage on avr32

Quoted 15 lines · Andrew Morton
Quoted 13 lines · On Tue, 5 Feb 2008 11:03:47 +0100 Haavard Skinnemoen <[email protected]>…
Quoted 2 lines · On Tue, 5 Feb 2008 10:54:54 +0100 Haavard Skinnemoen <[email protected]>…

The next time you go and remove a system call, could you _please_ post a HUGE warning to linux-arch? Or just do a quick grep and fix it up.

Btw, a quick grep through 2.6.24-mm1 shows

arch/frv/kernel/entry.S: .long sys_timerfd
arch/m32r/kernel/syscall_table.S: .long sys_timerfd
arch/sh/kernel/syscalls_32.S: .long sys_timerfd
arch/sh/kernel/syscalls_64.S: .long sys_timerfd /* 350 */

Quoted 9 lines
Quoted 2 lines

so frv, m32r and sh are probably broken too.

argh. After fixing so many architectures I asked for a grepped fix :(

This?

At least if this patch goes in first then bisect won't needlessly break, though the previous patch has already gone to Linus, so maybe it's too late already. Once this patch and the previous one are in, then the new interface can be wired up -- preferably in that order.

#5 lore raw

Re: [PATCH] Fix timerfd breakage on avr32

In reply to Haavard Skinnemoen
Quoted 14 lines · Haavard Skinnemoen

sys_timerfd() has been removed, but avr32 still references it from its syscall table.

---

Quoted 3 lines · On Mon, 04 Feb 2008 22:27:28 -0800 [email protected] wrote:

From: Davide Libenzi <[email protected]>

Wires up the new timerfd API to the x86 family.

Just one thing...

Quoted 11 lines

arch/x86/kernel/syscall_table_32.S ENTRY(sys_call_table) · line 324

Quoted 8 lines

diff -puN arch/x86/kernel/syscall_table_32.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family arch/x86/kernel/syscall_table_32.S

arch/x86/kernel/syscall_table_32.S renamed from arch/x86/kernel/syscall_table_32.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family +0 -1
@@ -321,6 +321,8 @@ ENTRY(sys_call_table)
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
 	.long sys_signalfd
-	.long sys_timerfd

The next time you go and remove a system call, could you _please_ post a HUGE warning to linux-arch? Or just do a quick grep and fix it up.

Wasn't there a decision at a kernel summit that anything which adds new syscalls should have a test program included so that architecture maintainers can test the functionality on their architectures?

I seem to remember that it came up because the merged timerfd was a pile of utter crap which didn't have a hope in hells chance of working.

So... where is the new timerfd test program?

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#6 lore raw

Re: [PATCH] Fix timerfd breakage on avr32

Quoted 8 lines

Wasn't there a decision at a kernel summit that anything which adds new syscalls should have a test program included so that architecture maintainers can test the functionality on their architectures?

I seem to remember that it came up because the merged timerfd was a pile of utter crap which didn't have a hope in hells chance of working.

So... where is the new timerfd test program?

As described in git commit 4d672e7ac79b5ec5cdc90e450823441e20464691 it's here:
http://www.xmailserver.org/timerfd-test2.c
I used it to test the s390 backend.

#7 lore raw

Re: [PATCH] Fix timerfd breakage on avr32

Quoted 4 lines · Heiko Carstens
Quoted 4 lines

Wasn't there a decision at a kernel summit that anything which adds new syscalls should have a test program included so that architecture maintainers can test the functionality on their architectures?

Quoted 8 lines
Quoted 4 lines

I seem to remember that it came up because the merged timerfd was a pile of utter crap which didn't have a hope in hells chance of working.

So... where is the new timerfd test program?

As described in git commit 4d672e7ac79b5ec5cdc90e450823441e20464691 it's here:
http://www.xmailserver.org/timerfd-test2.c
I used it to test the s390 backend.

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#8 lore raw

Re: [PATCH] Fix timerfd breakage on avr32

In reply to Russell King
Quoted 27 lines · On Wed, 6 Feb 2008 11:04:25 +0000 Russell King wrote:
Quoted 14 lines · Haavard Skinnemoen

sys_timerfd() has been removed, but avr32 still references it from its syscall table.

---

Quoted 3 lines · On Mon, 04 Feb 2008 22:27:28 -0800 [email protected] wrote:

From: Davide Libenzi <[email protected]>

Wires up the new timerfd API to the x86 family.

Just one thing...

Quoted 11 lines

arch/x86/kernel/syscall_table_32.S ENTRY(sys_call_table) · line 324

Quoted 8 lines

diff -puN arch/x86/kernel/syscall_table_32.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family arch/x86/kernel/syscall_table_32.S

arch/x86/kernel/syscall_table_32.S renamed from arch/x86/kernel/syscall_table_32.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family +0 -1
@@ -321,6 +321,8 @@ ENTRY(sys_call_table)
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
 	.long sys_signalfd
-	.long sys_timerfd

The next time you go and remove a system call, could you _please_ post a HUGE warning to linux-arch? Or just do a quick grep and fix it up.

Quoted 3 lines

Wasn't there a decision at a kernel summit that anything which adds new syscalls should have a test program included so that architecture maintainers can test the functionality on their architectures?

Thanks for sharing that useful info. (seriously)

Quoted 4 lines

I seem to remember that it came up because the merged timerfd was a pile of utter crap which didn't have a hope in hells chance of working.

So... where is the new timerfd test program?

---
~Randy

#9 lore raw

Re: [PATCH] Fix timerfd breakage on avr32

In reply to Russell King
Quoted 15 lines · Russell King
Quoted 14 lines · Haavard Skinnemoen

sys_timerfd() has been removed, but avr32 still references it from its syscall table.

---

Quoted 3 lines · On Mon, 04 Feb 2008 22:27:28 -0800 [email protected] wrote:

From: Davide Libenzi <[email protected]>

Wires up the new timerfd API to the x86 family.

Just one thing...

Quoted 11 lines
Quoted 11 lines

arch/x86/kernel/syscall_table_32.S ENTRY(sys_call_table) · line 324

Quoted 8 lines

diff -puN arch/x86/kernel/syscall_table_32.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family arch/x86/kernel/syscall_table_32.S

arch/x86/kernel/syscall_table_32.S renamed from arch/x86/kernel/syscall_table_32.S~timerfd-v3-wire-the-new-timerfd-api-to-the-x86-family +0 -1
@@ -321,6 +321,8 @@ ENTRY(sys_call_table)
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
 	.long sys_signalfd
-	.long sys_timerfd

The next time you go and remove a system call, could you _please_ post a HUGE warning to linux-arch? Or just do a quick grep and fix it up.

Haavard, that was my fault not Andrew's. I thought that the patch setting it CONFIG_BROKEN carried a syscall unlink from tables. I should have grepped anyway.

Quoted 3 lines

Wasn't there a decision at a kernel summit that anything which adds new syscalls should have a test program included so that architecture maintainers can test the functionality on their architectures?

It was always there, even before KS:

http://www.xmailserver.org/timerfd-test2.c

Quoted 2 lines

I seem to remember that it came up because the merged timerfd was a pile of utter crap which didn't have a hope in hells chance of working.

Your pile of utter crap, was a typo that made the syscall return a truncated 32 bit "expired ticks" value (instead of 64 bit), and a wish from the manpages maintainer to have a way to retrieve the remaining time.

- Davide