From patchwork Fri Apr 5 22:50:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 10887931 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 48D4E922 for ; Fri, 5 Apr 2019 22:50:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26A5128A4E for ; Fri, 5 Apr 2019 22:50:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1938C28B35; Fri, 5 Apr 2019 22:50:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC93E28A4E for ; Fri, 5 Apr 2019 22:50:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726387AbfDEWuj (ORCPT ); Fri, 5 Apr 2019 18:50:39 -0400 Received: from mail-eopbgr740120.outbound.protection.outlook.com ([40.107.74.120]:4924 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726206AbfDEWuj (ORCPT ); Fri, 5 Apr 2019 18:50:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wavesemi.onmicrosoft.com; s=selector1-wavecomp-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AWdQyE4NWb82Aahva76qEhK/y1svkWEIMIlo8/ry+ec=; b=Dv8rRivIp2N8VikWfJrL6XpOF02JD4ti74yVX3m3YXKXmoFfIoMUc+vsDMvg/daWkFTrx+gIgx43X/1gl9oB/g3V1NygE7BmVORBMH9yNxOYA3u3R3VLzmtMRg464vKuAXzHc4TVR5idwoVzCJs7sRysiFxe9eaOTH0A3/eSAkQ= Received: from MWHPR2201MB1277.namprd22.prod.outlook.com (10.174.162.17) by MWHPR2201MB1278.namprd22.prod.outlook.com (10.174.162.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.22; Fri, 5 Apr 2019 22:50:35 +0000 Received: from MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::b9d6:bf19:ec58:2765]) by MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::b9d6:bf19:ec58:2765%7]) with mapi id 15.20.1771.016; Fri, 5 Apr 2019 22:50:35 +0000 From: Paul Burton To: "linux-mips@vger.kernel.org" CC: Paul Burton Subject: [PATCH 1/3] MIPS: jump_label: Remove redundant nops Thread-Topic: [PATCH 1/3] MIPS: jump_label: Remove redundant nops Thread-Index: AQHU7AH7CwG3ZcEkaU69Sdva8A7leg== Date: Fri, 5 Apr 2019 22:50:35 +0000 Message-ID: <20190405225014.15236-1-paul.burton@mips.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR05CA0079.namprd05.prod.outlook.com (2603:10b6:a03:e0::20) To MWHPR2201MB1277.namprd22.prod.outlook.com (2603:10b6:301:24::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=pburton@wavecomp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.21.0 x-originating-ip: [67.207.99.198] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c3acfb56-024c-4311-ae17-08d6ba191d6f x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328)(7193020);SRVR:MWHPR2201MB1278; x-ms-traffictypediagnostic: MWHPR2201MB1278: x-microsoft-antispam-prvs: x-forefront-prvs: 0998671D02 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39840400004)(366004)(376002)(346002)(396003)(136003)(189003)(199004)(486006)(305945005)(8936002)(105586002)(14454004)(25786009)(52116002)(2351001)(476003)(44832011)(6512007)(2616005)(81166006)(53936002)(186003)(5640700003)(107886003)(99286004)(81156014)(4326008)(316002)(26005)(7736002)(8676002)(5660300002)(2501003)(50226002)(386003)(102836004)(42882007)(2906002)(106356001)(97736004)(66066001)(36756003)(1076003)(6436002)(71190400001)(6506007)(6916009)(478600001)(256004)(3846002)(6116002)(6486002)(71200400001)(68736007);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR2201MB1278;H:MWHPR2201MB1277.namprd22.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: wavecomp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: U3S3Bg9uuPAMre6hRQ5jHoLy66FULMQ+6006P1yInS+OMa/FWLbhQsbNadJHKkxR43geoZ3vEoXXThkg6Kh96KBGi4IZ8Ee4aExI2A8lGbhj6zk+FAoVlChuf6OlDkk5r7222kKA/auymArlB4yzhNk+VqVESdaKLqJabLGUrLC8Hxs3Hm3+8OZ5Hf8H79Wg6FXcbB6WH+04PHPTYntH2b+nEz429dZwuhKB1cW8PxYnq4sHHyZ5BZ6eMgdAKf/cqQg6oUjtN8GSVL7fe5NVCCd88af4Mgyvl4Ul7T6RrhHjYe2tQivLpJLqjufHqLUUz+BYYPH8dZ8QFsn6j6wSWlpCezZ66dV2xcoTGcwM7mzn4W/REt9JDCB7pHmts8Xft9GBLGEA/gAATxBAVqllsM7vSYUTCBgl5mxsF3VYWho= MIME-Version: 1.0 X-OriginatorOrg: mips.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3acfb56-024c-4311-ae17-08d6ba191d6f X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Apr 2019 22:50:35.5154 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 463607d3-1db3-40a0-8a29-970c56230104 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR2201MB1278 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Both arch_static_branch() & arch_static_branch_jump() emit a control transfer instruction (ie. branch or jump) without disabling assembler re-ordering. As such the assembler will automatically fill their delay slots. Both functions follow their branch or jump with an explicit nop that at first appears to be there to fill the delay slot, but given that the assembler will do that the explicit nops serve no purpose & we end up with our branch or jump followed by 2 nops. Remove the redundant nops. Signed-off-by: Paul Burton --- arch/mips/include/asm/jump_label.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h index e4456e450f94..df04449b261b 100644 --- a/arch/mips/include/asm/jump_label.h +++ b/arch/mips/include/asm/jump_label.h @@ -29,7 +29,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool branch) { asm_volatile_goto("1:\t" B_INSN " 2f\n\t" - "2:\tnop\n\t" + "2:\t.insn\n\t" ".pushsection __jump_table, \"aw\"\n\t" WORD_INSN " 1b, %l[l_yes], %0\n\t" ".popsection\n\t" @@ -43,7 +43,6 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) { asm_volatile_goto("1:\tj %l[l_yes]\n\t" - "nop\n\t" ".pushsection __jump_table, \"aw\"\n\t" WORD_INSN " 1b, %l[l_yes], %0\n\t" ".popsection\n\t"