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 B13FAC2BD05 for ; Mon, 24 Jun 2024 10:55:22 +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=nVt1ACmF5relQmVFQRULSjQwFxtqlNIiRw9N7NYk4us=; b=bp8EuERa/g8XZHYkm93jKoqYzU ZfzigdBpi2XmgKFhO8GAQVIT/0FeD42p0qbA6N/hqVF5EmoKdL+0io8vnyt8c00SVVqgsjqlugCIk 7n6dOiH7ozpbzGVJD2I4BHpX2Jy5oQ4vXbKIxMW3Aomee9+KnV9c+ZlSUtFisRuO3+1KZw8jPHwnj frgGUUOXdwemAo8bXnv1GUHc0D++Hv14izbyPJ74oAKox/tVDgxluGF/9G5qdwGLRzyy+51ZMMLkI Am8xrpGyuZWvWtiljUoVLEI8w1hGkq9cxneITLimoF0+QN5P4S7yvGXOsGrvAO7lJGdTxsfFV8wyg pKsfcmaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLhLu-0000000GVDL-0OBU; Mon, 24 Jun 2024 10:55:14 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLhLo-0000000GVCT-1bax for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2024 10:55:09 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7DA84DA7; Mon, 24 Jun 2024 03:55:31 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 34B993F73B; Mon, 24 Jun 2024 03:55:02 -0700 (PDT) Date: Mon, 24 Jun 2024 11:54:59 +0100 From: Sudeep Holla To: Ankur Arora Cc: linux-pm@vger.kernel.org, kvm@vger.kernel.org, Sudeep Holla , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, 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, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: Re: [PATCH 8/9] arm64: support cpuidle-haltpoll Message-ID: References: <20240430183730.561960-1-ankur.a.arora@oracle.com> <20240430183730.561960-9-ankur.a.arora@oracle.com> <20240619121711.jid3enfzak7vykyn@bogus> <871q4pc0f9.fsf@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <871q4pc0f9.fsf@oracle.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240624_035508_494912_74C30F0F X-CRM114-Status: GOOD ( 27.66 ) 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 Fri, Jun 21, 2024 at 04:59:22PM -0700, Ankur Arora wrote: > > Sudeep Holla writes: > > > On Tue, Apr 30, 2024 at 11:37:29AM -0700, Ankur Arora wrote: > >> Add architectural support for the cpuidle-haltpoll driver by defining > >> arch_haltpoll_*(). Also select ARCH_HAS_OPTIMIZED_POLL since we have > >> an optimized polling mechanism via smp_cond_load*(). > >> > >> Add the configuration option, ARCH_CPUIDLE_HALTPOLL to allow > >> cpuidle-haltpoll to be selected. > >> > >> Note that we limit cpuidle-haltpoll support to when the event-stream is > >> available. This is necessary because polling via smp_cond_load_relaxed() > >> uses WFE to wait for a store which might not happen for an prolonged > >> period of time. So, ensure the event-stream is around to provide a > >> terminating condition. > >> > > > > Currently the event stream is configured 10kHz(1 signal per 100uS IIRC). > > But the information in the cpuidle states for exit latency and residency > > is set to 0(as per drivers/cpuidle/poll_state.c). Will this not cause any > > performance issues ? > > No I don't think there's any performance issue. > Thanks for the confirmation, that was my assumption as well. > When the core is waiting in WFE for &thread_info->flags to > change, and set_nr_if_polling() happens, the CPU will come out > of the wait quickly. > So, the exit latency, residency can be reasonably set to 0. > Sure > If, however, there is no store to &thread_info->flags, then the event > stream is what would cause us to come out of the WFE and check if > the poll timeout has been exceeded. > In that case, there was no work to be done, so there was nothing > to wake up from. > This is exactly what I was referring when I asked about performance, but it looks like it is not a concern for the reason specified about. > So, in either circumstance there's no performance loss. > > However, when we are polling under the haltpoll governor, this might > mean that we spend more time polling than determined based on the > guest_halt_poll_ns. But, that would only happen in the last polling > iteration. > > So, I'd say, at worst no performance loss. But, we would sometimes > poll for longer than necessary before exiting to the host. > Does it make sense to add some comment that implies briefly what we have discussed here ? Mainly why 0 exit and target residency values are fine and how worst case WFE wakeup doesn't impact the performance. -- Regards, Sudeep