From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id BC06C1F8C6 for ; Mon, 30 Aug 2021 10:37:11 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 288653858431 for ; Mon, 30 Aug 2021 10:37:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 288653858431 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1630319830; bh=odosnvFxhtAh9MlQd/ww7dBMRAaIbM5xldxx1wWRD0E=; h=To:Subject:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=T2V6wT58dX+LvyESaWybk6UP7kOXBZqO1vlR+On/Op2CCU1bmdIWWwmUHhJbJgmP/ bqPiu5vGs900aOAHClgzMGBGXk4wuhcuYCEscG9jXSohjVc5XljsYzALLDp+werE5t wPqhHQfZn2VmwECJHSDVi5WVdemC9bjaldfaMSL4= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id A5CA13858D35 for ; Mon, 30 Aug 2021 10:36:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A5CA13858D35 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-462-dgpruD2mNCC1DV2P_Qm_oA-1; Mon, 30 Aug 2021 06:36:49 -0400 X-MC-Unique: dgpruD2mNCC1DV2P_Qm_oA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2640287D542; Mon, 30 Aug 2021 10:36:48 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.194.140]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D5175D9F4; Mon, 30 Aug 2021 10:36:47 +0000 (UTC) To: Adhemerval Zanella Subject: Re: [PATCH v2 06/19] nptl: Replace struct thread cancelhandling field References: <20210823195047.543237-1-adhemerval.zanella@linaro.org> <20210823195047.543237-7-adhemerval.zanella@linaro.org> <87r1eg5l6h.fsf@oldenburg.str.redhat.com> <51cfec46-c7ee-b588-80e1-00a83034c358@linaro.org> Date: Mon, 30 Aug 2021 12:36:45 +0200 In-Reply-To: <51cfec46-c7ee-b588-80e1-00a83034c358@linaro.org> (Adhemerval Zanella's message of "Thu, 26 Aug 2021 13:48:47 -0300") Message-ID: <87zgszqkw2.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Florian Weimer via Libc-alpha Reply-To: Florian Weimer Cc: libc-alpha@sourceware.org Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" * Adhemerval Zanella: >>> diff --git a/nptl/nptl_free_tcb.c b/nptl/nptl_free_tcb.c >>> index cbf3580f59..15e1a18562 100644 >>> --- a/nptl/nptl_free_tcb.c >>> +++ b/nptl/nptl_free_tcb.c >>> @@ -24,22 +24,12 @@ >>> void >>> __nptl_free_tcb (struct pthread *pd) >>> { >>> - /* The thread is exiting now. */ >>> - if (atomic_bit_test_set (&pd->cancelhandling, TERMINATED_BIT) == 0) >>> - { >>> - /* Free TPP data. */ >>> - if (pd->tpp != NULL) >>> - { >>> - struct priority_protection_data *tpp = pd->tpp; >>> + free (pd->tpp); >>> + pd->tpp = NULL; >> >> For detached threads, this is called on the thread after signals have >> been blocked. I don't think this is entirely correct. And things >> become rather interesting if malloc needs pd->tpp. > > Why do you think this is not correct? This is accessed through > mutex code, so I don't think this would matter on the detached > exit phase. > > And what do you mean by malloc needing? free is essentially user code, and we should call user code with all signals disabled. malloc locking could need the TPP facility. >> It's not clear to me whether this could happen before. >> >>> + /* Queue the stack memory block for reuse and exit the process. The kernel >>> + will signal via writing to the address returned by QUEUE-STACK when the >>> + stack is available. */ >>> + __nptl_deallocate_stack (pd); >>> } >> >> That old comment seems to be out-of-date. > > It is still correct I think, __nptl_stack_in_use() now checks the joinstate > which is still advertise by the kernel. I meant: there is no QUEUE-STACK. Thanks, Florian