From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C60BD4550C; Thu, 27 Jun 2024 17:30:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9E2BD427A7; Thu, 27 Jun 2024 17:30:43 +0200 (CEST) Received: from fout8-smtp.messagingengine.com (fout8-smtp.messagingengine.com [103.168.172.151]) by mails.dpdk.org (Postfix) with ESMTP id 8CDA242D97 for ; Thu, 27 Jun 2024 17:30:41 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 2D5231380234; Thu, 27 Jun 2024 11:30:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 27 Jun 2024 11:30:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1719502241; x=1719588641; bh=M1Y+mfQAoDi/bizkNW0jncBsPyr0uqerysCAmPTXBLg=; b= DdPPjG//TetPl+Kxqpu1m+ON06D1HbyzxZNxaTJ/QmphFw6W5zMlhltR5i/9JKQ5 yFRMgRyngTSS3hGSc3RDwDyw1tv8l1kw3u5y4uFJBVt4MtIeo71JJpUFPBwRNiPM pcHBUEhyF9TbAARGjVTbC2WUeqbxRtg0/FBclGuvSWFSfSpduX1/txoSTGcl4QYX BK26wet/+gTbQnA5kAEswNdHssBVgXee9z/yyVVZJy/YADAL/8/wzbFp4h8fuluD cCW8gmebWC5JwYLVKbTA2fGmbprd+VISVfLupkDAjxGf6imlJi2JSHS9ESpAoHve kmvYAavJYOyvQIku/J/VjA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1719502241; x= 1719588641; bh=M1Y+mfQAoDi/bizkNW0jncBsPyr0uqerysCAmPTXBLg=; b=i /90owwHzwucJuMGRe5qqTXnEYvK4iXPUUAWE7TRpE/dgae2VuQWEC/HYuZC6UW+G KF6d3E3xNKKxVfu4g9QO+fEUoWBUdHGW1/9TG+OqDr4CVWqrSia6lcWPC4kNW15h 1cXlCBYhFgHHILK96zd+yAtwHqpGJ58wkrveq0x8+Tq2xXyOyr62wcnoEV9RIn6D UDoCoslwiALoqjsoj9qkkY9nYkEAnW25rums/wrbqazClOc+Ga0tZnKQMeW3BLeC 6h/S0RlimoWNEfDZ84DRlpbdpTxnb/Q361r6EXHJkIByeLeUqL5+9dLNni1KdMzl CstPFNA2YVjbi/lIfRmqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrtdeggdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepjeduveehieevuddutdevfffgtdegkeeuveejffejgedtgeegkefg vdeugfefkeejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Jun 2024 11:30:38 -0400 (EDT) From: Thomas Monjalon To: Wathsala Vithanage Cc: Tyler Retzlaff , Ruifeng Wang , dev@dpdk.org, nd@arm.com, Dhruv Tripathi , Honnappa Nagarahalli , Jack Bond-Preston , Nick Connolly , Vinod Krishna , david.marchand@redhat.com Subject: Re: [PATCH v2 2/2] eal: add Arm WFET in power management intrinsics Date: Thu, 27 Jun 2024 17:30:37 +0200 Message-ID: <6442594.6TB3vktIsb@thomas> In-Reply-To: <20240619064529.619526-2-wathsala.vithanage@arm.com> References: <20240604044401.3577707-2-wathsala.vithanage@arm.com> <20240619064529.619526-1-wathsala.vithanage@arm.com> <20240619064529.619526-2-wathsala.vithanage@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 19/06/2024 08:45, Wathsala Vithanage: > --- a/lib/eal/arm/include/rte_cpuflags_64.h > +++ b/lib/eal/arm/include/rte_cpuflags_64.h > @@ -36,6 +36,7 @@ enum rte_cpu_flag_t { > RTE_CPUFLAG_SVEF64MM, > RTE_CPUFLAG_SVEBF16, > RTE_CPUFLAG_AARCH64, > + RTE_CPUFLAG_WFXT, > }; It may be useful to add comments explaining each flag. May be a separate patch in this series? > - * Copyright(c) 2019 Arm Limited > + * Copyright(c) 2024 Arm Limited No, it's wrong to remove initial date, and no, you don't need to update dates at all. > -#ifdef RTE_WAIT_UNTIL_EQUAL_ARCH_DEFINED Why removing this #ifdef? > -/* Send a local event to quit WFE. */ > +/* Send a local event to quit WFE/WFxT. */ > #define __RTE_ARM_SEVL() { asm volatile("sevl" : : : "memory"); } > > -/* Send a global event to quit WFE for all cores. */ > +/* Send a global event to quit WFE/WFxT for all cores. */ > #define __RTE_ARM_SEV() { asm volatile("sev" : : : "memory"); } > > /* Put processor into low power WFE(Wait For Event) state. */ > #define __RTE_ARM_WFE() { asm volatile("wfe" : : : "memory"); } > > +/* Put processor into low power WFET (WFE with Timeout) state. */ > +#ifdef RTE_ARM_FEATURE_WFXT > +#define __RTE_ARM_WFET(t) { \ > + asm volatile("wfet %x[to]" \ > + : \ > + : [to] "r" (t) \ > + : "memory"); \ > + } Is there any intrinsic function available? [...] > --- a/lib/eal/arm/rte_cpuflags.c > +++ b/lib/eal/arm/rte_cpuflags.c > @@ -115,6 +115,7 @@ const struct feature_entry rte_cpu_feature_table[] = { > FEAT_DEF(SVEF32MM, REG_HWCAP2, 10) > FEAT_DEF(SVEF64MM, REG_HWCAP2, 11) > FEAT_DEF(SVEBF16, REG_HWCAP2, 12) > + FEAT_DEF(WFXT, REG_HWCAP2, 31) > FEAT_DEF(AARCH64, REG_PLATFORM, 0) Are you sure of alignment? (looks wrong in my email client) [...] > rte_cpu_get_intrinsics_support(struct rte_cpu_intrinsics *intrinsics) > { > memset(intrinsics, 0, sizeof(*intrinsics)); > -#ifdef RTE_ARM_USE_WFE > intrinsics->power_monitor = 1; > -#endif Why removing this #ifdef? > +uint8_t wfet_en; It should be made static probably. This variable will be unused in some cases, needs #ifdef. > + > +RTE_INIT(rte_power_intrinsics_init) > +{ > +#ifdef RTE_ARCH_64 > + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_WFXT)) > + wfet_en = 1; > +#endif > +} > + > +/** > + * This function uses WFE/WFET instruction to make lcore suspend > * execution on ARM. > - * Note that timestamp based timeout is not supported yet. > */ > int > rte_power_monitor(const struct rte_power_monitor_cond *pmc, > const uint64_t tsc_timestamp) > { > - RTE_SET_USED(tsc_timestamp); > - > -#ifdef RTE_ARM_USE_WFE > +#ifdef RTE_ARCH_64 It looks wrong. If RTE_ARM_USE_WFE is disabled, you should not call __RTE_ARM_WFE(). > const unsigned int lcore_id = rte_lcore_id(); > uint64_t cur_value; > > @@ -33,28 +44,30 @@ rte_power_monitor(const struct rte_power_monitor_cond *pmc, > > switch (pmc->size) { > case sizeof(uint8_t): > - __RTE_ARM_LOAD_EXC_8(pmc->addr, cur_value, rte_memory_order_relaxed) > - __RTE_ARM_WFE() > + __RTE_ARM_LOAD_EXC_8(pmc->addr, cur_value, rte_memory_order_relaxed);