DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 1/1] power: fix multi-queue scale mode for pmd mgmt
@ 2021-07-21 14:26 Anatoly Burakov
  2021-07-21 14:39 ` David Hunt
  0 siblings, 1 reply; 3+ messages in thread
From: Anatoly Burakov @ 2021-07-21 14:26 UTC (permalink / raw)
  To: dev, David Hunt, Konstantin Ananyev; +Cc: reshma.pattan

Currently in scale mode, multi-queue initialization will attempt to
initialize and de-initialize the per-lcore power library structures
multiple times. Fix it to only do this whenever we either enabling
first queue or disabling last queue.

Fixes: 5dff9a72b0ef ("power: support callbacks for multiple Rx queues")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/power/rte_power_pmd_mgmt.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index 2586204b93..0ce40f0875 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -534,11 +534,15 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,
 		clb = get_monitor_callback();
 		break;
 	case RTE_POWER_MGMT_TYPE_SCALE:
-		/* check if we can add a new queue */
-		ret = check_scale(lcore_id);
-		if (ret < 0)
-			goto end;
 		clb = clb_scale_freq;
+
+		/* we only have to check this when enabling first queue */
+		if (lcore_cfg->pwr_mgmt_state != PMD_MGMT_DISABLED)
+			break;
+		/* check if we can add a new queue */
+		ret = check_scale(lcore_id);
+		if (ret < 0)
+			goto end;
 		break;
 	case RTE_POWER_MGMT_TYPE_PAUSE:
 		/* figure out various time-to-tsc conversions */
@@ -633,9 +637,12 @@ rte_power_ethdev_pmgmt_queue_disable(unsigned int lcore_id,
 		rte_eth_remove_rx_callback(port_id, queue_id, queue_cfg->cb);
 		break;
 	case RTE_POWER_MGMT_TYPE_SCALE:
-		rte_power_freq_max(lcore_id);
 		rte_eth_remove_rx_callback(port_id, queue_id, queue_cfg->cb);
-		rte_power_exit(lcore_id);
+		/* disable power library on this lcore if this was last queue */
+		if (lcore_cfg->pwr_mgmt_state == PMD_MGMT_DISABLED) {
+			rte_power_freq_max(lcore_id);
+			rte_power_exit(lcore_id);
+		}
 		break;
 	}
 	/*
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v1 1/1] power: fix multi-queue scale mode for pmd mgmt
  2021-07-21 14:26 [dpdk-dev] [PATCH v1 1/1] power: fix multi-queue scale mode for pmd mgmt Anatoly Burakov
@ 2021-07-21 14:39 ` David Hunt
  2021-07-22 19:28   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: David Hunt @ 2021-07-21 14:39 UTC (permalink / raw)
  To: Anatoly Burakov, dev, Konstantin Ananyev; +Cc: reshma.pattan

Hi Anatoly,

On 21/7/2021 3:26 PM, Anatoly Burakov wrote:
> Currently in scale mode, multi-queue initialization will attempt to
> initialize and de-initialize the per-lcore power library structures
> multiple times. Fix it to only do this whenever we either enabling
> first queue or disabling last queue.
>
> Fixes: 5dff9a72b0ef ("power: support callbacks for multiple Rx queues")
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>   lib/power/rte_power_pmd_mgmt.c | 19 +++++++++++++------
>   1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
> index 2586204b93..0ce40f0875 100644
> --- a/lib/power/rte_power_pmd_mgmt.c
> +++ b/lib/power/rte_power_pmd_mgmt.c
> @@ -534,11 +534,15 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,
>   		clb = get_monitor_callback();
>   		break;
>   	case RTE_POWER_MGMT_TYPE_SCALE:
> -		/* check if we can add a new queue */
> -		ret = check_scale(lcore_id);
> -		if (ret < 0)
> -			goto end;
>   		clb = clb_scale_freq;
> +
> +		/* we only have to check this when enabling first queue */
> +		if (lcore_cfg->pwr_mgmt_state != PMD_MGMT_DISABLED)
> +			break;
> +		/* check if we can add a new queue */
> +		ret = check_scale(lcore_id);
> +		if (ret < 0)
> +			goto end;
>   		break;
>   	case RTE_POWER_MGMT_TYPE_PAUSE:
>   		/* figure out various time-to-tsc conversions */
> @@ -633,9 +637,12 @@ rte_power_ethdev_pmgmt_queue_disable(unsigned int lcore_id,
>   		rte_eth_remove_rx_callback(port_id, queue_id, queue_cfg->cb);
>   		break;
>   	case RTE_POWER_MGMT_TYPE_SCALE:
> -		rte_power_freq_max(lcore_id);
>   		rte_eth_remove_rx_callback(port_id, queue_id, queue_cfg->cb);
> -		rte_power_exit(lcore_id);
> +		/* disable power library on this lcore if this was last queue */
> +		if (lcore_cfg->pwr_mgmt_state == PMD_MGMT_DISABLED) {
> +			rte_power_freq_max(lcore_id);
> +			rte_power_exit(lcore_id);
> +		}
>   		break;
>   	}
>   	/*


Fix looks good. Previous to this patch, was failing on adding second 
queue to a core, now with this patch, succeeds.

Tested-by: David Hunt <david.hunt@intel.com>




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v1 1/1] power: fix multi-queue scale mode for pmd mgmt
  2021-07-21 14:39 ` David Hunt
@ 2021-07-22 19:28   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-07-22 19:28 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, Konstantin Ananyev, reshma.pattan, David Hunt

21/07/2021 16:39, David Hunt:
> On 21/7/2021 3:26 PM, Anatoly Burakov wrote:
> > Currently in scale mode, multi-queue initialization will attempt to
> > initialize and de-initialize the per-lcore power library structures
> > multiple times. Fix it to only do this whenever we either enabling
> > first queue or disabling last queue.
> >
> > Fixes: 5dff9a72b0ef ("power: support callbacks for multiple Rx queues")
> >
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Fix looks good. Previous to this patch, was failing on adding second 
> queue to a core, now with this patch, succeeds.
> 
> Tested-by: David Hunt <david.hunt@intel.com>

Applied, thanks





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-22 19:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 14:26 [dpdk-dev] [PATCH v1 1/1] power: fix multi-queue scale mode for pmd mgmt Anatoly Burakov
2021-07-21 14:39 ` David Hunt
2021-07-22 19:28   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).