Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp3595062rwr; Sat, 22 Apr 2023 08:02:47 -0700 (PDT) X-Google-Smtp-Source: AKy350a70DBuRPoMy440yoK2aJNXtA2CMqhgqcNOojum/qCnEUQmA6q2PzXUB4lPIRYmMLBtytJ9 X-Received: by 2002:a05:6a00:1d0b:b0:624:bf7e:9d8c with SMTP id a11-20020a056a001d0b00b00624bf7e9d8cmr9162560pfx.1.1682175767670; Sat, 22 Apr 2023 08:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682175767; cv=none; d=google.com; s=arc-20160816; b=RBIE8C3i02JNiJHWv95u6SYCszIUCZFIQl1Wy3WwgVcyhhiaZddRda/hsl3M1ypAkM +2Q/dwWF5ucPFZo0bXzKauO5f7ZXlUeIkLRwIaQ6hWMwM2ej2jDlVl9Qn/l5h/MgXTwe E5kydYUwH/ZYchyzb7/ncYIArHue379hYSDvyAEKOQF784GTTUYZH7wzYf+S+sEjbkZ1 tBbxAlhrvZGO2Glnr3omEeLuQJ9Soag+wX2X2I4Bo60ReBRuPf4Zqe8fQ/+v/3MipNWC gwUv6LiCmwnEwvhBM8yDSwaAR8vfWB8/xtNwP/m9PrhDJfKmiD8mr0YRoJGr6LIORvM0 pBWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nvP4ZFxccasRksIP8ZIqpwvmRcHLybuSU3zwYkhc8NI=; b=ntSzSkL9AXOQ1FgQ9coQyHG0H1y/ZNX9IMiJ4u4gkw4AMhkuWHv+SIeAA0Jy2K8kYO 9+/8Ea7Q7Z59b6mujwga1rj8AfOKNCrYC1iY1KfvSWi41CiCgWzwPGdPFPu8/4EyT8vt SBKB6QtxcEY7nRynbJRWOMav0+v7VwfNtScInFkyUaLXkH5euyDgYM3O//HjKiS8mYkI K4dveyuvQJ+SdADUyC6UG04GE7UZCkW2i7JMohv33C7aq6PUHI1nULygzzMmiqVMlx8m CcyfcwoJ9rfqZgdy5nVrYIzLkFHhsWbVwrpV9sE6p+mqBmpYEqYUVzXJ9gRayy8HNYtZ 7C8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="UlT/Bkw/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 72-20020a63004b000000b005141738f606si6892248pga.179.2023.04.22.08.02.23; Sat, 22 Apr 2023 08:02:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="UlT/Bkw/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229656AbjDVOVv (ORCPT + 99 others); Sat, 22 Apr 2023 10:21:51 -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> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.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.