From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10081.outbound.protection.outlook.com [40.107.1.81]) by sourceware.org (Postfix) with ESMTPS id C47353972C31 for ; Thu, 21 May 2020 13:30:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C47353972C31 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Szabolcs.Nagy@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=37mAkGt9M6GdW+YaU8ODt1Z2U+RN44rKmTblK/ZxEXw=; b=sQrIZXC7GhZvF/KaeV8c9+PA802SxO+TwPTDcjN74pQ7OS/cSBS/MD1JhRLduqqIbY3+48xFB1oebddopT5S5RM9UmHRpXOlr6Ayki2N5VRbODYVN8QFsEQIHV7x5FCx6o0g5HomQWXz1sd0EFkMKMGgunPkMG2DX3LVU2+AKUo= Received: from MR2P264CA0116.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:33::32) by VI1PR0802MB2607.eurprd08.prod.outlook.com (2603:10a6:800:b9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 13:30:54 +0000 Received: from VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:33:cafe::19) by MR2P264CA0116.outlook.office365.com (2603:10a6:500:33::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.26 via Frontend Transport; Thu, 21 May 2020 13:30:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT041.mail.protection.outlook.com (10.152.19.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 13:30:54 +0000 Received: ("Tessian outbound 952576a3272a:v57"); Thu, 21 May 2020 13:30:54 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0f2648e4d3355add X-CR-MTA-TID: 64aa7808 Received: from ef4ee3ed0ef0.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FBE9B6BA-BA4B-486B-9D5D-2D2C4DA001F8.1; Thu, 21 May 2020 13:30:49 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ef4ee3ed0ef0.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 May 2020 13:30:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KdwbN+av+tC4pfSHQqi3YseKnzd9KBC/RHfz3G84NpphPVmJrt3ltyilrHJcTbGKFLisjmU0frleA5zGHk2h5TYuboEADAiio47LP5eZFpmRnFlnm3SrF1JnEkf3pGQSPwYXBoAArJPpAVSm+tPNP3NBo+0mpofziTNaLj7t0949qndrj+OECnKj2BlYSDXsxNmrb7iIqHTCfYzrMy4rnsd+z3+mZEjRKQ3Sd4va5ENR45uOomWfGE/kbCrlneTCCeqnaS+350rhZwkjfLHMT3JuX8HMP46aPs3yZFoqICZ0kJt547qOUil4Sm2Vn7t6rggqV4ifm4DjKRVuSyU2TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=37mAkGt9M6GdW+YaU8ODt1Z2U+RN44rKmTblK/ZxEXw=; b=EJx3yDNR2cBjTVaWqOtmzLIXG4llcB2DbUghSK2OxytnDYMjD79RH4U2IHq8ZDiCy85JBvqKYnCl845wqijfATKzUAt7TLrhNYp173MirznJamFklWiU9EYmeIbenxqowjoFalcAKNvaBChdT5xG8UUTJSAnwfHhO9Nq0cEp45H/jqoY4T6IGQyWXSxkJTovTdH9APyKxCbT23UEnQZzusRstmZ01zlpBDnxeH1pPip1d+GC4Lhvzs97BNQLRODKwiRfFtaqLZ8exmKYwIXKC/pu6MSHujzbtXqqnsV9KDqFotWJ6VxAMYsM88R/06ufYhkB51fwUCylyG/sJvYhAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=37mAkGt9M6GdW+YaU8ODt1Z2U+RN44rKmTblK/ZxEXw=; b=sQrIZXC7GhZvF/KaeV8c9+PA802SxO+TwPTDcjN74pQ7OS/cSBS/MD1JhRLduqqIbY3+48xFB1oebddopT5S5RM9UmHRpXOlr6Ayki2N5VRbODYVN8QFsEQIHV7x5FCx6o0g5HomQWXz1sd0EFkMKMGgunPkMG2DX3LVU2+AKUo= Authentication-Results-Original: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=arm.com; Received: from AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) by AM6PR08MB5239.eurprd08.prod.outlook.com (2603:10a6:20b:e6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.27; Thu, 21 May 2020 13:30:48 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.3021.020; Thu, 21 May 2020 13:30:48 +0000 Date: Thu, 21 May 2020 14:30:46 +0100 From: Szabolcs Nagy To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 2/2] manual: Document __libc_single_threaded Message-ID: <20200521133046.GH14130@arm.com> References: <2c218c9ed9586ed5491f6fa08045d1e883b126c3.1589998207.git.fweimer@redhat.com> <724ecd59-d6e4-9f52-f425-8a4ff795114f@linaro.org> <20200521130927.GF14130@arm.com> <39687760-f8b1-4209-8798-ed8a16b87b57@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <39687760-f8b1-4209-8798-ed8a16b87b57@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: LNXP265CA0023.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::35) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.55) by LNXP265CA0023.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 13:30:47 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a3ebb027-9b05-4c38-ddee-08d7fd8b301c X-MS-TrafficTypeDiagnostic: AM6PR08MB5239:|VI1PR0802MB2607: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: CVKxNPHonFQME5GPp73Z+tVLv3H6PINqQWr+N6gG0ES0d9HvTg9e79nMMmy8Ab4zTYVeOFRCNYJZEzdhRn49S2PDWc8pGVp71feflG/BDw3jZTkxOTInquhs73OjWd1D2Icj++3n+9wYbfSKSXR5RxFXLQa/ZN3BjYusIbxe88GX6CI57NszY0aAebDxBVvMI3lA0f0EcVWN7cpJdOOK39wlzElT0meV8+b58C9QxiruvE5kOlw/+wmjV/DuHx805wBUCcG7cjEvjUMsRrN8nVnMupP7J9Lm/dmKgyb3zPZQSlQMz8qmAR3PMZM4AgQHbZx8wOLBt75Sq0wMPRNZWX0H+h9SPSvvbOt9rf1WFOL/RD1JtpNBmwmcPAfiUztDr0uEjzOeWmtVxdzBsocYnS3nIf9MrckVsynQcyolez+hJcY0nDgiNb/bGCfYiXwPAdHVpm83vxnGA9NmLjAjAZN7yaOrRSCDNssPLL+RWcQ= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(366004)(136003)(346002)(39860400002)(396003)(52116002)(186003)(7696005)(44832011)(16526019)(1076003)(26005)(2906002)(8676002)(8936002)(6916009)(956004)(4326008)(53546011)(2616005)(36756003)(316002)(33656002)(66556008)(5660300002)(8886007)(66476007)(86362001)(55016002)(478600001)(66946007)(60764002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: HlsFCPF2ajjmLh2SDdSSZrLA0DJWoaa7/yky32zK30B/Iu6D0Z4iJRlx5yJamv5SK9iWAqYaHlIWX9hPMEyaYOBsjI5O8jyx6bDkqJutUPf21ex9bLMeDYl0GiCE0gwLWmMXXr0OqSea1p1HJjQn7h25S3NJgRe6/PjKiUTRhq13JWDjZ1JxJt5SGoABt0DmMh2enTAKxVPCci54vjoT07Pr0lh9OoaBU/q9ggBbZnOEAecM5cbA355iUz1RC75D0+QEmV/izR7dDko6n6w5hN30Os/Cp07dCltUvhaloPZbcoWK8IwE+Bewl/kiuzXc8+S2Ks7HidEVaShMto7jRWbJkQJ2pxsg4u5ucDV/zc/9Cdm3hukHrWuIJTJefhzm791ucsjPRL9WI5AV66fOv1VBgwahzaEaQasXX6BS43I0UTWX4hllKvcvnxKx11WsL2A2JsxI5QW1U5RkHhCtEo3q+0QJ56wWLgMcpAqBNmVDwl5AJAfIDGexfUFAzBpi X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5239 Original-Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(376002)(136003)(396003)(346002)(46966005)(8886007)(33656002)(478600001)(26005)(6862004)(16526019)(5660300002)(1076003)(7696005)(316002)(36756003)(53546011)(186003)(55016002)(36906005)(82310400002)(4326008)(82740400003)(81166007)(356005)(47076004)(44832011)(8936002)(336012)(2616005)(86362001)(956004)(8676002)(2906002)(70206006)(70586007)(60764002); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 43c787a4-5786-4921-628c-08d7fd8b2c10 X-Forefront-PRVS: 041032FF37 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DlB2a3jFMpk3pfwl5a2pUFOEOUHN0l0l0hnYH25rmnYhbS2YSOno01AvA9I3ac1MjDLpePdxZeAOgyr/QwWm8jaL//RYMO9HePJA6qdcrjDL23c8vdpYG05xcMAP4gTybnPKu4u8fOgp3eB35m5DFnZwyoEVNTCAfr+Cd9eKKn1MrqiDG7+dSD6QiczM+SToxYmr5P7w5o1iQjzr4Ugi/mt0eMkWwUQFydMnj0pi73UM5r6jg0ywcZvdQl4y77/YBrFpqUtqVwtdAmKKEvkjpm7Y63Jn2dJsb3QXtVmVIrC4T0WYO5SJznVdQXvS+Jz1zN17iPnnWJfw6qX6FkVhWD/DX+MRoDz2jR6dLs7mD358qWjSWlvocN9Lf2zXH2c5h7Hw5pLVYsSyKQSfnP02v5x3eiKdDeNOvmJhl8fJhwI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 13:30:54.4654 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3ebb027-9b05-4c38-ddee-08d7fd8b301c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2607 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Thu, 21 May 2020 13:31:00 -0000 The 05/21/2020 10:15, Adhemerval Zanella wrote: > On 21/05/2020 10:09, Szabolcs Nagy wrote: > > The 05/21/2020 09:50, Adhemerval Zanella via Libc-alpha wrote: > >> On 20/05/2020 15:12, Florian Weimer via Libc-alpha wrote: > >> > >>> +@smallexample > >>> +if (__libc_single_threaded) > >>> + atomic_fetch_add (&reference_count, 1, memory_order_relaxed); > >>> +else > >>> + atomic_fetch_add (&reference_count, 1, memory_order_acq_rel); > >>> +@end smallexample > >> > >> Shouldn't the access to __libc_single_threaded be atomic itself > >> (at least with relaxed semantic)? > > > > not if we guarantee that this object can only be > > written while the process is single threaded. > > > > (e.g. an exiting detached thread cannot update it > > even if only one thread left.. because that may > > concurrently read it) > > > > OK, so I think we should outline that atomic operations are not required > to acess this object and that once __libc_single_threaded is set 0 it will > continue to indicate non-single thread even thread are jointed or detached > thread finishes. what's wrong with pthread_join updating it? (other than the already mentioned dlmopened libc case) if only one thread left that is doing the join then there cannot be concurent access or any memory ordering problem, the process is single threaded.