From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 34960A0542;
	Fri, 11 Nov 2022 09:22:19 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 29DFA40143;
	Fri, 11 Nov 2022 09:22:19 +0100 (CET)
Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com
 [64.147.123.20]) by mails.dpdk.org (Postfix) with ESMTP id E553440141
 for <dev@dpdk.org>; Fri, 11 Nov 2022 09:22:16 +0100 (CET)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.west.internal (Postfix) with ESMTP id 17E803200931;
 Fri, 11 Nov 2022 03:22:15 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Fri, 11 Nov 2022 03:22:15 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:cc:content-transfer-encoding:content-type:date:date:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:sender:subject:subject:to:to; s=fm1; t=1668154934; x=
 1668241334; bh=l54EMXyrPJcfqAmh4+u7CespmY0nIH8Rp8+V5Cz8Uhg=; b=W
 GcLQ/64BStdAWlGa+sOJ+byaviw11XDl198O+eGLuKXorGWG+SSY+NH16pc94bfm
 Wlh1AabAFe6RwiUyKya1Oj196P/Z71XCWgYRThHpnkBMDd8JlVINALdiFKxewOVR
 OzGKO5XlRcTSWy0U++YpJw1d6Z9ZvZvz9e+nfJtJqjrSufn6afrvdbjNgzHKS4VQ
 skQ9EDzCGraYumEMFEL265oGk7SWfYZHM0HjL/kCO9A85Juzp+giUCeLrxZ6QCkz
 g2yAwJ1F6b/sDlQO37n5lKbnKfDeXHwc4fwGM+eq605DFlT+BAi1OMsgKRDZf0RO
 p3foir+q69RtcfoZGYWRg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:date:date:feedback-id:feedback-id:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1668154934; x=
 1668241334; bh=l54EMXyrPJcfqAmh4+u7CespmY0nIH8Rp8+V5Cz8Uhg=; b=V
 6197l6GMxK7xSz8L9nFd1cOqeAwxr2uDWlgW6Ie1Hh+na7JWd8/EDSIacp5nkXWz
 5UJVG9qQKX7l+C/aSuceeFdkxu/CXKuB+ornaKhwOgdmaJhBk0oshQeJ3jloPDy9
 lhzfgcM6ML2qv3kkrlxbOPE4q9uFFcO9++O/LWoLjdRaJ51vJnXJNfXEobGwp20O
 7ImgiG249+8PEJmtEI9DdHOSP/T55qgUajXYpypg1nxJPLju3IW1O+eiWQSKHEst
 QQ4EYEstxbHVeNQB9fuV/Rwyl5JgUObMGA2pPXs51eqmUCbvFmaZZwQ4+nKhCm9G
 D/AsmovC6TLu3NB6czUzg==
X-ME-Sender: <xms:NgZuY5ei5604T4YJXq2nqxwmPRgS8odmfQiV-KmjicJw2WQSQQEcxQ>
 <xme:NgZuY3MA3kRXNzJZBxbw37KKpy6l-e8JqJkw0gUFyBbErGM9yBgm_eip0Z8hO7qdQ
 nW9E0JgUqMQNJmbmw>
X-ME-Received: <xmr:NgZuYyjbUeK3uo9T4GiR7MHzihKBvx-MnvXhitIuDjWQmgotAjd5fbey_aXV3FwXiuRf0noLy2XpZCjjgT8Wp3jlwg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeehgdduvdduucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm
 rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc
 ggtffrrghtthgvrhhnpedtjeeiieefhedtfffgvdelteeufeefheeujefgueetfedttdei
 kefgkeduhedtgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh
 hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght
X-ME-Proxy: <xmx:NgZuYy-sg-V6XRepLpKuHbxyDwrtY8f2Z1CELlaOYBiAx27fTUC1rw>
 <xmx:NgZuY1tOWr_uDY2Xzfvy_9RS1UR_x_0gN7QxhE3RPGFoecXyZ7EFTw>
 <xmx:NgZuYxG7o0KxxZmc24D8u8kaVX_-dgkUoL7duGgT8oehBBbhX2rqbw>
 <xmx:NgZuY5jb7u59iak_zNFwxpNgnUVPdkO8ZnSueyHXnMatm3xCoFIpmw>
Feedback-ID: i47234305:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
 11 Nov 2022 03:22:13 -0500 (EST)
From: Thomas Monjalon <thomas@monjalon.net>
To: Feifei Wang <feifei.wang2@arm.com>
Cc: David Hunt <david.hunt@intel.com>, dev@dpdk.org, david.marchand@redhat.com,
 stephen@networkplumber.org, nd@arm.com, Ruifeng Wang <ruifeng.wang@arm.com>,
 honnappa.nagarahalli@arm.com
Subject: Re: [PATCH v3 3/3] examples/l3fwd-power: enable PMD power monitor on
 Arm
Date: Fri, 11 Nov 2022 09:22:11 +0100
Message-ID: <1834560.u6TykanW85@thomas>
In-Reply-To: <20221111072649.3304429-4-feifei.wang2@arm.com>
References: <20220825064251.2637274-1-feifei.wang2@arm.com>
 <20221111072649.3304429-1-feifei.wang2@arm.com>
 <20221111072649.3304429-4-feifei.wang2@arm.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

11/11/2022 08:26, Feifei Wang:
> For Arm aarch, power monitor uses WFE instruction to enable, which can
> not exit automatically within the time limit. This means
> 'rte_power_monitor_wakeup' API needs to be called to wake up sleep cores
> if there is no store operation to monitored address.
> 
> Furthermore, we disable power monitor feature on the main core so that
> it can be used to wake up other sleeping cores after it exit from loop.
> 
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Acked-by: David Hunt <david.hunt@intel.com>
> ---
> +#if defined(RTE_ARCH_ARM64)
> +				/* Ensure the main lcore does not enter the power-monitor state,
> +				 * so that it can be used to wake up other lcores on ARM.
> +				 * This is due to WFE instruction has no timeout wake-up mechanism,
> +				 * and if users want to exit actively, the main lcore is needed
> +				 * to send SEV instruction to wake up other lcores.
> +				 */
> +				unsigned int main_lcore = rte_get_main_lcore();
> +				if (lcore_id == main_lcore &&
> +						pmgmt_type == RTE_POWER_MGMT_TYPE_MONITOR)
> +					continue;
> +#endif

We need to have this logic abstracted in the API for all architectures.
We cannot afford having such #ifdef per CPU in the application.