Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752897AbdDJVfU (ORCPT ); Mon, 10 Apr 2017 17:35:20 -0400 Received: from mail-sn1nam02on0081.outbound.protection.outlook.com ([104.47.36.81]:33680 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751660AbdDJVfS (ORCPT ); Mon, 10 Apr 2017 17:35:18 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=caviumnetworks.com; From: Yury Norov To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Yury Norov , Peter Zijlstra , Ingo Molnar , Arnd Bergmann , Catalin Marinas , Will Deacon , Jan Glauber Subject: [RFC PATCH 0/3] arm64: queued spinlocks and rw-locks Date: Tue, 11 Apr 2017 01:35:01 +0400 Message-Id: <1491860104-4103-1-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [217.118.90.188] X-ClientProxiedBy: DB6PR0501CA0032.eurprd05.prod.outlook.com (10.168.78.146) To CY1PR0701MB1275.namprd07.prod.outlook.com (10.160.149.18) X-MS-Office365-Filtering-Correlation-Id: f36992d6-991f-449f-9cf7-08d4805979b0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:CY1PR0701MB1275; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1275;3:DRv/jsB77lVN+ml64s5wqPG/7g4XtSDk0WJiB5iSIpdikeH79ddANc4T7wEc2vCE1aY8FyiAPnltqXsXHb0PhKcbKXF2ZMFycpB5i7d6tPDkWKHrn2yqwRi7Tr3lmA8/jC0QfJayp7L19D8M2zL+42Q0Wv3veGK/IXgiZEvC4Hic32Q/sGMeTwIxUnqL4JjF1ZJqWdkAQP2uDVART5FH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fUY0j617ooCedF7iOQHkVrysKiax/qqqMMLT2w9uvwxdDsPYJmt+2nXd8tq9bez2z+SQXU7z82AtYgArIUjiAQwDXV5y1hA/cY+NUQV/M+NqlJuvrUMzy7E3sf5ytlwC3EyB8QxnEjFhXLygxgnjynF3gRsWPsoenrsNiXrNxcLxPtMLBxZ5C2cfdmQYWbMAMMKboapT7Akn6CNcpUuqUeuaiM2HlL2bRWjDGJUB7P4LMuhOQ8qssZwzYfWoYf+XtC8W0YTE87y55zvEZ8BLd2awspDo5vHZJ7/4SmcRJkIcK+4SPrE9dYFRlOq0n2E0r34PlTc1UmzsU5v3YNYTm0NYHN/hj7OUSQsFee7Z0YfiW7xuz1y/uO8sgbpVWSJoL3wrFFWiqixsmYZJct24bnNN0xfm/hY0va3bNlFZkMTjoh/3PTMkMdK8xtmSU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(6072148);SRVR:CY1PR0701MB1275;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0701MB1275; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1275;4:wBFcCydTf6jI6BQLG1kXPP1UXBIHCmBb+h4YsPVcv0k14l0w+QlqbP+vcLseSEt4acy2B+9DuVAa9yvQKkyRbda7i1y2nZTBbPNH4XELQGvjw3G8e7IgKTD1aEX4eRtZPq5dTo13Oy6ALAZUMIjPaGuTMTwE2Xxlryo9jAIOmBGhK8in5YdYZWuUrjCtZXCFEEH+F7pSYa+U2M059h2NmDDFf7MUBVp/+wO+2dfJOWhZ3RGK6y6CvQC37nhSL2Ga+3LVOgox5t0qrRmZl8x3dX3p0aShi4fnIOg0VNSbubTe7hBZeo2P0wzfgnX5pQ6EJ/o+b6tDiJD1an7asPxkNT5Fr9xbLCxpDXgS/c0E0+Va+F2CKpXMyc8xaQY0Q4XyPRkc/CwLmKw+EhF0m7JzcNlNC6V/e1ZnYertk8HqtmeEEy7MIq/AivUlijl/g2/3r2JP1KcLQuI+Md5vSuYpTtpC7HRtLSsFl8fHorGdsOAU4jHLEuiBWkj3aE28oEckfy3u720MK4p6ElH+L68LxCxWsssKfSRCLVv+arKOCFAMbtROOwgTwsHpb/QAqfD3fBLOhfsHakxFSzrO5huqZZD3jaUeLoJkgQqZaTD5v0ubFpLgL2qrLR639y5ES27l+v4C73DHvw1jIW39FOX8HsT/q5TK3rH86nYud6Ya55hrzNvtsVwu8kczUhs4SY66sTQmyC3/CbZpDswHJT8Upg== X-Forefront-PRVS: 027367F73D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(979002)(6069001)(6009001)(39850400002)(39840400002)(39410400002)(39400400002)(39450400003)(36756003)(25786009)(4326008)(5003940100001)(6496005)(189998001)(47776003)(2906002)(6116002)(110136004)(3846002)(107886003)(38730400002)(305945005)(48376002)(81166006)(8676002)(33646002)(50226002)(7736002)(50466002)(6666003)(76506005)(5660300001)(6486002)(50986999)(66066001)(42186005)(54906002)(53936002)(217873001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0701MB1275;H:localhost;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0701MB1275;23:NKNqbwAIqFqvxXur7oxy0CT4YgEZP53ojrmS6ku?= =?us-ascii?Q?HKB87lVOCKXOmpHZtT+QvTDC/8mAKxk+peKaxkXxkVIU0wsa6WliXY+eTCCi?= =?us-ascii?Q?LDiKh4bao1ADcSA0uNsiJDMlweTXRjIATEy2V7IxfuSERBe2nZI+21wfakZ/?= =?us-ascii?Q?9kFlaITAZZ7rOqGeD561AxwJ1yD6VFFVk6qRDMtMbW/CPSVTAY19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mUv9MDLesC4KiTAGtkdg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1275;6:dupxw9734WiaaOwuCDeEdYXEqEpwS3iOZoNNm6p9jrors7gTNyEwRQEUUxQQqM2tG7+2hB/YhhhzOVAlv/Kw/YuRQC1RHfb6WpPa4hw4yX6nU4udVL1uV0g/kCSABG4Vx+eS7R0Reo+4lhnu5lp3pI0GE4r53spSba7elTKITuhDeqeUvNBPK9X0AtdRwfQt5+qNcRIRQBQu4F4Qj2wu1qFmg+R1cbbzcTcZ/tbtq6m+BYCmd92HOIHnRn5K+OUlHcUw9tDWx1YbS4D+t5rwLawMaaIfJQohgHhx8qL1FMb/jg5kVATbJGf0NGiLEc9B0BNvFg91T053fulom6pGrDrQoF5F/I7BgcK9M5OeJ2QMiKCcd7yAUrKtN1yDAgTNkitaBda+cO1Mt0JuLQk0IyYrXuHaoaKJBW9IlJya0eQi9hUWnheINfDri/+hFuEJdorlyA/TCKvlbkDMPb6znw==;5:blsoIbkOyQxkoYPoNVuZSZt6I1CYmKow7/gXVJJ1l75x+DC395UbZc6rtO042IlmAUjUSXtFPaTeN3p0MAtxjseenI4tUg83MskOme9IrUTVTlL0soiCrAqkULDBChoV9INbgaGOZQmou/QOTvdrFQ==;24:u2LBOzhJ24hF2J8xFnIB/UYaxaRHtkpH3ozSAAiCFKL8Is19o7IiRkZqhqvSrAi8AD3+DEAmV+q5f4CcJw2Jyp2NrYtUzusRs/nhoI7979I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1275;7:vCWzWSkJC5QLu5xl0xQjIn2VjrMxEXfLQdY8QVkQ7k9AMSRVkz/IfdZHTEqFO48pb5E+siCB3m6Wpu5fk+0I8DnwueMIMdaDB+cV1mxFwPqPU+AcHKRfFQZlLYzUILuecufZp4rgAz4WqZMUw6RwMqzOO+1UQpLq72x5jxoK4xT4eTgYiz5PcMIhY0X9+iO6RgnmLBnWUUl+aAgR9mZ4feeD/WbCkY7N11QiIG09fU0zr7WYEq5cyeNMQViAmLQMl3h6hrBSrFTUNep5ijP50qzsOWh+FoOu97GJhHGKNVMtY3QDTdci04PGAZ4n4prrwaY/2PPG42tuqfsyJrKgOA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2017 21:35:14.3140 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1275 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1721 Lines: 45 The patch of Jan Glauber enables queued spinlocks on arm64. I rebased it on latest kernel sources, and added a couple of fixes to headers to apply it smoothly. Though, locktourture test shows significant performance degradation in the acquisition of rw-lock for read on qemu: Before After spin_lock-torture: 38957034 37076367 -4.83 rw_lock-torture W: 5369471 18971957 253.33 rw_lock-torture R: 6413179 3668160 -42.80 I'm not much experienced in locking, and so wonder how it's possible that simple switching to generic queued rw-lock causes so significant performance degradation, while in theory it should improve it. Even more, on x86 there are no such problems probably. I also think that patches 1 and 2 are correct and useful, and should be applied anyway. Any comments appreciated. Yury. Jan Glauber (1): arm64/locking: qspinlocks and qrwlocks support Yury Norov (2): kernel/locking: #include in qrwlock.c asm-generic: don't #include in qspinlock_types.h arch/arm64/Kconfig | 2 ++ arch/arm64/include/asm/qrwlock.h | 7 +++++++ arch/arm64/include/asm/qspinlock.h | 20 ++++++++++++++++++++ arch/arm64/include/asm/spinlock.h | 12 ++++++++++++ arch/arm64/include/asm/spinlock_types.h | 14 +++++++++++--- include/asm-generic/qspinlock.h | 1 + include/asm-generic/qspinlock_types.h | 8 -------- kernel/locking/qrwlock.c | 1 + 8 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 arch/arm64/include/asm/qrwlock.h create mode 100644 arch/arm64/include/asm/qspinlock.h -- 2.7.4