public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mjbaars1977 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/29585] sched_getcpu returns invalid results
Date: Wed, 28 Sep 2022 09:59:30 +0000	[thread overview]
Message-ID: <bug-29585-131-R4MTxqUTva@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29585-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29585

--- Comment #11 from Mischa Baars <mjbaars1977 at gmail dot com> ---
(In reply to Florian Weimer from comment #9)
> (In reply to Mischa Baars from comment #8)
> > (In reply to Florian Weimer from comment #7)
> > > You cannot call glibc function after creating a bare thread using clone, you
> > > need to use direct system calls. The bare thread does not have a proper
> > > thread control block set up for glibc.
> > 
> > Ok, no problem. I can use syscalls to retrieve the processor the process is
> > running on, but shouldn't glibc check for the existence of this thread
> > control block and return a -1 when it does not exist instead of a incorrect
> > processor number?
> 
> There is no efficient way to check if the TCB is safe to use from the
> current thread.
> 
> > I think that a small note in the manual page about pthreads vs fork / clone
> > would be in order. For example, if the existence of both pthread_yield and
> > sched_yield makes you think that sched_yield is not specifically intended
> > for use with pthreads, then why would sched_getcpu be?
> 
> sched_getcpu is not related to pthreads any more than the rest of glibc.

Hi Florian,

A little more detail of what we're dealing with here:

I can't tell if this this is in any way related to a thread control block, but
without the CLONE_VM option passed to clone(), sched_getcpu() is working fine,
with the CLONE_VM option passed to clone(), it isn't.

Just in case you were still interested :)

Best regards,
Mischa Baars.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-09-28  9:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19  8:22 [Bug libc/29585] New: " mjbaars1977 at gmail dot com
2022-09-19 14:21 ` [Bug libc/29585] " fweimer at redhat dot com
2022-09-21  8:00 ` mjbaars1977 at gmail dot com
2022-09-22  8:30 ` mjbaars1977 at gmail dot com
2022-09-22 12:59 ` mjbaars1977 at gmail dot com
2022-09-22 13:00 ` mjbaars1977 at gmail dot com
2022-09-26  8:04 ` mjbaars1977 at gmail dot com
2022-09-26  9:18 ` fweimer at redhat dot com
2022-09-26 11:14 ` mjbaars1977 at gmail dot com
2022-09-26 11:21 ` fweimer at redhat dot com
2022-09-26 12:15 ` mjbaars1977 at gmail dot com
2022-09-28  9:59 ` mjbaars1977 at gmail dot com [this message]
2022-09-28 10:09 ` schwab@linux-m68k.org
2022-09-28 14:03 ` mjbaars1977 at gmail dot com
2022-10-10  9:18 ` fweimer at redhat dot com
2022-10-10 15:14 ` mjbaars1977 at gmail dot com
2022-10-10 16:20 ` mjbaars1977 at gmail dot com
2022-10-10 16:31 ` fweimer at redhat dot com
2022-10-10 16:41 ` mjbaars1977 at gmail dot com
2022-10-10 17:05 ` mjbaars1977 at gmail dot com
2022-10-10 17:09 ` schwab@linux-m68k.org
2022-10-10 17:10 ` mjbaars1977 at gmail dot com
2022-11-14  9:58 ` mjbaars1977 at gmail dot com
2022-11-14 12:55 ` fweimer at redhat dot com
2022-11-14 16:15 ` mjbaars1977 at gmail dot com
2022-11-14 16:40 ` mjbaars1977 at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29585-131-R4MTxqUTva@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).