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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2E35D3C526 for ; Thu, 17 Oct 2024 18:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M7f0L4c1mXwdmmV8GA9+/BFp3TIZT8gxTgmc7h08E2s=; b=xg9Ps9m7rippkT+AEJeaUs2xgs U4J3PCTAwXo7roEeeVJB0yo2gCAhxUy+qkRZXEMvcQ04CXp8AOKo3kZckPf9Zj2NwW97aq0ERZV97 QrZjY8t5Mv6AB9bE4EfMNCvKjg36hBmBOT9AJ7IhLuZWSfuI/yLUeULRbfmQyT8TmZGrGJtMSpAYJ Dp7Jc6nST53OjIdmi6trBvZrc84pC8/eyHZwSw0hh5RcUnAukOOXUV8sMp8h4RgsyAWI5PGktj/ls KqkC/fDFPOhiqoAlizslHfxHYcu2aeDXYdgL0cgM2H5+lvCQe6qLMKRLwY9nSn2aaQuhYskWPADNz DDfof5HA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1V3M-0000000Fqyt-3Ys5; Thu, 17 Oct 2024 18:16:52 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1V1p-0000000FqVK-1vNK for linux-arm-kernel@bombadil.infradead.org; Thu, 17 Oct 2024 18:15:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=M7f0L4c1mXwdmmV8GA9+/BFp3TIZT8gxTgmc7h08E2s=; b=WxeFGiLIRShlnpnwYTFVNn1l/5 oc4VifRUrcQKMCATGlz9nyBxU6L2FpAyX/mq9uh/sFQnWNKf0/lGPO1alabJB3JjVJAdOnLjSSd5g Ht6fLxN0H/6mosvGSyD7UxW8xy0gUDxa9f4Ym5EVPCPxmJkirmLQaQ/W7dilAiCjdulE//o70oOVE ym484pxT7MTFf619OJuLHikK3rrg4n4G7Ot59KHMi78ahmS/n8urBkyYFVsEAy34mAF8KllbMawWk FY8pbsPlza1yFq3+9DqtA5youmZypDz4bXBn/O27t4PqIQmkfasp07ZIT4bf0dckn0fZa4RcVn1yh cKWta/eQ==; Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1V1m-00000007BcG-1F2O for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 18:15:16 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 483295C0754; Thu, 17 Oct 2024 18:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8BA1C4CEC3; Thu, 17 Oct 2024 18:15:05 +0000 (UTC) Date: Thu, 17 Oct 2024 19:15:03 +0100 From: Catalin Marinas To: "Christoph Lameter (Ampere)" Cc: Ankur Arora , linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, wanpengli@tencent.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de, lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com, mtosatti@redhat.com, sudeep.holla@arm.com, misono.tomohiro@fujitsu.com, maobibo@loongson.cn, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: Re: [PATCH v8 01/11] cpuidle/poll_state: poll via smp_cond_load_relaxed() Message-ID: References: <20240925232425.2763385-2-ankur.a.arora@oracle.com> <086081ed-e2a8-508d-863c-21f2ff7c5490@gentwo.org> <1e56e83e-83b3-d4fd-67a8-0bc89f3e3d20@gentwo.org> <87jze9rq15.fsf@oracle.com> <95ba9d4a-b90c-c8e8-57f7-31d82722f39e@gentwo.org> <53bf468b-1616-3915-f5bc-aa29130b672d@gentwo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53bf468b-1616-3915-f5bc-aa29130b672d@gentwo.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_191514_719990_3670AD90 X-CRM114-Status: GOOD ( 16.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 17, 2024 at 09:56:13AM -0700, Christoph Lameter (Ampere) wrote: > On Wed, 16 Oct 2024, Catalin Marinas wrote: > > The behaviour above is slightly different from the current poll_idle() > > implementation. The above is more like poll every timeout period rather > > than continuously poll until either the need_resched() condition is true > > _or_ the timeout expired. From Ankur's email, an IPI may not happen so > > we don't have any guarantee that WFET will wake up before the timeout. > > The only way for WFE/WFET to wake up on need_resched() is to use LDXR to > > arm the exclusive monitor. That's what smp_cond_load_relaxed() does. > > Sorry no. The IPI will cause the WFE to continue immediately and not wait > till the end of the timeout period. *If* there is an IPI. The scheduler is not really my area but some functions like wake_up_idle_cpu() seem to elide the IPI if TIF_NR_POLLING is set. But even if we had an IPI, it still feels like abusing the semantics of smp_cond_load_relaxed() when relying on it to increment a variable in the condition check as a result of some unrelated wake-up event. This API is meant to wait for a condition on a single variable. It cannot wait on multiple variables and especially not one it updates itself (even if it happens to work on arm64 under certain conditions). My strong preference would be to revive the smp_cond_load_timeout() proposal from Ankur earlier in the year. -- Catalin