public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] microblaze: Use the correct select syscall (BZ #28883)
@ 2022-02-16 14:16 Adhemerval Zanella
  2022-02-16 15:15 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Adhemerval Zanella @ 2022-02-16 14:16 UTC (permalink / raw)
  To: libc-alpha; +Cc: mark.hatle

On Microblaze only __NR_newselect is implemented, even though kernel
advertise __NR_select on asm/unistd.h.  Instead of adding an ad-hoc
logic on select.c, change the __NR_select of microblaze by overwritting
with fixup-asm-unistd.h.
---
 .../unix/sysv/linux/microblaze/arch-syscall.h |  2 +-
 .../sysv/linux/microblaze/fixup-asm-unistd.h  | 26 +++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/unix/sysv/linux/microblaze/fixup-asm-unistd.h

diff --git a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
index 6e10c3661d..06c0575325 100644
--- a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
@@ -313,7 +313,7 @@
 #define __NR_sched_setscheduler 156
 #define __NR_sched_yield 158
 #define __NR_seccomp 384
-#define __NR_select 82
+#define __NR_select 142
 #define __NR_semctl 328
 #define __NR_semget 329
 #define __NR_semop 330
diff --git a/sysdeps/unix/sysv/linux/microblaze/fixup-asm-unistd.h b/sysdeps/unix/sysv/linux/microblaze/fixup-asm-unistd.h
new file mode 100644
index 0000000000..bbb82c4588
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/microblaze/fixup-asm-unistd.h
@@ -0,0 +1,26 @@
+/* Regularize <asm/unistd.h> definitions.  Microblaze version.
+   Copyright (C) 2022 Free Software Foundation, Inc.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Microblaze does not implement __NR_select, besides kernel advertise
+   it.  Also, make it failproof if kernel decides to remove the bogus
+   __NR_select definition.  */
+#ifdef __NR_select
+# undef __NR_select
+#endif
+#ifndef __NR_select
+# define __NR_select __NR__newselect
+#endif
-- 
2.32.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] microblaze: Use the correct select syscall (BZ #28883)
  2022-02-16 14:16 [PATCH] microblaze: Use the correct select syscall (BZ #28883) Adhemerval Zanella
@ 2022-02-16 15:15 ` Andreas Schwab
  2022-02-16 15:48   ` Mark Hatle
  2022-02-16 16:46   ` Adhemerval Zanella
  0 siblings, 2 replies; 5+ messages in thread
From: Andreas Schwab @ 2022-02-16 15:15 UTC (permalink / raw)
  To: Adhemerval Zanella via Libc-alpha; +Cc: Adhemerval Zanella, mark.hatle

On Feb 16 2022, Adhemerval Zanella via Libc-alpha wrote:

> On Microblaze only __NR_newselect is implemented, even though kernel
> advertise __NR_select on asm/unistd.h.  Instead of adding an ad-hoc
> logic on select.c, change the __NR_select of microblaze by overwritting
> with fixup-asm-unistd.h.

Microblaze is the only architecture that undefines __ASSUME_PSELECT (for
very old kernels), so it is the only one to actually trigger that
fallback in select.c.  I think that fallback could just be changed to
use _newselect instead.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] microblaze: Use the correct select syscall (BZ #28883)
  2022-02-16 15:15 ` Andreas Schwab
@ 2022-02-16 15:48   ` Mark Hatle
  2022-02-16 16:49     ` Adhemerval Zanella
  2022-02-16 16:46   ` Adhemerval Zanella
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Hatle @ 2022-02-16 15:48 UTC (permalink / raw)
  To: Andreas Schwab, Adhemerval Zanella via Libc-alpha
  Cc: Adhemerval Zanella, Mark Hatle

The other option would be to remove the non-__assume_pselect path, and simply 
require all systems to have pselect.  (This would require microblaze to move to 
kernel 3.15 minimum, which may be reasonable behavior.)

(It has been a long time since Xilinx has shipped a kernel older then 3.15, so 
it would be down to specific users trying to hold onto an older kernel.)

--Mark

On 2/16/22 9:15 AM, Andreas Schwab wrote:
> On Feb 16 2022, Adhemerval Zanella via Libc-alpha wrote:
> 
>> On Microblaze only __NR_newselect is implemented, even though kernel
>> advertise __NR_select on asm/unistd.h.  Instead of adding an ad-hoc
>> logic on select.c, change the __NR_select of microblaze by overwritting
>> with fixup-asm-unistd.h.
> 
> Microblaze is the only architecture that undefines __ASSUME_PSELECT (for
> very old kernels), so it is the only one to actually trigger that
> fallback in select.c.  I think that fallback could just be changed to
> use _newselect instead.
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] microblaze: Use the correct select syscall (BZ #28883)
  2022-02-16 15:15 ` Andreas Schwab
  2022-02-16 15:48   ` Mark Hatle
@ 2022-02-16 16:46   ` Adhemerval Zanella
  1 sibling, 0 replies; 5+ messages in thread
From: Adhemerval Zanella @ 2022-02-16 16:46 UTC (permalink / raw)
  To: Andreas Schwab, Adhemerval Zanella via Libc-alpha; +Cc: mark.hatle



On 16/02/2022 12:15, Andreas Schwab wrote:
> On Feb 16 2022, Adhemerval Zanella via Libc-alpha wrote:
> 
>> On Microblaze only __NR_newselect is implemented, even though kernel
>> advertise __NR_select on asm/unistd.h.  Instead of adding an ad-hoc
>> logic on select.c, change the __NR_select of microblaze by overwritting
>> with fixup-asm-unistd.h.
> 
> Microblaze is the only architecture that undefines __ASSUME_PSELECT (for
> very old kernels), so it is the only one to actually trigger that
> fallback in select.c.  I think that fallback could just be changed to
> use _newselect instead.
> 

I would simpler indeed, I will update the patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] microblaze: Use the correct select syscall (BZ #28883)
  2022-02-16 15:48   ` Mark Hatle
@ 2022-02-16 16:49     ` Adhemerval Zanella
  0 siblings, 0 replies; 5+ messages in thread
From: Adhemerval Zanella @ 2022-02-16 16:49 UTC (permalink / raw)
  To: Mark Hatle, Andreas Schwab, Adhemerval Zanella via Libc-alpha; +Cc: Mark Hatle



On 16/02/2022 12:48, Mark Hatle wrote:
> The other option would be to remove the non-__assume_pselect path, and simply require all systems to have pselect.  (This would require microblaze to move to kernel 3.15 minimum, which may be reasonable behavior.)
> 
> (It has been a long time since Xilinx has shipped a kernel older then 3.15, so it would be down to specific users trying to hold onto an older kernel.)

I don't have a strong preference, we usually tie the minimum kernel version to
the LTS support one for the architecture.  Also, bumping the minimum kernel
version is usually done when there is room for code cleanups (which seems
minimal for this case).

> 
> --Mark
> 
> On 2/16/22 9:15 AM, Andreas Schwab wrote:
>> On Feb 16 2022, Adhemerval Zanella via Libc-alpha wrote:
>>
>>> On Microblaze only __NR_newselect is implemented, even though kernel
>>> advertise __NR_select on asm/unistd.h.  Instead of adding an ad-hoc
>>> logic on select.c, change the __NR_select of microblaze by overwritting
>>> with fixup-asm-unistd.h.
>>
>> Microblaze is the only architecture that undefines __ASSUME_PSELECT (for
>> very old kernels), so it is the only one to actually trigger that
>> fallback in select.c.  I think that fallback could just be changed to
>> use _newselect instead.
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-16 16:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 14:16 [PATCH] microblaze: Use the correct select syscall (BZ #28883) Adhemerval Zanella
2022-02-16 15:15 ` Andreas Schwab
2022-02-16 15:48   ` Mark Hatle
2022-02-16 16:49     ` Adhemerval Zanella
2022-02-16 16:46   ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).