From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28902 invoked by alias); 15 Nov 2016 14:27:08 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 28888 invoked by uid 89); 15 Nov 2016 14:27:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=vfork, Hx-spam-relays-external:209.85.217.180, H*RU:209.85.217.180 X-HELO: mail-ua0-f180.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=lgjeWyOv0sexfCNViv+DCv4SMQz3RtCnTt8CmrO2aF0=; b=C+6XaHBkoldYiDBU9XsRl1jqj847eHNCDtC2VutRrDMKK0vmii8ZSwSCIfbaHArEYh +2MttkvHUKxtv/iQMFvsK8riDxG9qBsWSbYsuSaiL2n2anjikva6zgQIN0pgsOKxsxjF jqB0wx1zx0KdwWUzLrHlxxC7GO1BQ9eXwz/yush/pOM68POvQcMCrO6iTTrAnlvJU/O0 Ajo/phRNe0v3cefRZQ7HbtuAmBtQHT39Ne+CcoSlo5ResLQtBpLTYx1Bqpij6vuLb1e1 56GphTkY/1z209zj5pP6JPAe4uBFfwZ7R8diTd2Ll9OdjQqn9z40bzvU/9euhOKJH3WS q2XQ== X-Gm-Message-State: ABUngvcflw2RDmVqq6UcPxDKZo/JgEDiBsaFCv9MhILOqMuZxtOfiiGxREhEF43HjBQ5Y5AL X-Received: by 10.176.85.24 with SMTP id t24mr12870318uaa.21.1479220015829; Tue, 15 Nov 2016 06:26:55 -0800 (PST) Subject: Re: [PATCH] Remove cached PID/TID in clone To: Florian Weimer , libc-alpha@sourceware.org References: <1476387924-4509-1-git-send-email-adhemerval.zanella@linaro.org> <58c8bc8e-e643-2d3a-5e57-55a3457ca70f@redhat.com> From: Adhemerval Zanella Message-ID: Date: Tue, 15 Nov 2016 14:27:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <58c8bc8e-e643-2d3a-5e57-55a3457ca70f@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2016-11/txt/msg00493.txt.bz2 On 09/11/2016 10:18, Florian Weimer wrote: > 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. > Right, I think we can update documentation after patch is upstream. >>> > 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)? > I just checked with binutils gdb.threads testcase and saw no regressions. >> 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”? ☹ Ack, I changed it locally. > >> 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). Ack. > > 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. > I also did a full check on aarch64, powerpc64le, and armhf. I also did some basic tests (basically the posix and nptl one involving clone/fork) on a simulated sparc{64} and mips{64} machine to check if I missed something in clone/vfork assembly changes.