From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2071.outbound.protection.outlook.com [40.107.247.71]) by sourceware.org (Postfix) with ESMTPS id C89353858C2C; Tue, 2 Jan 2024 11:57:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C89353858C2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C89353858C2C Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.247.71 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1704196673; cv=pass; b=BA3X9IW2ivMsDMnwNZToi5rGZ0XA69fP87uA6tUTPmEbDn3dPqlHAWe8DrFhHfj11G8ywnYbWYVxGhLz3D8lYBttQRprIZcwtreyq4/eXBSmvg9RLes8OJ2p9t04UehZKUL8AtR1hkyFy/5j27uokEnFteSpwHHpos6oVp5ZoN4= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1704196673; c=relaxed/simple; bh=jR9vKkYhsZaAGXECC0z2T3oFWMWuE0Bx5Ere5mEbKs4=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=FYOO0o18sf6cnKQ/XQqJXMQnioHDWpTP63HmyBX5Iay8HULf2KInKGYFq+316ssjatLc0ZRhVmh7sWcPP2ng7/nixUPc19lIq9onh3B+7aExzm7kkI8yjg7C9NZ1KB5B4Xvn3UuslZ3M7N1FT6bQhyT9GX6iCSxPNcly5jwCvpk= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=iiv2VajwGNmP0FHrbHv/EMwXIBSUeT7fDm62yhflOhXcK62hnhzvYlflBREdRsEO5PuZpIlm6zjdir3TE2dSamDogPWcYD8kXf4pdG0Zqn7pAfAjhUpJc3hCs+DieCETpjA0sYuDXYmgQ7Z+ysXK/kGHfLqQe8iY+3X9a1qQuAA5cEUo846/FxqUfoIUghjZaiPnekd7+NlaIMhFdTzuiCCT2wCc4vpcpVNn7JEwHr1vOSAfW99uUcI3yeI5GOKNXh4xpzDEIU8//uT5olCM6QFsuuBZz9gkOxVYUTlFK5TYI8LKIGM5fMRSboKEVck5SopHGVoS3gyQzcJCT60KaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kx/Lh78N9M4FclvxwhOZynygz3vAtUHyATrfDfFZvf8=; b=NlFRxYgU3NXoQCj/pjfgSYNhjFrHqvh1YYfTNM9+eYZJTQH0arUJ+xoY51zVokhon2VjAxRXVre0+wFuJty/O8XqgoSMmYinUmyVvd1Uv3YWxIs+4ex9m+tnlQ1arWXnKK2M5IHOZn6bQIP5wKahHapaoe38YuWTLB65ZqfyeMMAxuXqKevLPR2jUTPP8G+pKebGuccjq7mqJ/0AI9hy1HN5udexQzg4uazwfTO8haycK/D6C8FSfjQGmHaGr70kcsOFW+5n/aHwcgWh7mw+99lvPpqe77JtlPtdoELjGF5apIkWxCtdTTNJDd2Krr0bBpysUtglen0DIP3ADDw7iA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=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=kx/Lh78N9M4FclvxwhOZynygz3vAtUHyATrfDfFZvf8=; b=bv733WQxqiobSrt4C68ZgXoVf19+wa/V1h3gVjcqsmbABWBm/OzsiQhBmU3TaPuuS2GnIh8RvORHTrSjTbit8PT0pg+Zl600xRKVS4YNQeZekJfIVOTIVWKYwAK8EXs5saTu9iFehOlYPETb/XDRPqYnElIUW61FI3TTe96nc8U= Received: from AS4P195CA0012.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:5e2::18) by AS8PR08MB9244.eurprd08.prod.outlook.com (2603:10a6:20b:5a3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Tue, 2 Jan 2024 11:57:47 +0000 Received: from AMS0EPF000001A6.eurprd05.prod.outlook.com (2603:10a6:20b:5e2:cafe::41) by AS4P195CA0012.outlook.office365.com (2603:10a6:20b:5e2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.24 via Frontend Transport; Tue, 2 Jan 2024 11:57:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass 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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AMS0EPF000001A6.mail.protection.outlook.com (10.167.16.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.9 via Frontend Transport; Tue, 2 Jan 2024 11:57:47 +0000 Received: ("Tessian outbound e243565b0037:v228"); Tue, 02 Jan 2024 11:57:46 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4fe566e483bf3c96 X-CR-MTA-TID: 64aa7808 Received: from 3cdfa7b129c1.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 153FAADC-45C9-4FCC-87BD-5F44C98C53CF.1; Tue, 02 Jan 2024 11:57:36 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3cdfa7b129c1.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 02 Jan 2024 11:57:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LVagSjBwL6vA+NJ1AvFL2C7kCXMn9CwDPM94oDPJy0pIHnQhnu2PVZk7Xtl/rUUCkgTZG+9dr6IinTEbdZ9xQ5Qrt9EgoWwWRwqkQYpZ6IvT1vx9GnXP+dtDaxRIr3gXSH0eScFHzJKbA8YRL9YINjFLa5xu7XqHoqrF+xzQm/Yc9bOLbBmRqRIJIZx1CvkY0UeSrE8lt7NNA5F+3K99AvNuLelZo1oe1Uc8/fXeiCpwEmkVLuhdCas/xbdeeDjEiglJZzvXsUWoaFLfrj+jrf7zcDQyZR6ywGMWkf5DVxzImlksPABz9YYHRCR+Dh2rVEUgiJP5QbW/ASTFvR0whg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kx/Lh78N9M4FclvxwhOZynygz3vAtUHyATrfDfFZvf8=; b=b3wLyjmUQDzxIPaUmN/hU1K4J8VxnUDifyE/31UjmfOscric3janEl5UDbT9biud6zfiXDHpO6TY4rQSRf5lmzI+yOUK5kP8NWL69jaN/SAIeMKwDdUPJEpPr+o+ujC/HD8cugEaSs5apKTcuxrUoRtsTd1/55Rjfpmtc9xUr/f2w2ab2FcjDdnUwBSbR8BFVoZUmxjrFc4GtBHXRLdqo2wfn//r9vRjDCUlzXA7fauT60jJoSIN/KIRoO/YzXQr4cc6Swe3h7q1E446CAQFtz9GxFEVq6/OdST3hm2llIgGKiysfLA1xw/8CAhGQNMkTQBNzU1IdGjCPGo8Jxg9Mg== 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=kx/Lh78N9M4FclvxwhOZynygz3vAtUHyATrfDfFZvf8=; b=bv733WQxqiobSrt4C68ZgXoVf19+wa/V1h3gVjcqsmbABWBm/OzsiQhBmU3TaPuuS2GnIh8RvORHTrSjTbit8PT0pg+Zl600xRKVS4YNQeZekJfIVOTIVWKYwAK8EXs5saTu9iFehOlYPETb/XDRPqYnElIUW61FI3TTe96nc8U= Received: from DB9PR08MB6474.eurprd08.prod.outlook.com (2603:10a6:10:255::17) by AS2PR08MB10267.eurprd08.prod.outlook.com (2603:10a6:20b:647::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Tue, 2 Jan 2024 11:57:32 +0000 Received: from DB9PR08MB6474.eurprd08.prod.outlook.com ([fe80::f3e8:7494:b66a:4197]) by DB9PR08MB6474.eurprd08.prod.outlook.com ([fe80::f3e8:7494:b66a:4197%6]) with mapi id 15.20.7135.023; Tue, 2 Jan 2024 11:57:32 +0000 From: Vaseeharan Vinayagamoorthy To: Lipeng Zhu , "jakub@redhat.com" CC: "fortran@gcc.gnu.org" , "gcc-patches@gcc.gnu.org" , "hongjiu.lu@intel.com" , "pan.deng@intel.com" , "rep.dot.nop@gmail.com" , "tianyou.li@intel.com" , "tkoenig@netcologne.de" , "wangyang.guo@intel.com" , Richard Earnshaw , Richard Earnshaw Subject: Re: [PATCH v7] libgfortran: Replace mutex with rwlock Thread-Topic: [PATCH v7] libgfortran: Replace mutex with rwlock Thread-Index: AQHaKrNAgvrgW4FwQkibsQJ8Fj04OrCo9RAAgAFKI4CAAIPEgIAbzETT Date: Tue, 2 Jan 2024 11:57:32 +0000 Message-ID: References: <20231209153944.3746165-1-lipeng.zhu@intel.com> <523c6fbf-344c-48b8-8508-7e2acb088606@arm.com> <8192480a-1dfc-4bc6-b141-0254364d3fba@intel.com> <49b49e34-59b8-48f3-99cc-12133d76562c@foss.arm.com> In-Reply-To: <49b49e34-59b8-48f3-99cc-12133d76562c@foss.arm.com> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: DB9PR08MB6474:EE_|AS2PR08MB10267:EE_|AMS0EPF000001A6:EE_|AS8PR08MB9244:EE_ X-MS-Office365-Filtering-Correlation-Id: 772bf7d6-7204-4fe0-393e-08dc0b8a0965 x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: cueGQd4qEMN+nVOwKBNeMDiIwp3hmWgRSvXE0qQaL2XzY4rNvs26pJ+nqRiENsGh9skx/2H+6ugcOVFGp6mqQZZ7b6crXR4L0gMODvDki3Hz412R2LMquAtQVIglQvSY+D9OZg6rPyZoZTmQTjPJmVbZfd9WRpItEMkAzvdUGScOcGR3RxlxywjfdKMde6KPWc6tg0DaF+IaapFfVu00hywzh+mnVC32wOquJd0KZh67EFoooKdqDNe/eBtoe4TDx4YKGIWgIa8S6q76Afrnit5XNJn5XNy7lkzuBB7QQs3M53pYDNc2GYP/pdazXV3kbKQSHRgIPgYseZQZsGJZe8R8n9/lRHe1DlN9uXDjGRmZFzflzI+nB8LUx7eTcSfHysBPPZDddfXaidVFC48aAKI8e9gT3F5EXxBdzKd/bJy6MRr2G4afwEzx4qc8fRKrNe2GWrnpqY+nEhZZY/hWWnUkWCKFnyTPFLpFgYEiZxcQ72uF6f/iwbHkUCw/ygni20EtP1fNWRpwzY4J6Daij8xOyCywiVaNZmOUwKB1gjNRzGyTfM6xwJ4ptMjjdibbSdzydI+M/jOFVN5pqgC9hSg8Cm9d55tqR7HEYcjwjKQ= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB6474.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(376002)(39860400002)(346002)(136003)(396003)(230922051799003)(451199024)(64100799003)(1800799012)(186009)(26005)(71200400001)(122000001)(38100700002)(166002)(83380400001)(110136005)(91956017)(76116006)(66946007)(66556008)(66476007)(66446008)(64756008)(316002)(54906003)(966005)(478600001)(1015004)(86362001)(55016003)(5660300002)(7416002)(2906002)(52536014)(33656002)(8936002)(8676002)(4326008)(38070700009)(19627405001)(9686003)(6506007)(53546011)(41300700001)(7696005);DIR:OUT;SFP:1101; Content-Type: multipart/alternative; boundary="_000_DB9PR08MB6474ED87B3E74C094003A1348161ADB9PR08MB6474eurp_" MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB10267 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001A6.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: babfcd72-6480-4bcf-c97f-08dc0b8a007f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tOjffycruzpKKCOJe4FcdN+EJTkPR39laF1USCI2x2BUj/Lmu0Uqe8aYdUHG45+4dsYJuGmHvwWCIRP7PolPNxOxHYhbKKmDvqsKSs3z0GnXoGf8LmjnyAlCdLckiEoLylGTXK7WtXKjM2riH6gcAJCRz3GYE/wpFFxE4RS0z1JbSC8Kwy0YpuhvyFfnGK8ThGkc29U38KCK+JyZF8chXkOf2VQ9yNlS5H1FcIWw9m3Nm9DKB5T0h/pONfRWjTNbLyGEaddWCu1/XBgpoWgxdvIXMDXiBeTx6nl86dR5CEx4TzhXsLGxPkt+TZeSC/F/shddSX9h19LtH76cjQVFc1kwPtVIehEka8g0WSSLqbbI9zsOl6St8nG1XRAwUESxeRaNDciheKH0QHzZsGCwdGcndzkZsqK2gspL1xRWotwl6PBID58jl8r7Tu2x0h6wuDO2Fk/mtKx84MM7DClIWpAzt9IyoOBQdQhOdj1ttZ6CNgAjgfHCqSYKJ/qEaDLKJFz5LOLMemQriz+XRy2XCUH2QaEMZEcmDKkBM46TF82i1SXZJJGu9w+Lhwv3F2Y8TkD/+L6/WGeVXwlkRwyOHQHW5B1rhCgvHkPf/1KpzPgX4sxMtlpgjEhU1kOF2ZunBHuw7lEdqNjB9WDDtZ+xchIxUl2EVbzl0h7y0D43Y72NecDvzEXa2L0emMyL9E/3uFiIZ28kmeHdjaoZK9CHXQptDIMPTwYxrEjznk3FGu0= 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;SFS:(13230031)(4636009)(396003)(346002)(376002)(136003)(39860400002)(230922051799003)(451199024)(64100799003)(186009)(82310400011)(1800799012)(36840700001)(46966006)(40470700004)(336012)(26005)(83380400001)(6506007)(7696005)(9686003)(53546011)(36860700001)(47076005)(70586007)(8936002)(30864003)(5660300002)(4326008)(52536014)(450100002)(966005)(41300700001)(2906002)(8676002)(1015004)(478600001)(316002)(110136005)(70206006)(54906003)(86362001)(33656002)(81166007)(82740400003)(356005)(166002)(40480700001)(40460700003)(19627405001)(55016003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2024 11:57:47.0007 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 772bf7d6-7204-4fe0-393e-08dc0b8a0965 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-AuthSource: AMS0EPF000001A6.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9244 X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,HTML_MESSAGE,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPAM_BODY,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --_000_DB9PR08MB6474ED87B3E74C094003A1348161ADB9PR08MB6474eurp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi Lipeng, It looks like your draft patch to fix the builds for arm-none-eabi target i= s not merged yet, because our arm-none-eabi builds are still broken. Are yo= u waiting for additional information, or would you be able to fix this issu= e? Kind regards, Vasee ________________________________ From: Richard Earnshaw Sent: 15 December 2023 19:23 To: Lipeng Zhu ; Richard Earnshaw ; jakub@redhat.com Cc: fortran@gcc.gnu.org ; gcc-patches@gcc.gnu.org ; hongjiu.lu@intel.com ; pan.den= g@intel.com ; rep.dot.nop@gmail.com ; tianyou.li@intel.com ; tkoenig@netcologne.de ; wangyang.guo@intel.com Subject: Re: [PATCH v7] libgfortran: Replace mutex with rwlock On 15/12/2023 11:31, Lipeng Zhu wrote: > > > On 2023/12/14 23:50, Richard Earnshaw (lists) wrote: >> On 09/12/2023 15:39, Lipeng Zhu wrote: >>> This patch try to introduce the rwlock and split the read/write to >>> unit_root tree and unit_cache with rwlock instead of the mutex to >>> increase CPU efficiency. In the get_gfc_unit function, the percentage >>> to step into the insert_unit function is around 30%, in most instances, >>> we can get the unit in the phase of reading the unit_cache or unit_root >>> tree. So split the read/write phase by rwlock would be an approach to >>> make it more parallel. >>> >>> BTW, the IPC metrics can gain around 9x in our test >>> server with 220 cores. The benchmark we used is >>> https://github.com/rwesson/NEAT >>> >>> libgcc/ChangeLog: >>> >>> * gthr-posix.h (__GTHREAD_RWLOCK_INIT): New macro. >>> (__gthrw): New function. >>> (__gthread_rwlock_rdlock): New function. >>> (__gthread_rwlock_tryrdlock): New function. >>> (__gthread_rwlock_wrlock): New function. >>> (__gthread_rwlock_trywrlock): New function. >>> (__gthread_rwlock_unlock): New function. >>> >>> libgfortran/ChangeLog: >>> >>> * io/async.c (DEBUG_LINE): New macro. >>> * io/async.h (RWLOCK_DEBUG_ADD): New macro. >>> (CHECK_RDLOCK): New macro. >>> (CHECK_WRLOCK): New macro. >>> (TAIL_RWLOCK_DEBUG_QUEUE): New macro. >>> (IN_RWLOCK_DEBUG_QUEUE): New macro. >>> (RDLOCK): New macro. >>> (WRLOCK): New macro. >>> (RWUNLOCK): New macro. >>> (RD_TO_WRLOCK): New macro. >>> (INTERN_RDLOCK): New macro. >>> (INTERN_WRLOCK): New macro. >>> (INTERN_RWUNLOCK): New macro. >>> * io/io.h (struct gfc_unit): Change UNIT_LOCK to UNIT_RWLOCK in >>> a comment. >>> (unit_lock): Remove including associated internal_proto. >>> (unit_rwlock): New declarations including associated internal_proto. >>> (dec_waiting_unlocked): Use WRLOCK and RWUNLOCK on unit_rwlock >>> instead of __gthread_mutex_lock and __gthread_mutex_unlock on >>> unit_lock. >>> * io/transfer.c (st_read_done_worker): Use WRLOCK and RWUNLOCK on >>> unit_rwlock instead of LOCK and UNLOCK on unit_lock. >>> (st_write_done_worker): Likewise. >>> * io/unit.c: Change UNIT_LOCK to UNIT_RWLOCK in 'IO locking rules' >>> comment. Use unit_rwlock variable instead of unit_lock variable. >>> (get_gfc_unit_from_unit_root): New function. >>> (get_gfc_unit): Use RDLOCK, WRLOCK and RWUNLOCK on unit_rwlock >>> instead of LOCK and UNLOCK on unit_lock. >>> (close_unit_1): Use WRLOCK and RWUNLOCK on unit_rwlock instead of >>> LOCK and UNLOCK on unit_lock. >>> (close_units): Likewise. >>> (newunit_alloc): Use RWUNLOCK on unit_rwlock instead of UNLOCK on >>> unit_lock. >>> * io/unix.c (find_file): Use RDLOCK and RWUNLOCK on unit_rwlock >>> instead of LOCK and UNLOCK on unit_lock. >>> (flush_all_units): Use WRLOCK and RWUNLOCK on unit_rwlock instead >>> of LOCK and UNLOCK on unit_lock. >>> >> >> It looks like this has broken builds on arm-none-eabi when using newlib: >> >> In file included from >> /work/rearnsha/gnusrc/nightly/gcc-cross/master/libgfortran >> /runtime/error.c:27: >> /work/rearnsha/gnusrc/nightly/gcc-cross/master/libgfortran/io/io.h: In >> function >> =91dec_waiting_unlocked=92: >> /work/rearnsha/gnusrc/nightly/gcc-cross/master/libgfortran/io/io.h:1023:= 3: error >> : implicit declaration of function =91WRLOCK=92 >> [-Wimplicit-function-declaration] >> 1023 | WRLOCK (&unit_rwlock); >> | ^~~~~~ >> /work/rearnsha/gnusrc/nightly/gcc-cross/master/libgfortran/io/io.h:1025:= 3: error >> : implicit declaration of function =91RWUNLOCK=92 >> [-Wimplicit-function-declaration] >> 1025 | RWUNLOCK (&unit_rwlock); >> | ^~~~~~~~ >> >> >> R. > > Hi Richard, > > The root cause is that the macro WRLOCK and RWUNLOCK are not defined in > io.h. The reason of x86 platform not failed is that > HAVE_ATOMIC_FETCH_ADD is defined then caused above macros were never > been used. Code logic show as below: > #ifdef HAVE_ATOMIC_FETCH_ADD > (void) __atomic_fetch_add (&u->waiting, -1, __ATOMIC_RELAXED); > #else > WRLOCK (&unit_rwlock); > u->waiting--; > RWUNLOCK (&unit_rwlock); > #endif > > I just draft a patch try to fix this bug, because I didn't have arm > platform, would you help to validate if it was fixed on arm platform? > > diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h > index 15daa0995b1..c7f0f7d7d9e 100644 > --- a/libgfortran/io/io.h > +++ b/libgfortran/io/io.h > @@ -1020,9 +1020,15 @@ dec_waiting_unlocked (gfc_unit *u) > #ifdef HAVE_ATOMIC_FETCH_ADD > (void) __atomic_fetch_add (&u->waiting, -1, __ATOMIC_RELAXED); > #else > - WRLOCK (&unit_rwlock); > +#ifdef __GTHREAD_RWLOCK_INIT > + __gthread_rwlock_wrlock (&unit_rwlock); > + u->waiting--; > + __gthread_rwlock_unlock (&unit_rwlock); > +#else > + __gthread_mutex_lock (&unit_rwlock); > u->waiting--; > - RWUNLOCK (&unit_rwlock); > + __gthread_mutex_unlock (&unit_rwlock); > +#endif > #endif > } > > > Lipeng Zhu Hi Lipeng, Thanks for the quick reply. I can confirm that with the above change the bootstrap failure is fixed. However, this shouldn't be considered a formal review; libgfortran is not really my area. I'll be away now until January 2nd. Richard. --_000_DB9PR08MB6474ED87B3E74C094003A1348161ADB9PR08MB6474eurp_--