From patchwork Wed Jan 27 20:36:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Sverdlin X-Patchwork-Id: 12050999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3ED0C433E6 for ; Wed, 27 Jan 2021 20:37:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 934D264DD4 for ; Wed, 27 Jan 2021 20:37:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233238AbhA0Uha (ORCPT ); Wed, 27 Jan 2021 15:37:30 -0500 Received: from mail-eopbgr50094.outbound.protection.outlook.com ([40.107.5.94]:65020 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232987AbhA0UhX (ORCPT ); Wed, 27 Jan 2021 15:37:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MQg35D5m7YXE596DRXqGBdBVUmR1rocubCJ/klLuUFUErHP/IAizpzOkXEGSyj+9NX7t5Gkp1PTeUzgD6IlJdvkvDqwVJrUNFMWOl1GLSkkLn1xoKQEKFzqP9i39wu/JUV78nCVgCdO1TdvGS+rFpeQ8VtAFMoJ6Abj5UhN7PGt8Vlm6KmYDMylibb5tRzip/AoqvsWinFsh3aC+mEt9QgVcpnkny1bc2NYeYKDb9vGIpymurEk6t7jes0gpsWXmN2P0TKyc241aJV5am907c7I4d+GZzZDtGks962lGDrBsmEpqV1gDw+AIrUvky0mXQgqud68cWF9+yKcmr9BXbg== 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=OhihKUSaFiOfu/Po6EFhpmEeUqLfLhBNOF3c6m/6qaU=; b=UqfvBLd26m1NOc3KdiQSYqCAfzY4ZmgaOsez9U3ZmJqWyT+819csDKwHgg3O1zhRBKkyQguzJhMaGKDucO2Vd8G6fS9XvhD5WXjVCZNdfrK7PLeuKahgKdNbkFIOmKhw0IQNO51Ahaj0IB0FaQmbm9cMjZdSWXjsSt/d6XqOZz3rYtSIBJJBRZYvchdOXQQtICh73sT8rK8gSeBJzltu8NVbvTenVCGYkzuNyKihypMUHgUbFKEnJQtR40pBhEKndesI9SqUqWfER5C9K6R9q4g8WLA5D/TsflyUvnuWlY40JfMkpEfbpy6hxRKOS85NceAKEG112HqMulwAOcpKdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.2.8) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nokia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nokia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OhihKUSaFiOfu/Po6EFhpmEeUqLfLhBNOF3c6m/6qaU=; b=H/kCBbHm0YWrPqEtrSXGeRpBIJITMzjgz8yxvm/RWXb5lN+rGSUXBpE0VoqGJJiLq+3Ka1t+vHsKwTF55KuZvVcMOauf+SYDiVDrOZpLibwiAMF/5G8tE93tgDSroKv2pY+VFIoj/oMsLNkGylC7QF55h4srhgyR1FnRr0jhugo= Received: from DB6PR07CA0082.eurprd07.prod.outlook.com (2603:10a6:6:2b::20) by DB7PR07MB3947.eurprd07.prod.outlook.com (2603:10a6:5:11::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.11; Wed, 27 Jan 2021 20:36:34 +0000 Received: from DB5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2b:cafe::56) by DB6PR07CA0082.outlook.office365.com (2603:10a6:6:2b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.7 via Frontend Transport; Wed, 27 Jan 2021 20:36:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.2.8) smtp.mailfrom=nokia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nokia.com; Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.8 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.8; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.8) by DB5EUR03FT043.mail.protection.outlook.com (10.152.20.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Wed, 27 Jan 2021 20:36:34 +0000 Received: from ulegcparamis.emea.nsn-net.net (ulegcparamis.emea.nsn-net.net [10.151.74.146]) by fihe3nok0734.emea.nsn-net.net (GMO) with ESMTP id 10RKaU56012891; Wed, 27 Jan 2021 20:36:30 GMT From: Alexander A Sverdlin To: Paul Burton , linux-mips@vger.kernel.org Cc: Alexander Sverdlin , Thomas Bogendoerfer , Will Deacon , Peter Zijlstra , Boqun Feng , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH 1/6] MIPS: Octeon: Implement __smp_store_release() Date: Wed, 27 Jan 2021 21:36:22 +0100 Message-Id: <20210127203627.47510-2-alexander.sverdlin@nokia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20210127203627.47510-1-alexander.sverdlin@nokia.com> References: <20210127203627.47510-1-alexander.sverdlin@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 869a0cb6-4be5-42cd-3a58-08d8c3033cf3 X-MS-TrafficTypeDiagnostic: DB7PR07MB3947: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:154; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6LmrZp5bpVy8gD1xIcStJUfmQdpR4VKRWn8zVJ/phzm5m+Jt5reqfxINm8v7qAqfs/sUap+dRM+OVD41fZOFKd4NBOM0pQ+e6rsdOAOz1xOJCKJ1EjV+bRp4KBomSi7HhytdtrJ9aZ1tlOLHBNg7pUl4RDK9200dj8PdUFUs2kzGrJnHLYQB0ZIsPYL0uO/NyncBkqIixQpnRSRPXiW0qXHGhNxjzyRwpBgv6QhdUx9SpEQ9R8M66UpPkiHsJ3IMzrXLbI5u7M4yWSOgSH9ZLxTOfxwt+MyO8ydOw1xgretRpooknDF+LQs/IrvPA3N7F6vP7MoqdnBWW5JEAnjvj+5WwTP/otjWKwuHJaInsbB7fsNiFwajzuuaXnU3i0A2H6iydLdw9Bo+3WZEueNRPQauo7BWT3o2HyCwVrgolJy/j6UAFR49G0/YnPVPIfEm63bKmKhOC+6ZZIqv+z1dxzBr/yF5Uv2O6LZuQtUaZm/OvC28p5OZ9dX1IQbUtPejAyrn+jfcL4rZ2uuTtpf+94rVlwUuIEiZzIfBJfolHDr1tMzHl/QPyxn8/9Cm3Sp2OR9Rhfe4MJHKcKIJahEpfe7zhw4feI/W5YENnA4oPR/hyEX36GXVeKoKkVXB5xH59LyhGieN1A31Oh1wOxxPGdaq8B3qdaTRgQqYq++kpDtqxaHFnE4Wk8UzuIEQqtiigBtfLMCja30T2qGJoCB1/A== X-Forefront-Antispam-Report: CIP:131.228.2.8;CTRY:FI;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:fihe3nok0734.emea.nsn-net.net;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(346002)(39850400004)(136003)(376002)(396003)(46966006)(336012)(82310400003)(8936002)(5660300002)(47076005)(8676002)(70206006)(70586007)(1076003)(186003)(54906003)(966005)(2616005)(316002)(478600001)(82740400003)(356005)(4326008)(36756003)(26005)(86362001)(81166007)(2906002)(6666004)(83380400001)(36610700001);DIR:OUT;SFP:1102; X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2021 20:36:34.6757 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 869a0cb6-4be5-42cd-3a58-08d8c3033cf3 X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0;Ip=[131.228.2.8];Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR07MB3947 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Alexander Sverdlin On Octeon smp_mb() translates to SYNC while wmb+rmb translates to SYNCW only. This brings around 10% performance on tight uncontended spinlock loops. Refer to commit 500c2e1fdbcc ("MIPS: Optimize spinlocks.") and the link below. On 6-core Octeon machine: sysbench --test=mutex --num-threads=64 --memory-scope=local run w/o patch: 1.60s with patch: 1.51s Link: https://lore.kernel.org/lkml/5644D08D.4080206@caviumnetworks.com/ Signed-off-by: Alexander Sverdlin --- arch/mips/include/asm/barrier.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h index 49ff172..24c3f2c 100644 --- a/arch/mips/include/asm/barrier.h +++ b/arch/mips/include/asm/barrier.h @@ -113,6 +113,15 @@ static inline void wmb(void) ".set arch=octeon\n\t" \ "syncw\n\t" \ ".set pop" : : : "memory") + +#define __smp_store_release(p, v) \ +do { \ + compiletime_assert_atomic_type(*p); \ + __smp_wmb(); \ + __smp_rmb(); \ + WRITE_ONCE(*p, v); \ +} while (0) + #else #define smp_mb__before_llsc() smp_llsc_mb() #define __smp_mb__before_llsc() smp_llsc_mb() From patchwork Wed Jan 27 20:36:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Sverdlin X-Patchwork-Id: 12051001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 247B2C433DB for ; Wed, 27 Jan 2021 20:38:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6DF660C3D for ; Wed, 27 Jan 2021 20:38:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233263AbhA0Uhf (ORCPT ); Wed, 27 Jan 2021 15:37:35 -0500 Received: from mail-db8eur05on2104.outbound.protection.outlook.com ([40.107.20.104]:61504 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233034AbhA0UhZ (ORCPT ); Wed, 27 Jan 2021 15:37:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fa1Nunt/tagweIL666iENRZVgv15W0cb13cmj8iS+6VzC0J2H9IWAM7RejH+XJ4IcXGxy657WIN2iAFNkKwNOpGMUIaLV8riz5mqUip4sf+TeJpRycGCHAer6YsecPUFUp+0pY0IlBGIYAjrMX/RqxWJNuNqi63o/ibSPVc35JEXn6EmT/9kTUhPBgw8COx7EGUdSWCfdofzOLSlPsHJ9h+U8iVOpBGW0G9NyoSc4j+r8L42zv+Ld1N3By3SnhYNf7XPdmHn68Ymu23tGIysdBvJ2+c9RhsI8myaooC+ddO/ZmBkm/vyjPTftMxWIY4FdjkMZrTf3a2IrwYBOJ8YGw== 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=1E6q0iZUlrLJAN2FP1h8BU3gkn+HjMa0LqC7mjF6k+8=; b=JzaztCu1oOUxijHUpuUMqOjBQ5oNeyU+Dc/1bKM9YM9843XY1xLpE1urtkOCX/khXhCSieus55DkedGzIvR7UpJaAihCA7FcgK6OuPX0onoixQ6Pd6f+JdkH1220xtYSqiQlGAXz/B0KTwsAasQ7gwkSMbjkSN9tS9KKEvQ23Fynp5v/ls/yjuQZLhAxiXU5roKVujJoU0SX2sGA2A/uPAuWemkQQfzdCf6Ru+0umPrCp6JwzDHUSTxWDDM27JLgjvRN1gq1UIVAV3GgPLy4hSddHK/lQfluWqx0JllQpo27is5Epprq7Xe1539eBx9ZFH0RF42tTSKSXasRSAqRkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.2.8) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nokia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nokia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1E6q0iZUlrLJAN2FP1h8BU3gkn+HjMa0LqC7mjF6k+8=; b=ktmJNKEvmjgmq+JEaMZXn1mVfI0/dNVtmcO+gxFGByxUB+zEAyoEmb8I9kArGDHjiMM8trBugiwl3+1bCmklWeld9poBxWBBwZgROcwp2CPNp1IQllkmYx3qXlT/RyBwBCyl499lXijMelrKtGhavMvfHsaBls15Gct0a571wbI= Received: from DB9PR02CA0002.eurprd02.prod.outlook.com (2603:10a6:10:1d9::7) by VI1PR07MB6286.eurprd07.prod.outlook.com (2603:10a6:800:134::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.13; Wed, 27 Jan 2021 20:36:35 +0000 Received: from DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1d9:cafe::f) by DB9PR02CA0002.outlook.office365.com (2603:10a6:10:1d9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17 via Frontend Transport; Wed, 27 Jan 2021 20:36:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.2.8) smtp.mailfrom=nokia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nokia.com; Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.8 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.8; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.8) by DB5EUR03FT033.mail.protection.outlook.com (10.152.20.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Wed, 27 Jan 2021 20:36:35 +0000 Received: from ulegcparamis.emea.nsn-net.net (ulegcparamis.emea.nsn-net.net [10.151.74.146]) by fihe3nok0734.emea.nsn-net.net (GMO) with ESMTP id 10RKaU57012891; Wed, 27 Jan 2021 20:36:31 GMT From: Alexander A Sverdlin To: Paul Burton , linux-mips@vger.kernel.org Cc: Alexander Sverdlin , Thomas Bogendoerfer , Will Deacon , Peter Zijlstra , Boqun Feng , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH 2/6] MIPS: Implement atomic_cmpxchg_relaxed() Date: Wed, 27 Jan 2021 21:36:23 +0100 Message-Id: <20210127203627.47510-3-alexander.sverdlin@nokia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20210127203627.47510-1-alexander.sverdlin@nokia.com> References: <20210127203627.47510-1-alexander.sverdlin@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 7209ce51-a3b7-43f6-7ea7-08d8c3033d2c X-MS-TrafficTypeDiagnostic: VI1PR07MB6286: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:330; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ur5BaJb3AaFmNF0idcAGCcx9o+ueBySN9bA3sDDjk/g3oKCr06Otth20kLlx2dtlLPEgw0I2mqg2mNlCGTnykHNcVzOKWLvWULBVIep6oa1hsJYouY8Yy+d8jByLDCGE8tY7vdVt5tj2D/nte0hyF4D2Bm9hgdHjXbRtNalSWbTdCDinWhF7gXNL2MdrvvC6CWeIvvROUvrjK2D4Cwo8fJf8vq9mpM2yiIK3pRyzYT2GEC71GUy2lT/0BFZEZC/QQgATM2sqN9SHsCJYgNQBxY+PCrKD6eYOQ2OsaSpYtPCgjkFq5hMOtalzJI4EjhHVl9f35Ld53CL/tBBaVfjweUEFDsGln3ST+G82E5TNkv6WL4ZfWzbxePg761xQ9x4M4pPt6iIFes0S6CtdLEgQoqZHZOfh0MnkldDIGVGXNzXz9+gkkzw47VentKtMqFIbgXRup0s2OwD/AMN4uLyfoQ7TYrlrr+RnYhSJucAJ9OmLXzG5G9THLmnh49+q8hGk1fDMVFFIKDPS9Bf593FGBTac8IAcUQbtnnaaG2LDKfLEUIgz2B1HsOkcuHWrTbwdtuz4eaVm1LgLT4sRR1lywgJY0LIzrTEmW5XpB928H/dsuKSsDomY13UKVLP9KP6l X-Forefront-Antispam-Report: CIP:131.228.2.8;CTRY:FI;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:fihe3nok0734.emea.nsn-net.net;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(346002)(376002)(136003)(39850400004)(396003)(46966006)(86362001)(82740400003)(70586007)(5660300002)(4326008)(1076003)(478600001)(83380400001)(2616005)(82310400003)(356005)(81166007)(47076005)(6666004)(54906003)(2906002)(36756003)(8676002)(26005)(336012)(186003)(316002)(8936002)(70206006)(36610700001);DIR:OUT;SFP:1102; X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2021 20:36:35.0580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7209ce51-a3b7-43f6-7ea7-08d8c3033d2c X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0;Ip=[131.228.2.8];Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6286 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Alexander Sverdlin This will save one SYNCW on Octeon and improve tight uncontended spinlock loop performance by 17%. Signed-off-by: Alexander Sverdlin --- arch/mips/include/asm/atomic.h | 3 +++ arch/mips/include/asm/cmpxchg.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index f904084..a4e5116 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h @@ -264,4 +264,7 @@ ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd) #undef ATOMIC_SIP_OP +#define atomic_cmpxchg_relaxed(v, o, n) \ + (cmpxchg_relaxed(&((v)->counter), (o), (n))) + #endif /* _ASM_ATOMIC_H */ diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h index 5b0b3a6..620f01a 100644 --- a/arch/mips/include/asm/cmpxchg.h +++ b/arch/mips/include/asm/cmpxchg.h @@ -182,6 +182,8 @@ unsigned long __cmpxchg(volatile void *ptr, unsigned long old, (unsigned long)(__typeof__(*(ptr)))(new), \ sizeof(*(ptr)))) +#define cmpxchg_relaxed cmpxchg_local + #define cmpxchg(ptr, old, new) \ ({ \ __typeof__(*(ptr)) __res; \ From patchwork Wed Jan 27 20:36:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Sverdlin X-Patchwork-Id: 12050995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91502C433E0 for ; Wed, 27 Jan 2021 20:37:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49DA364DE1 for ; Wed, 27 Jan 2021 20:37:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233039AbhA0UhZ (ORCPT ); Wed, 27 Jan 2021 15:37:25 -0500 Received: from mail-eopbgr150090.outbound.protection.outlook.com ([40.107.15.90]:29088 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232972AbhA0UhW (ORCPT ); Wed, 27 Jan 2021 15:37:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dSB6Dkk+vYx8TmdHHp4ie3236eld5qZgZOCncuLzwzS5g2F4aqW1jxwuhtxB4KX2FmDKyscPXeFRKE6flYRkXHsRoxc1++w0eDXONWLmDxo0Kb+J1n27LFaEJSUYfxEnnfOPwElK4OGdsFFE/3UfBT+9o2v0FAFoXWhAhFpTHllBQfRGwUh+WU5pJA4/8I9jSxO0FmyNwQ53fPnOd78rROFsODQoi+YnfuiepqsWAtwvQ8ehQQ89AJgTHLhwmlKKVcH3YZW3vT1BAlTYRnh9bEchuaAy7e0hAzFLhVYF7OMoKlVgPQCqIrP8Cm/s/ryhdhLj+YTOdhCEQnF1TiqGhA== 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=hv5sxBfY+E03ThtPYiZDyZSqf6P6M9iWhyNQlTHrAIc=; b=oecoGLMyAxptkYNXRiFz/icl0el2QnVxz6PewtFIlcX9kB2YDoLIvMgSkru7CQIweBaOb0far16fgche0C7KxePw69LYnsnEzpwXT8crdY41iBqlxH2VOnlg7+C1F2VuJJRpkeY4vzBbyPehXztjfBZx0BZfDH9TlkhmXjG+2kd1jM/olPj5WStJt/CdCx45sRIwUe2PWSEmR9wdYZ3OZ5R9x9Wb8WcVpmOd6ZMKeqVgG9ln3oKAeWTPsfijZQ8RFCLzW/WO9W9DYnF1dNmay4YcEH4QWYs2pejNChtZ+i4aDmdolf7RQoZyUDCB7/m18IsEDJXAqm8qEjwixuqLDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.2.8) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nokia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nokia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hv5sxBfY+E03ThtPYiZDyZSqf6P6M9iWhyNQlTHrAIc=; b=U8FsWakgrowyQtA/4xxP55IaK4+3CpP7jIVcExXeITo+A65wnuUB+N8YErK9R6KUMy1OdwHWmRsG2auOEnVfJKYaudz6edeG7ROZ6/hbLchNsoP8lPOzCXBll0K4Z+PFH+mNVA7WnT/GGyqr/FZkX4ePTofqjeocj6Pd3J1aoD8= Received: from DB6PR0301CA0077.eurprd03.prod.outlook.com (2603:10a6:6:30::24) by AM6PR07MB4104.eurprd07.prod.outlook.com (2603:10a6:209:32::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.5; Wed, 27 Jan 2021 20:36:33 +0000 Received: from DB5EUR03FT064.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:30:cafe::4e) by DB6PR0301CA0077.outlook.office365.com (2603:10a6:6:30::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17 via Frontend Transport; Wed, 27 Jan 2021 20:36:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.2.8) smtp.mailfrom=nokia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nokia.com; Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.8 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.8; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.8) by DB5EUR03FT064.mail.protection.outlook.com (10.152.21.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Wed, 27 Jan 2021 20:36:33 +0000 Received: from ulegcparamis.emea.nsn-net.net (ulegcparamis.emea.nsn-net.net [10.151.74.146]) by fihe3nok0734.emea.nsn-net.net (GMO) with ESMTP id 10RKaU58012891; Wed, 27 Jan 2021 20:36:31 GMT From: Alexander A Sverdlin To: Paul Burton , linux-mips@vger.kernel.org Cc: Alexander Sverdlin , Thomas Bogendoerfer , Will Deacon , Peter Zijlstra , Boqun Feng , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH 3/6] MIPS: Octeon: qspinlock: Flush write buffer Date: Wed, 27 Jan 2021 21:36:24 +0100 Message-Id: <20210127203627.47510-4-alexander.sverdlin@nokia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20210127203627.47510-1-alexander.sverdlin@nokia.com> References: <20210127203627.47510-1-alexander.sverdlin@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: aa150b75-3079-4491-a426-08d8c3033c50 X-MS-TrafficTypeDiagnostic: AM6PR07MB4104: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7zpVYX7PRjqP2UeSHoRahVgmeFwnDJn5D7hb71GhHE/4x6R3mybqa/8lcnv5b65JVRaJHXXz609sEFMa6RLZnT/ZBiHHYnycHbULHtYB4cHrSz3gsWm3oEhy5aB4iuzmBqbTzor97+7i7v+iH8W4cJrqk+k2jMKNbifAfZfWIy1juau7BZmQVz7StJF85Fi1sWu9E8odAxkOUVtCxvVQ6ix1BdGcIcgfNBz6RgXWsAhiI/65gprkNbgnVtT1Y05gnWBX/DXO3htsP+JubpomspyDZT74M8SMIKeSRJnelQK2TV4+PFErN2wStABCMUFIZ1DRkMfPyTstiEmr9zyXZaGEsv/flZgTQGn/bO+zsxveYTBVDgEEMojRNYYQGmzO659VTNtBPnFrKwmN604dx4D3tI47BLM9tH5btKMiJ60misu55s3SQiQ6dki3jQZtJb94neI3T8Mx3T10+VKkEZbbCmu+niXPuTZx4b6S0knvW6hoIG1qxheS3p3Si7wrs8Pc7h8OQ82HeHgvXtjYCTyYq5A+7uPsXvRfUo/BL4ZAhf6FN0ZBWxg3PM+PzJPcy+braHJ8c5qDuWcscgapdcDzOafFyPCJt8o9OG6MSZfiGbwHDCd0FMcqmwgw3EMZ X-Forefront-Antispam-Report: CIP:131.228.2.8;CTRY:FI;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:fihe3nok0734.emea.nsn-net.net;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(136003)(39860400002)(376002)(396003)(346002)(46966006)(2616005)(26005)(81166007)(4744005)(82310400003)(36756003)(4326008)(8936002)(336012)(356005)(186003)(2906002)(83380400001)(70206006)(5660300002)(82740400003)(478600001)(6666004)(70586007)(86362001)(47076005)(54906003)(1076003)(316002)(8676002)(36610700001);DIR:OUT;SFP:1102; X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2021 20:36:33.6197 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa150b75-3079-4491-a426-08d8c3033c50 X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0;Ip=[131.228.2.8];Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR07MB4104 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Alexander Sverdlin Flushing the write buffer brings aroung 10% performace on the tight uncontended spinlock loops on Octeon. Refer to commit 500c2e1fdbcc ("MIPS: Optimize spinlocks."). Signed-off-by: Alexander Sverdlin --- arch/mips/include/asm/spinlock.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/mips/include/asm/spinlock.h b/arch/mips/include/asm/spinlock.h index 8a88eb2..0a707f3 100644 --- a/arch/mips/include/asm/spinlock.h +++ b/arch/mips/include/asm/spinlock.h @@ -24,6 +24,9 @@ static inline void queued_spin_unlock(struct qspinlock *lock) /* This could be optimised with ARCH_HAS_MMIOWB */ mmiowb(); smp_store_release(&lock->locked, 0); +#ifdef CONFIG_CPU_CAVIUM_OCTEON + nudge_writes(); +#endif } #include From patchwork Wed Jan 27 20:36:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Sverdlin X-Patchwork-Id: 12051007 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2401C4332B for ; Wed, 27 Jan 2021 20:38:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95A5464DCC for ; Wed, 27 Jan 2021 20:38:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233317AbhA0Uh4 (ORCPT ); Wed, 27 Jan 2021 15:37:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233273AbhA0Uhh (ORCPT ); Wed, 27 Jan 2021 15:37:37 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0701.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::701]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A53AC061573; Wed, 27 Jan 2021 12:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MmRyNoZPIATE6iGF11uRQ+I7Trnktjxqz149JvvXoA4I8mcshViftsVrA97KP1bH93XfOVmF/jXv8hV/p6oftLOItyw9apAMgemDSpNyrkQ05oLg+vKj1GNXr9F8lkn8wja+BydMOgrBHu1iir6nIvi1vA7kGyWhY1fibu382bJG4zNiV09JLJYqaVQ6pLIj7YpRtzZyIrr3jjKnXzr9dAi6h8HmwW0FaRRJkod2Zj8olm+O/VYIpLWe47vOP0sj5jL3AR6HceTALZoiki7MXxtOSyhFcNB2kQtJMonaGz7FpNGWnmZEG/kk+YKxebRTmCOYBIhoWBEGgG64r56K8A== 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=NshxQjnJpvYF38or6xGSO+XGc2LUDRde2ZP9K65eUqY=; b=HUqb9zQ6qTXCaXDoDcW8aUnfkkKQu06LJThSsfqdbxh38JcOhFdrnUo7SrjrA455Pbqmjqrp/sine0TagZOaW+Didlqhqdak1I/gelTpETYHUXnykPZ3D7c6q3tDfSuIoDxt/+VebwuJe9BJ2hRJCRCrcmE3d7hEdFY4VEZlemGq6Ii2BDokT9L+Oy2KA90NoRZrc5R1ToqQUZqDVRm+BN6bCN9U/lNvKyHX4oOnwx5RjSZLbYVdohwWxRyqMl70R9JQU7gBsHijywfZa6s5/FK5FJJXnseZvUg/wVvR/3Tdtdm8gcPSHBRFDQmO7iaEFDrCfWDJLuPIuAAcL/YrgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.2.8) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nokia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nokia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NshxQjnJpvYF38or6xGSO+XGc2LUDRde2ZP9K65eUqY=; b=gR1w+YEbBF0miXk85GA2kLPwrKL507nzuQNdRllWXTM1rWTQH1nSxya6ZevaDO30fd1hSGlDzPoHiK1AhNNif/LSHzQZUJ3PLICcjGGUus0WBF2UzMMj7ym8+8aLuQezXEbgdKhSAJtZO8tNTrnwdnJ6aVa1i8OzEBJSbSwM+1s= Received: from DU2PR04CA0142.eurprd04.prod.outlook.com (2603:10a6:10:231::27) by HE1PR0701MB2762.eurprd07.prod.outlook.com (2603:10a6:3:95::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.6; Wed, 27 Jan 2021 20:36:34 +0000 Received: from DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:231:cafe::bb) by DU2PR04CA0142.outlook.office365.com (2603:10a6:10:231::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17 via Frontend Transport; Wed, 27 Jan 2021 20:36:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.2.8) smtp.mailfrom=nokia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nokia.com; Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.8 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.8; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.8) by DB5EUR03FT005.mail.protection.outlook.com (10.152.20.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Wed, 27 Jan 2021 20:36:34 +0000 Received: from ulegcparamis.emea.nsn-net.net (ulegcparamis.emea.nsn-net.net [10.151.74.146]) by fihe3nok0734.emea.nsn-net.net (GMO) with ESMTP id 10RKaU59012891; Wed, 27 Jan 2021 20:36:32 GMT From: Alexander A Sverdlin To: Paul Burton , linux-mips@vger.kernel.org Cc: Alexander Sverdlin , Thomas Bogendoerfer , Will Deacon , Peter Zijlstra , Boqun Feng , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH 4/6] MIPS: Octeon: qspinlock: Exclude mmiowb() Date: Wed, 27 Jan 2021 21:36:25 +0100 Message-Id: <20210127203627.47510-5-alexander.sverdlin@nokia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20210127203627.47510-1-alexander.sverdlin@nokia.com> References: <20210127203627.47510-1-alexander.sverdlin@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 8a9629a6-88ea-4acf-29e2-08d8c3033c9b X-MS-TrafficTypeDiagnostic: HE1PR0701MB2762: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1775; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2Wb4STMAi9rmI9koGnUY3UZacoMw2dgzY+i63Lxz29Z+wkIJ/yrnhHZZOsSMHZUPk/ILKz48aSOvW5JVcJj99xhY+QhEM+rpCPKU7/2/0B5Qct6w9ZCDbGUpHOmq6lA2+VPz319ABEHn4dLgoY+O25Lbme4VdEvT/JfV3fiRrHdfZ+Xxbp3CO9RdH88sBgC1q6UcNc0VHxeP8pIhorvOByrSI3Se5z9F9plgWGdM9CDGfzu7J1XzhzllPi8CtoSHoVQxnFh2RT4lkExpHQmfdqAHRY2bnY6GsFVjkC1dT3wCtMlfrNmtLtkxN1uCPDstPJVhs8p/LS3iVFZEWsjNep1DWqLRDFhBwpzVWYLDy3j5KScvPRmeVMZxhgv/mucuedCbaVYWdeKSMK3MfcHHHlPBWcs5kUHVlHDlhyOsHuYwGqP5abC1Afi6zQrD1sTq38AgSRuVu6T+16gvdNcGoUEbanfE9HF8kTFkthJkyNRoesZ57Pv3O8cFSYj7IwkLFBkQrgaLMFBrn19xP4L1iskbBNY8qGaZFmoMhFxZJCjFvwZlNOUm0TNgw34NJNUSyuh28Ne7XSvx/sPw0zAoY1yE5NlHFsEuPw/lRHu5xmLYIbagAfXnyqhGbiRskWSD X-Forefront-Antispam-Report: CIP:131.228.2.8;CTRY:FI;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:fihe3nok0734.emea.nsn-net.net;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(396003)(39850400004)(376002)(346002)(136003)(46966006)(1076003)(82740400003)(8936002)(5660300002)(70586007)(356005)(4744005)(54906003)(47076005)(6666004)(36756003)(2906002)(83380400001)(81166007)(26005)(86362001)(186003)(2616005)(70206006)(82310400003)(316002)(478600001)(336012)(4326008)(8676002)(36610700001);DIR:OUT;SFP:1102; X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2021 20:36:34.0685 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a9629a6-88ea-4acf-29e2-08d8c3033c9b X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0;Ip=[131.228.2.8];Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0701MB2762 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Alexander Sverdlin On Octeon mmiowb() is SYNCW, which is already contained in smp_store_release(). Removing superfluous barrier brings around 10% performance on uncontended tight spinlock loops. Signed-off-by: Alexander Sverdlin --- arch/mips/include/asm/spinlock.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/include/asm/spinlock.h b/arch/mips/include/asm/spinlock.h index 0a707f3..fbe97b4 100644 --- a/arch/mips/include/asm/spinlock.h +++ b/arch/mips/include/asm/spinlock.h @@ -21,8 +21,10 @@ */ static inline void queued_spin_unlock(struct qspinlock *lock) { +#ifndef CONFIG_CPU_CAVIUM_OCTEON /* This could be optimised with ARCH_HAS_MMIOWB */ mmiowb(); +#endif smp_store_release(&lock->locked, 0); #ifdef CONFIG_CPU_CAVIUM_OCTEON nudge_writes(); From patchwork Wed Jan 27 20:36:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Sverdlin X-Patchwork-Id: 12050997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77082C433E6 for ; Wed, 27 Jan 2021 20:37:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A93264DD4 for ; Wed, 27 Jan 2021 20:37:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233106AbhA0Uh0 (ORCPT ); Wed, 27 Jan 2021 15:37:26 -0500 Received: from mail-db8eur05on2104.outbound.protection.outlook.com ([40.107.20.104]:22368 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232973AbhA0UhW (ORCPT ); Wed, 27 Jan 2021 15:37:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AA4X445DrhqyiQyg0fpZLeJwGdpT4F5KsYADtLpufIJkwg+JxYke5vlTWKVWif2AQ4RbrSOaQVshGVU5JpSNLM5h1pxooYf2kyQEdyRkWr0b7zg0DEn1q/jNh01+hOc+lqlLSaomH5o3zHx2KToits1PwDNuRBv92LAwTny90I/5iUYClYjMHy+AzMKnFMWADwkX9EQjetYa6LbBX4yIK3lWHL3AbO/6HFgH2hqXC8VaEnP7uwR/om2HkGClxDLqfigjuomWxTm+WeAlGYPxApVo9EwOqeqQ7mGSTMHcnwO+/huLxjIpfMjFvHzLITeFjob+tTiYXW0SQW+Rr2cJ+Q== 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=erRHtwvKGpJ4wisYoVWjX+2Bv+ZLsI7q/gr2VPRD6oM=; b=SHjc1y9HWlpaque96YPCZ/gL6Qfg2Ib7bFWdYU4CRh/N6IVBUowtP9vFfDycITk93nIw7hsDgFtgLoPVJSu8Sp32p1dG4gB19cR8p3TmxSiLfuyrgY5C0jLsgLtaO0k/KJ5odaRBz1B7kqWYm7CUM73gCMdb/IxTnXMScZw7+J/2oOxX6DheZt3Yknm3CgrR9FrgjLv+oe05cLBS6hyXPa2RU7jRyCiwHIisuDphPMfKwokb6TL0jrZu+bJaBcOTg/0ryjTxuPHx0m7VnrNtqbYP3kQv+eFv0lpkOr6VfnG/XligDUnbvCx/7z5OSV5qYI36zbQKkfS+iktrQEenJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.2.8) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nokia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nokia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=erRHtwvKGpJ4wisYoVWjX+2Bv+ZLsI7q/gr2VPRD6oM=; b=kQ2mjBBPAeVI27VJS7v4An2HSYGGQSXOWh3Sl0x1B7VH8OT3GaDq5Zgb2q03wVojhq3lir/cqo25vYnUE3rLr3FLWWwUfnjW7rf5HHfLARFX/ejwzBO/MiTLDEt1vle1mF2sXvDRJ0D/sl1Gq29lLn2p7E8kLfEb172JLDq9FBE= Received: from DB6PR0301CA0090.eurprd03.prod.outlook.com (2603:10a6:6:30::37) by VI1PR07MB6319.eurprd07.prod.outlook.com (2603:10a6:800:132::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.5; Wed, 27 Jan 2021 20:36:34 +0000 Received: from DB5EUR03FT064.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:30:cafe::63) by DB6PR0301CA0090.outlook.office365.com (2603:10a6:6:30::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.16 via Frontend Transport; Wed, 27 Jan 2021 20:36:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.2.8) smtp.mailfrom=nokia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nokia.com; Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.8 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.8; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.8) by DB5EUR03FT064.mail.protection.outlook.com (10.152.21.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Wed, 27 Jan 2021 20:36:34 +0000 Received: from ulegcparamis.emea.nsn-net.net (ulegcparamis.emea.nsn-net.net [10.151.74.146]) by fihe3nok0734.emea.nsn-net.net (GMO) with ESMTP id 10RKaU5A012891; Wed, 27 Jan 2021 20:36:32 GMT From: Alexander A Sverdlin To: Paul Burton , linux-mips@vger.kernel.org Cc: Alexander Sverdlin , Thomas Bogendoerfer , Will Deacon , Peter Zijlstra , Boqun Feng , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH 5/6] MIPS: Provide {atomic_}xchg_relaxed() Date: Wed, 27 Jan 2021 21:36:26 +0100 Message-Id: <20210127203627.47510-6-alexander.sverdlin@nokia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20210127203627.47510-1-alexander.sverdlin@nokia.com> References: <20210127203627.47510-1-alexander.sverdlin@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 282db76a-c421-4522-87e8-08d8c3033cd6 X-MS-TrafficTypeDiagnostic: VI1PR07MB6319: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:983; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dhe8qmhJLrsVUbMOZiYZJjkhPWwFV3yxGFRBO5KX9W4pCNabUxDdAebTfgMv2NZ7TEPxMoLNivoV3KyYwRaXOjV9rYfkPfXgDShv1fZyWlpgOaw8phhVaVGMsstHI+XoHEqw3uY/c8CsOL/WoYg+gPL7aRIhfrO1JdzX15UVaX6TtShYMzz6CQhU//NV8l3YYQCPQn/6Z7tbtxZhUzxJpK3KPXp6zeuC0F2zQvQzVjVw53Rm2fnB/TLjVuPsIHpN1R4dOWoMCDBcBfSwhtcusEDw7EWx2gmNftB+Vi80xsBbVPXNP1h7AWw2fTXjkIQn+IlT4h1AcMticRowYpvvZ6aYXXgkUPE7Liqe7Bl5CwuZvoT6ols2cKaLBi9QaI7D1COR2+EwETTSrTqkVGSF/RHtpM7bcyZiTd0ecitdI6ctTQMfECXBlBLcUYVqS9Fokth5kVKh7l1IjxPKB/liaxlJgQ9uzYum0wjKZ9Wb+Jbpqsild6S4xuUgq4QDKURBrzAyZVP6QdC6rWcYXMIzq7hD217JS/xJXho1mctXzYPB7AUSdvSxsjQNlZ4E/qTcV1HBl8r9wHziG5MH4wjFVCrjguXWJfoXU78go0K7G9cME+knE618l19wW+Mv5k6x X-Forefront-Antispam-Report: CIP:131.228.2.8;CTRY:FI;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:fihe3nok0734.emea.nsn-net.net;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(39850400004)(396003)(376002)(136003)(346002)(46966006)(82310400003)(6666004)(83380400001)(8936002)(5660300002)(86362001)(186003)(36756003)(2616005)(26005)(356005)(4326008)(478600001)(70206006)(82740400003)(8676002)(81166007)(316002)(47076005)(336012)(2906002)(54906003)(1076003)(70586007)(36610700001);DIR:OUT;SFP:1102; X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2021 20:36:34.4957 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 282db76a-c421-4522-87e8-08d8c3033cd6 X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0;Ip=[131.228.2.8];Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6319 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Alexander Sverdlin This has the effect of removing one redundant SYNCW from queued_spin_lock_slowpath() on Octeon. Signed-off-by: Alexander Sverdlin --- arch/mips/include/asm/atomic.h | 2 ++ arch/mips/include/asm/cmpxchg.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index a4e5116..3b0f54b 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h @@ -266,5 +266,7 @@ ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd) #define atomic_cmpxchg_relaxed(v, o, n) \ (cmpxchg_relaxed(&((v)->counter), (o), (n))) +#define atomic_xchg_relaxed(v, new) \ + (xchg_relaxed(&((v)->counter), (new))) #endif /* _ASM_ATOMIC_H */ diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h index 620f01a..7830d81 100644 --- a/arch/mips/include/asm/cmpxchg.h +++ b/arch/mips/include/asm/cmpxchg.h @@ -110,6 +110,10 @@ unsigned long __xchg(volatile void *ptr, unsigned long x, int size) __res; \ }) +#define xchg_relaxed(ptr, x) \ + ((__typeof__(*(ptr))) \ + __xchg((ptr), (unsigned long)(x), sizeof(*(ptr)))) + #define __cmpxchg_asm(ld, st, m, old, new) \ ({ \ __typeof(*(m)) __ret; \ From patchwork Wed Jan 27 20:36:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Sverdlin X-Patchwork-Id: 12051003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 452A9C433E6 for ; Wed, 27 Jan 2021 20:38:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 052AF64DC4 for ; Wed, 27 Jan 2021 20:38:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233274AbhA0Uhh (ORCPT ); Wed, 27 Jan 2021 15:37:37 -0500 Received: from mail-eopbgr80115.outbound.protection.outlook.com ([40.107.8.115]:6023 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233007AbhA0UhZ (ORCPT ); Wed, 27 Jan 2021 15:37:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gmYsFyStjzw+k3b+H5aC5KqxWB7/FpijtI4Rfg/kXWxJtUQvPBQZHEq9aU+YGmOHOEFSYdNl0dJu4f/UtYU012bpEmKf4wHOxclCRMzJ2ZANqEo09K4aiOxYcCm3/otd5DFNrp0Xzd6sPSzE6nP97PsMvVn1P3fGhHDhd3LzTEnPhSOtUhJaJuy3RJWVDJcCq7IuwFVx3XfzmY/L/KZjHbFGSnOWgCFjVAtrK+cco96LOAf06Xnl6VssFyRHBR15fq22h5qRjS/ek1f/OmfOYabIcLh0fZisKbFTjtODn+2GPaimNSDfyx18VJoJpZgRu/w/Zwv1TphdGmJfWb39fQ== 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=m0VF7CIkSqajuP5A/wIiq5v1lQ7dOtJa9PN+eZYq9Tw=; b=DHjJaLmDr/m/Vq0yKat+elxoGlPMtUvDO7w8ymR+8BlKwrC74W69vodQZsM/NcQYvO6HkmG373jMEGYGAUIaCiVUxRGNgDDaDKulG+LsB8gIJbzwkeoFvzIC3oQZIx1HYQ7R1Us6WbUz6r10SBWA1N17GULWWHY9unCNNf5T1EZoGn2VscLKY0imfCoRfH5wPmx4E3W5CvKlLKzJ1sa42igP4lxV5D86XrLaQwT+ypuvelo6yZmcqqtM0b6ldL5ymG38qG5GXbMX2HMHuyKhhDPiD5HXI8IvO+tcJUKDv3XB+yTmAnyZb/vP0L41ovWq2FZu5sRWN0JvJssz0+oEkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.2.8) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nokia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nokia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m0VF7CIkSqajuP5A/wIiq5v1lQ7dOtJa9PN+eZYq9Tw=; b=gJIX1DjK2OF7U3XsEm8aqFjrCz1Vc/IEVV1Lonz5VQcAyA3hm8qLGsd4KUfjXgzFoRkbnwFOKy6rxu5Cr70qOi8wUS/kuIpqc9ObTmLtiHMXNhEQ7L4tfEgTBURSID8umCpFg3XCjtwiz2lPKk27Svjd7wf8IEzsXMqqkaxO/Pw= Received: from DU2PR04CA0097.eurprd04.prod.outlook.com (2603:10a6:10:230::12) by VI1PR0701MB2351.eurprd07.prod.outlook.com (2603:10a6:800:6b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.7; Wed, 27 Jan 2021 20:36:36 +0000 Received: from DB5EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:230:cafe::ee) by DU2PR04CA0097.outlook.office365.com (2603:10a6:10:230::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.16 via Frontend Transport; Wed, 27 Jan 2021 20:36:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.2.8) smtp.mailfrom=nokia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nokia.com; Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.8 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.8; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.8) by DB5EUR03FT035.mail.protection.outlook.com (10.152.20.65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Wed, 27 Jan 2021 20:36:34 +0000 Received: from ulegcparamis.emea.nsn-net.net (ulegcparamis.emea.nsn-net.net [10.151.74.146]) by fihe3nok0734.emea.nsn-net.net (GMO) with ESMTP id 10RKaU5B012891; Wed, 27 Jan 2021 20:36:33 GMT From: Alexander A Sverdlin To: Paul Burton , linux-mips@vger.kernel.org Cc: Alexander Sverdlin , Thomas Bogendoerfer , Will Deacon , Peter Zijlstra , Boqun Feng , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH 6/6] MIPS: cmpxchg: Use cmpxchg_local() for {cmp_}xchg_small() Date: Wed, 27 Jan 2021 21:36:27 +0100 Message-Id: <20210127203627.47510-7-alexander.sverdlin@nokia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20210127203627.47510-1-alexander.sverdlin@nokia.com> References: <20210127203627.47510-1-alexander.sverdlin@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 1bfb8e9a-2deb-455f-1f96-08d8c3033d21 X-MS-TrafficTypeDiagnostic: VI1PR0701MB2351: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gY7BMeMCLB/HwkDiHJrWfKPhPVV7yJZfndL+Ffcn0PTrr25EcynO/rhNeJvnRJ8WIfBxaheq+rqtzUhijQZTPNlJPXwx/D6l42H6nPjYICzns2rCB1ppR4oloWtet7wyJrrCMI8AUJ8gJpBSRS5oDZ5WHzHOKKmWisuQOpzRehwG22XxlZFvN1WuMNVasYrmQ2gCR1N3NBlZtmchc6EjLsKsbSUq2SREQgOH3ajqIyXsvWQQnsja3boVJLlf8U1NnqUzknvi1gZZOcpizfR0QJg8p602tXsmZfRvvVl2g8AKJbfGZQnJX9LRZwl5W5zKHKaBs3qgcIMM5l4Q+fY/x4r57YucfKWp43GSMv41v4IwtRCZYQxiHqGYgniC22zq2s+3zX/9z7RtgExuLy4i5CoPF9RQjvkcKiBhZDT+raUFPSDAIprjCMHzm2dHiItSiF9qjSIkpfcpR4VJLeBHJIpNnpC8a8SMFPJBz/F7Rhu25NHWc7nHOsNcKB5Q5Hh8a9SLHuuJyv1sDn/t5Xeu9BiM30O3vca7IaR2TYoyAnvKvZURGD4aNv6R8HzPyb1Yorjn9NIsrdZf1L2H7aJvzqJNLyhaX77nbgwMZD3uMiHAbIfZcLt8LEWfBZszWPv8qKmfW9IldTAgw4qWJ9SNOg== X-Forefront-Antispam-Report: CIP:131.228.2.8;CTRY:FI;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:fihe3nok0734.emea.nsn-net.net;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(39850400004)(396003)(376002)(346002)(136003)(46966006)(2616005)(2906002)(54906003)(478600001)(26005)(316002)(8676002)(4326008)(36756003)(86362001)(47076005)(186003)(1076003)(70206006)(6666004)(336012)(8936002)(82740400003)(82310400003)(70586007)(83380400001)(356005)(81166007)(5660300002)(133343001)(36610700001);DIR:OUT;SFP:1102; X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2021 20:36:34.9854 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1bfb8e9a-2deb-455f-1f96-08d8c3033d21 X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0;Ip=[131.228.2.8];Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB2351 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Alexander Sverdlin It makes no sense to fold smp_mb__before_llsc()/smp_llsc_mb() again and again, leave only one barrier pair in the outer function. This removes one SYNCW from __xchg_small() and brings around 10% performance improvement in a tight spinlock loop with 6 threads on a 6 core Octeon. Signed-off-by: Alexander Sverdlin --- arch/mips/kernel/cmpxchg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/kernel/cmpxchg.c b/arch/mips/kernel/cmpxchg.c index 89107de..122e85f 100644 --- a/arch/mips/kernel/cmpxchg.c +++ b/arch/mips/kernel/cmpxchg.c @@ -41,7 +41,7 @@ unsigned long __xchg_small(volatile void *ptr, unsigned long val, unsigned int s do { old32 = load32; new32 = (load32 & ~mask) | (val << shift); - load32 = cmpxchg(ptr32, old32, new32); + load32 = cmpxchg_local(ptr32, old32, new32); } while (load32 != old32); return (load32 & mask) >> shift; @@ -97,7 +97,7 @@ unsigned long __cmpxchg_small(volatile void *ptr, unsigned long old, */ old32 = (load32 & ~mask) | (old << shift); new32 = (load32 & ~mask) | (new << shift); - load32 = cmpxchg(ptr32, old32, new32); + load32 = cmpxchg_local(ptr32, old32, new32); if (load32 == old32) return old; }