Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp144555rwr; Tue, 25 Apr 2023 19:16:09 -0700 (PDT) X-Google-Smtp-Source: AKy350YHbhvubtofiuy7orGESmhAegml8OKvl5QC4pTBE6BbJLg2hlZF1G9feVMT1EysGLrwo+5z X-Received: by 2002:a05:6a00:2e0d:b0:63b:7119:64a9 with SMTP id fc13-20020a056a002e0d00b0063b711964a9mr27606381pfb.16.1682475368966; Tue, 25 Apr 2023 19:16:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682475368; cv=none; d=google.com; s=arc-20160816; b=zxC4ets0e8SXqf+gKAh62eEbxxGhoChZoaXPxiC613d6qQAqr19Huo8dMJg9+cdZy/ QEQ/uzL8u0Glg+/x2pkJAzAdQrnRotMKUI3tnelnPVyHfkdcsNDviCp9m7XVkTaUBCwo zUEPI5/u7ubrIouqjfxZn9OTMWMqAW/VFvs88HR9BMz8nZ/YnkwioSdbXcOBecfLUpB4 oZ67552ctbev00BOIGa6im4bSXHPb7ji4pfTSXaPnxT43AT2G3ymoE63rvxQtwf5Atvv Y/2NrLOmw2/zyN8X5K3iDT2RO52rrGQ4/mdB9JwcdEdDIPmIFNoDSsgV3BljheGCb2k8 Nizw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=h2xJ6EPp/RS9xdIFvHloUbVAGA+lVC743icENVBa5dY=; b=WTvoP1B0RmlYj6WMiXZjMESLeAfPYdWek9vT780hNtYc8lbjNysnyTLyJAxzrgwHms oPgKgI6xgezJRodzgWsL3mlzbjADo3cxez8Gsu8MWvvvQwbp6uEt8oZGrj1JXvR3diVK xUbsXtY8lmZKM7mpUhFWVaWxKz0KMVbHCwbHxAEnOt/FFAc32B1ZR1UeAovllqd62rPA s8283NuRO7otcBENdqwR82a5rzTtL2ACcdHuDljThwsWcZI9mZeiq7Jam4sb5JbIdqO1 AImLH3lI9VO38jLHZD350gz0Ew5NCqfpdUsKhaR9wW1mOQAfnnDKfdv9CsDP9f9TgmFT IPuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=YMKsjpU2; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m65-20020a632644000000b0050309caf60esi15161104pgm.750.2023.04.25.19.15.55; Tue, 25 Apr 2023 19:16:08 -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=@xen0n.name header.s=mail header.b=YMKsjpU2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239126AbjDZCKt (ORCPT + 99 others); Tue, 25 Apr 2023 22:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238440AbjDZCKr (ORCPT ); Tue, 25 Apr 2023 22:10:47 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 869D68699 for ; Tue, 25 Apr 2023 19:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1682475043; bh=I4+WTwpJpG+gq3nJRV2vaRoj4MZKnpy9sosOXV2D/j8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=YMKsjpU2on/guZTk7uBIzlkb71uOkLwkNhgcX6icve1/bKv3Lz7jD+PXyIWqFzc/e IoedT7juvcYfsVz3TQ2afvuSz+FvpAJxV8Xsw/mIngNgYiIYxfweKdpbUP3FuxAW1r zfdlyaNXO2+51GW4OLuUlz8ST08sAg2eDXQt16pI= Received: from [100.100.57.122] (unknown [58.34.185.106]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id C2824600A6; Wed, 26 Apr 2023 10:10:42 +0800 (CST) Message-ID: Date: Wed, 26 Apr 2023 10:10:41 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: Loongson (and other $ARCHs?) idle VS timer enqueue Content-Language: en-US To: maobibo , Peter Zijlstra Cc: Frederic Weisbecker , Thomas Gleixner , Huacai Chen , "Rafael J. Wysocki" , Anna-Maria Behnsen , LKML References: <87leil2r7v.ffs@tglx> <20230422081700.GB1214746@hirez.programming.kicks-ass.net> <20230422150409.GL1214746@hirez.programming.kicks-ass.net> <7d91fa2a-57c5-6c78-8e2d-7fbdd6a11cba@loongson.cn> <20230425114937.GC1335080@hirez.programming.kicks-ass.net> <5ba79220-683f-a78a-8c3b-bc0b118226f8@loongson.cn> From: WANG Xuerui In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 2023/4/26 08:46, maobibo wrote: > > > 在 2023/4/25 21:28, WANG Xuerui 写道: >> On 2023/4/25 21:25, maobibo wrote: >>> >>> >>> 在 2023/4/25 19:49, Peter Zijlstra 写道: >> >> >> >>>> >>>> diff --git a/arch/loongarch/kernel/genex.S b/arch/loongarch/kernel/genex.S >>>> index 44ff1ff64260..3c8a6bab98fe 100644 >>>> --- a/arch/loongarch/kernel/genex.S >>>> +++ b/arch/loongarch/kernel/genex.S >>>> @@ -18,27 +18,31 @@ >>>>         .align    5 >>>>   SYM_FUNC_START(__arch_cpu_idle) >>>> -    /* start of rollback region */ >>>> -    LONG_L    t0, tp, TI_FLAGS >>>> -    nop >>>> -    andi    t0, t0, _TIF_NEED_RESCHED >>>> -    bnez    t0, 1f >>>> -    nop >>>> -    nop >>>> -    nop >>>> +    /* start of idle interrupt region */ >>>> +    move    t0, CSR_CRMD_IE >>> addi.d  t0, zero, CSR_CRMD_IE can be used here, move is used for reg to reg >> >> Or better: li.d t0, CSR_CRMD_IE (prefer pseudo-instruction over concrete ones whenever it helps readability). We don't need to support ancient in-house toolchains without support for even li. ;-) > > I am not familiar with compiler:(, how many actual instructions does > pseudo-instr li.d takes? It will be ok if it uses only one intr, else > there will be problem. It's just `ori $t0, $zero, 4` no matter which of li.w or li.d is used. It only matters when the immediate to load is bigger. Given CSR_CRMD_IE is just 4 (1<<2) you can definitely say `li.w` if you want to be extra cautious and it won't hurt. ;-) -- WANG "xen0n" Xuerui Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/