public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	libc-alpha@sourceware.org
Subject: Re: [PATCH] Remove cached PID/TID in clone
Date: Wed, 09 Nov 2016 12:18:00 -0000	[thread overview]
Message-ID: <58c8bc8e-e643-2d3a-5e57-55a3457ca70f@redhat.com> (raw)
In-Reply-To: <d0b874df-d9f7-6121-6786-6ac1292a82ec@linaro.org>

On 11/08/2016 08:58 PM, Adhemerval Zanella wrote:

> The tid fields is basically used internally on pthread implementations
> (including getpid) and since correct usage means thread *must* be
> created using pthread_create we are sure the tid field will be
> correctly set due 'set_tid_address' from __pthread_initialize_pids.

Thanks for the explanation.

I really think we should document the clone system call wrapper and 
spell out these requirements, but that's a separate matter.

>> > Please rename to “pid_unused” or something like that, to make sure it's no longer referenced.
> I renamed it on my local branch and I also updated the change spot
> that it incur:
>
> diff --git a/nptl_db/structs.def b/nptl_db/structs.def
> index a9b621b..1cb6a46 100644
> --- a/nptl_db/structs.def
> +++ b/nptl_db/structs.def
> @@ -48,7 +48,6 @@ DB_STRUCT (pthread)
>  DB_STRUCT_FIELD (pthread, list)
>  DB_STRUCT_FIELD (pthread, report_events)
>  DB_STRUCT_FIELD (pthread, tid)
> -DB_STRUCT_FIELD (pthread, pid)
>  DB_STRUCT_FIELD (pthread, start_routine)
>  DB_STRUCT_FIELD (pthread, cancelhandling)
>  DB_STRUCT_FIELD (pthread, schedpolicy)

Have you tested that thread debugging still works after these changes 
(at least on one architecture)?

> The patch also removes the TID caching in clone. My understanding for
> such semantic is try provide some pthread usage after a user program
> issue clone directly (as done by thread creation with CLONE_PARENT_SETTID
> and pthread tid member).  However, as stated before in multiple threads,

“discussion threads”? ☹

> GLIBC provides clone syscalls without further supporting all this
> semantics. It means that, although GLIBC currently tries a better effort,
> since it does not make any more guarantees, specially for newer and newer
> clone flags.

I don't quite understand the above part.

> 	* sysdeps/unix/sysv/linux/getpid.c: Likewise.

This needs updating (file was removed).

I do not have further comments, but I have not reviewed the assembler 
language implementations (only i386/x86_64).  I support the removal of 
PID caching, though.

Thanks,
Florian

  parent reply	other threads:[~2016-11-09 12:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13 19:45 Adhemerval Zanella
2016-10-26 17:59 ` Adhemerval Zanella
2016-11-07 17:21 ` Florian Weimer
2016-11-08 19:58   ` Adhemerval Zanella
2016-11-08 20:11     ` Florian Weimer
2016-11-08 20:37       ` Adhemerval Zanella
2016-11-08 20:44         ` Florian Weimer
2016-11-09 12:18     ` Florian Weimer [this message]
2016-11-15 14:27       ` Adhemerval Zanella
2016-11-15 14:30         ` Florian Weimer
2016-11-24 21:24           ` Adhemerval Zanella
2016-11-25 10:50             ` Florian Weimer

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=58c8bc8e-e643-2d3a-5e57-55a3457ca70f@redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@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).