From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90A5CC7618E for ; Sat, 22 Apr 2023 14:21:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229751AbjDVOVw (ORCPT ); Sat, 22 Apr 2023 10:21:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjDVOVu (ORCPT ); Sat, 22 Apr 2023 10:21:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DAFCE72 for ; Sat, 22 Apr 2023 07:21:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA7A360FC9 for ; Sat, 22 Apr 2023 14:21:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2576C433EF; Sat, 22 Apr 2023 14:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682173308; bh=TaJ9j49RW2ngIjcRgCHX6c2dr/Lco/KmY+TYZiZHHDc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UlT/Bkw/MdMrMbdnGiSFyZQDq+NKep8wtCLvyWlCVGDWzzF22JoDUvbnXC7DNS4eW kvFl9K67SONZaPl5nI3cKe2YsyzWqvvmprOE8n+vi1Vo9O/9uq5C5+ytLRqNVsQu1+ pDJl+Rs080oamOU8W5O93zEQMvmc4c7GY8nW8nN4O5HOnDlYwrhozMjQD8+8Av6RjX rV9QkAxOUlDeDC8Mhpey8q6V7wgaJzkqaKC51YdLPwrB14e/r3RLhxKGDUIrkqj7fp v/kCrhXnk1d80Z8ncNBqlcTKhJnTQR962jd8wmnxRTTsh4voTC+GiDoUQv5mrAmES4 BKMdgsOEwEBKQ== Date: Sat, 22 Apr 2023 16:21:45 +0200 From: Frederic Weisbecker To: Peter Zijlstra Cc: Thomas Gleixner , Huacai Chen , WANG Xuerui , "Rafael J. Wysocki" , Anna-Maria Behnsen , LKML Subject: Re: Loongson (and other $ARCHs?) idle VS timer enqueue Message-ID: References: <87leil2r7v.ffs@tglx> <20230422081700.GB1214746@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230422081700.GB1214746@hirez.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 22, 2023 at 10:17:00AM +0200, Peter Zijlstra wrote: > diff --git a/arch/loongarch/kernel/genex.S b/arch/loongarch/kernel/genex.S > index 44ff1ff64260..5a102ff80de0 100644 > --- a/arch/loongarch/kernel/genex.S > +++ b/arch/loongarch/kernel/genex.S > @@ -40,6 +40,7 @@ SYM_FUNC_START(handle_vint) > ori t0, t0, 0x1f > xori t0, t0, 0x1f > bne t0, t1, 1f > + addi.d t0, t0, 0x20 > LONG_S t0, sp, PT_ERA > 1: move a0, sp > move a1, sp But the interrupts are enabled in C from arch_cpu_idle(), which only then calls the ASM __arch_cpu_idle(). So if the interrupt happens somewhere in between the call, the rollback (or fast-forward now) doesn't apply. I guess interrupts need to be re-enabled from ASM in the beginning of __arch_cpu_idle() so that it's part of the fast-forward region. > diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S > index b6de8e88c1bd..cd6aae441ad9 100644 > --- a/arch/mips/kernel/genex.S > +++ b/arch/mips/kernel/genex.S > @@ -140,6 +140,7 @@ LEAF(__r4k_wait) > ori k0, 0x1f /* 32 byte rollback region */ > xori k0, 0x1f > bne k0, k1, \handler > + addiu k0, 0x20 > MTC0 k0, CP0_EPC > .set pop > .endm The same seem to apply with interrupts being re-enabled by r4k_wait(). Thanks.