Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp4057372imc; Thu, 14 Mar 2019 11:14:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwadIZqtx9aSM9ECjLkpKUYdxDswMnL7OiDJ1/ba5J517lkSa9xE5osaiupxqiYGWIu6eAX X-Received: by 2002:a65:538b:: with SMTP id x11mr35374358pgq.35.1552587243897; Thu, 14 Mar 2019 11:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552587243; cv=none; d=google.com; s=arc-20160816; b=WKaeJIZpXW5KF407eIqJDHxW7rZQu7YBr6OH8FE+ckV3P2JPKU9CHDF6/C3y8rKloU wyj9LBbAJLU+dSvZvY5ESExVMaa8hHsgVrqPNRU1GkSJ44y/AXzeqexR56nCDle3gHBN Houb5Wkx57FU9EZUkkgl5MWfWR/JyWuAn86glBi57HZ09IbHDJYaHMiG6ygYvtmVOAzf SJO0GKruX8Ro+XQh7IWFwlV6Bgi9s6c5WZXg6wjJer+eHoM06g1nwDgDfOnMwnJbGaJY 7DLmFxAKWcIMbuqALIJ6UU1XpKbe8eKXXUcWsASR3xGYcwl0TArUc7e0c9kIxw0xpG1R 206Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:user-agent:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature; bh=vv+/jVCpaQDNAYTPEMv3dEMLJupz+pTeEwW+pgdkKAs=; b=u9clR2s3LoSe7bK5n6+SpwKnc/AB4z4IQ92Dlg+vwNK9KPRvJ6aWCA95ob24V7qt54 MgUYB90AQ0RSZCDg7Rma3tjsNpj2edS0cfdpXN5CvMYz18P2KDb5FBrnY/f65moB5Grk ap7xpr6TKYxpB2iY1VTevOtjeNkq+Qzigyo89u/D1aPZh4HQ5CgcY/ws3X48RLu7JS+h FPIKhEtAts6enxVeLu/FJq/iwdJsg24mtWnWtq6TJ1Tv1EFdh/CkZlAPmtjy9edg/3Ob uHyQnwgl771UF1SczbrxLq6tRG1PQexR9NvCkx0KDao2rMg7cBpF4fccAQBq8JV8pJE9 2NJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wavesemi.onmicrosoft.com header.s=selector1-wavecomp-com header.b=MFlai26N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i13si9996840pgr.58.2019.03.14.11.13.48; Thu, 14 Mar 2019 11:14:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@wavesemi.onmicrosoft.com header.s=selector1-wavecomp-com header.b=MFlai26N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727649AbfCNSNM (ORCPT + 99 others); Thu, 14 Mar 2019 14:13:12 -0400 Received: from mail-eopbgr740111.outbound.protection.outlook.com ([40.107.74.111]:6601 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726531AbfCNSNM (ORCPT ); Thu, 14 Mar 2019 14:13:12 -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=vv+/jVCpaQDNAYTPEMv3dEMLJupz+pTeEwW+pgdkKAs=; b=MFlai26N1W1wCZHtQiqcq/eFxsWCw3RmUGehrR+7HFZ+bT3Y01SPkrt2UDaHzq9P1f1P/rjhO0qoJr1OxzA/khrae8XJSK5wAbJvJBAwLCGTU2NufEXPlUJc7oZYpvGNsscYRciz34KlG0M3umuG6q2D41l7dTJJjUMZl1TNDBo= Received: from MWHPR2201MB1277.namprd22.prod.outlook.com (10.174.162.17) by MWHPR2201MB1759.namprd22.prod.outlook.com (10.164.206.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.13; Thu, 14 Mar 2019 18:13:07 +0000 Received: from MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::b8d4:8f0d:d6d1:4018]) by MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::b8d4:8f0d:d6d1:4018%3]) with mapi id 15.20.1709.011; Thu, 14 Mar 2019 18:13:07 +0000 From: Paul Burton To: Valentin Schneider CC: "linux-kernel@vger.kernel.org" , Ralf Baechle , James Hogan , "linux-mips@vger.kernel.org" Subject: Re: [PATCH 06/14] MIPS: entry: Remove unneeded need_resched() loop Thread-Topic: [PATCH 06/14] MIPS: entry: Remove unneeded need_resched() loop Thread-Index: AQHU2FyFR/j/WMmRLk2V/nucBCrOZKYLcmsA Date: Thu, 14 Mar 2019 18:13:07 +0000 Message-ID: <20190314181306.k6vxmaomyqalhi65@pburton-laptop> References: <20190311224752.8337-1-valentin.schneider@arm.com> <20190311224752.8337-7-valentin.schneider@arm.com> In-Reply-To: <20190311224752.8337-7-valentin.schneider@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0060.namprd02.prod.outlook.com (2603:10b6:a03:54::37) To MWHPR2201MB1277.namprd22.prod.outlook.com (2603:10b6:301:24::17) user-agent: NeoMutt/20180716 authentication-results: spf=none (sender IP is ) smtp.mailfrom=pburton@wavecomp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [67.207.99.198] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 73e27bee-3d1c-4cd0-8a5e-08d6a8a8b5ac x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020);SRVR:MWHPR2201MB1759; x-ms-traffictypediagnostic: MWHPR2201MB1759: x-microsoft-antispam-prvs: x-forefront-prvs: 09760A0505 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(7916004)(396003)(366004)(346002)(376002)(136003)(39850400004)(189003)(199004)(52314003)(478600001)(42882007)(71190400001)(53936002)(68736007)(6916009)(105586002)(106356001)(14454004)(71200400001)(54906003)(229853002)(476003)(44832011)(6486002)(186003)(26005)(486006)(5660300002)(6436002)(1076003)(58126008)(52116002)(102836004)(11346002)(446003)(386003)(6506007)(25786009)(305945005)(7736002)(81156014)(81166006)(66066001)(2906002)(316002)(76176011)(8676002)(14444005)(256004)(8936002)(4326008)(97736004)(99286004)(33716001)(6246003)(3846002)(9686003)(6116002)(6512007);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR2201MB1759;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: ZDVnl515RHW9f80w7xSDf6hTRiBpx3ohrmEHmo+acpgZEiPLEIrStzeQOtXbn35atxgH+ok0lRGZxXibHMcPfNtzA+gzkvjBXdZQLBfP2lA7D2vlVSsq2cBdDC/Z6LmZ7ajtpAFCi3qOzKCWwQ87wuAJoLI8sx6ezquIGrqQ5Hv0awm7PPCHVwZ8Q/DszKaxbEFDTWvUDWVwNIYbDfJfB/IZa0x1+jML6/FbA6jnimToSZJZTJXTaiA/i77K71BdmiDnbWXCsWt61SqXopRyO5nvlHiCZvFVZXcJyEpeoqJfC+xjSh/2om9Z/Ieo0DfY146HET1uQMaTWyiDYalJtb/8Gzl5iOGWGsUTA2WY6nsKzlrJ0wL4nJlVO0WD1MHMPynpyXLVsn5jVZNBaXNnWBq19ItVrLdKh0bVMqHtOHU= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: mips.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73e27bee-3d1c-4cd0-8a5e-08d6a8a8b5ac X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Mar 2019 18:13:07.8992 (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: MWHPR2201MB1759 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Valentin, On Mon, Mar 11, 2019 at 10:47:44PM +0000, Valentin Schneider wrote: > Since the enabling and disabling of IRQs within preempt_schedule_irq() > is contained in a need_resched() loop, we don't need the outer arch > code loop. >=20 > Do note that commit a18815abcdfd ("Use preempt_schedule_irq.") > initially removed the existing loop, but commit cdaed73afb61 ("Fix > preemption bug.") reintroduced it. It is however not clear what the > issue was and why such a loop was reintroduced, so I'm probably > missing something. It looks to me like commit a18815abcdfd ("Use preempt_schedule_irq.") forgot the branch to restore_all, so would have fallen through to ret_from_fork() & done weird things. Adding the branch to restore_all as you're doing here would have been a better fix than commit cdaed73afb61 ("Fix preemption bug."). > Signed-off-by: Valentin Schneider > Cc: Ralf Baechle > Cc: Paul Burton > Cc: James Hogan > Cc: linux-mips@vger.kernel.org > --- > arch/mips/kernel/entry.S | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) >=20 > diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S > index d7de8adcfcc8..2240faeda62a 100644 > --- a/arch/mips/kernel/entry.S > +++ b/arch/mips/kernel/entry.S > @@ -58,7 +58,6 @@ resume_kernel: > local_irq_disable > lw t0, TI_PRE_COUNT($28) > bnez t0, restore_all > -need_resched: > LONG_L t0, TI_FLAGS($28) > andi t1, t0, _TIF_NEED_RESCHED > beqz t1, restore_all > @@ -66,7 +65,7 @@ need_resched: > andi t0, 1 > beqz t0, restore_all > jal preempt_schedule_irq > - b need_resched > + j restore_all One nit - why change from branch to jump? It's not a big deal, but I'd prefer we stick with the branch ("b") instruction for a few reasons: - restore_all is nearby so there's no issue with it being out of range of a branch in any variation of the MIPS ISA. - It's more consistent with the future of the MIPS architecture, eg. nanoMIPS in which branch instructions all use PC-relative immediate offsets & jump instructions are always of the "register" variety where the destination is specified by a register rather than an immediate encoded in the instruction (the assembler will fix it up & emit a branch anyway, but I generally prefer to invoke less magic in these areas...). - A PC-relative branch won't generate an extra reloc in a relocatable kernel, whereas a jump will. Even better would be if we take advantage of this being a tail call & do this: PTR_LA ra, restore_all j preempt_schedule_irq (Where I left the call to preempt_schedule_irq using a jump because it may be further away.) Though I don't mind if you wanna just s/j/b/ & leave the tail call optimisation for someone else to do as a later change. Thanks, Paul > #endif > =20 > FEXPORT(ret_from_kernel_thread) > --=20 > 2.20.1 >=20