public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] [RFC] y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit time
       [not found] <20200824164000.1619-1-lukma@denx.de>
@ 2020-08-24 16:59 ` Lukasz Majewski
  2020-08-24 17:15   ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Majewski @ 2020-08-24 16:59 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert, Adhemerval Zanella
  Cc: Alistair Francis, Arnd Bergmann, Alistair Francis, GNU C Library,
	Florian Weimer, Carlos O'Donell, Stepan Golosunov,
	Andreas Schwab, Zack Weinberg, Jeff Law, libc-help

[-- Attachment #1: Type: text/plain, Size: 3394 bytes --]

Dear Community,

> The pthread_cond_clockwait and pthread_cond_timedwait have been
> converted to support 64 bit time.
> 
> This change introduces new futex_abstimed_wait_cancelable64 function
> in ./sysdeps/nptl/futex-helpers.c, which uses futex_time64 where
> possible and tries to replace low-level preprocessor macros from
> lowlevellock-futex.h
> The pthread_cond_{clock|timed}wait only accepts absolute time.
> Moreover, there is no need to check for NULL passed as *abstime
> pointer as __pthread_cond_wait_common() always passes non-NULL struct
> __timespec64 pointer to futex_abstimed_wait_cancellable64().
> 
> For systems with __TIMESIZE != 64 && __WORDSIZE == 32:
> - Conversions between 64 bit time to 32 bit are necessary
> - Redirection to __pthread_cond_{clock|timed}wait64 will provide
> support for 64 bit time
> 
> The futex_abstimed_wait_cancelable64 function has been put into a
> separate file on the purpose - to avoid issues apparent on m68k
> architecture related to small number of available registers (there is
> not enough registers to put all necessary arguments in them when
> inlining). In fact - the futex_helper.c is reused, but extra flag
> "-fno-inline" is set when it is build for this architecture. Such
> approach fixes the build issue.

Unfortunately, having the futex-helpers.c as a separate file caused
issue with linknamespace tests:

/tmp/tmpiql0gye3/undef.c:33:1: warning: ‘pthread_attr_getstackaddr’ is
deprecated [-Wdeprecated-declarations] 33 | void
*__glibc_test_pthread_attr_getstackaddr = (void *)
&pthread_attr_getstackaddr; | ^~~~ In file included from
../include/pthread.h:1, from /tmp/tmpiql0gye3/undef.c:1:
../sysdeps/nptl/pthread.h:332:12: note: declared here
  332 | extern int pthread_attr_getstackaddr (const pthread_attr_t
*__restrict |            ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/tmpiql0gye3/undef.c:42:1: warning: ‘pthread_attr_setstackaddr’ is
deprecated [-Wdeprecated-declarations] 42 | void
*__glibc_test_pthread_attr_setstackaddr = (void *)
&pthread_attr_setstackaddr; | ^~~~ In file included from
../include/pthread.h:1, from /tmp/tmpiql0gye3/undef.c:1:
../sysdeps/nptl/pthread.h:340:12: note: declared here
  340 | extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~


I'm a bit puzzled here. It is a warning in fact despite I've guarded
the function in question with:
libpthread_hidden_{proto|def} (futex_abstimed_wait_cancelable64)

Even more strange is that the check passes when the same function is
added to futex-internals.h with "static __always_inline" attribute.
(But then the problem with small number of regs for m68k is apparent).

As fair as I understood - the linknamespace check is to build sample
program with proper header (like pthread.h) and check if symbols from
linked library (in our case libpthread.*) are exported properly.

In the above case the "test" complains about using obsolete functions
(i.e. - pthread_attr_setstackaddr).

Is this part of the check itself? Or is it a side effect?

Any help appreciated.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] [RFC] y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit time
  2020-08-24 16:59 ` [PATCH] [RFC] y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit time Lukasz Majewski
@ 2020-08-24 17:15   ` Florian Weimer
  2020-08-24 17:50     ` Lukasz Majewski
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2020-08-24 17:15 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Joseph Myers, Paul Eggert, Adhemerval Zanella, Alistair Francis,
	Arnd Bergmann, Alistair Francis, GNU C Library,
	Carlos O'Donell, Stepan Golosunov, Andreas Schwab,
	Zack Weinberg, Jeff Law, libc-help

* Lukasz Majewski:

> I'm a bit puzzled here. It is a warning in fact despite I've guarded
> the function in question with:
> libpthread_hidden_{proto|def} (futex_abstimed_wait_cancelable64)

I think the linknamespace test attempts to descend into
futex_abstimed_wait_cancelable64 because it its name is in the public
(non-implementation) namespace.

Try naming it __futex_abstimed_wait_cancelable64.

Thanks,
Florian


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

* Re: [PATCH] [RFC] y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit time
  2020-08-24 17:15   ` Florian Weimer
@ 2020-08-24 17:50     ` Lukasz Majewski
  0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Majewski @ 2020-08-24 17:50 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Joseph Myers, Paul Eggert, Adhemerval Zanella, Alistair Francis,
	Arnd Bergmann, Alistair Francis, GNU C Library,
	Carlos O'Donell, Stepan Golosunov, Andreas Schwab,
	Zack Weinberg, Jeff Law, libc-help

[-- Attachment #1: Type: text/plain, Size: 964 bytes --]

Hi Florian,

> * Lukasz Majewski:
> 
> > I'm a bit puzzled here. It is a warning in fact despite I've guarded
> > the function in question with:
> > libpthread_hidden_{proto|def} (futex_abstimed_wait_cancelable64)  
> 
> I think the linknamespace test attempts to descend into
> futex_abstimed_wait_cancelable64 because it its name is in the public
> (non-implementation) namespace.
> 
> Try naming it __futex_abstimed_wait_cancelable64.

Indeed, adding the "__" prefix fixed the issue. 

And this "__" prefix is not needed in futex-internal.h functions as
those are "pasted" into source code by C preprocessor .... 

Thanks Florian for help :-)

> 
> Thanks,
> Florian
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-08-24 17:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200824164000.1619-1-lukma@denx.de>
2020-08-24 16:59 ` [PATCH] [RFC] y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit time Lukasz Majewski
2020-08-24 17:15   ` Florian Weimer
2020-08-24 17:50     ` Lukasz Majewski

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).