odp-dpdk icon indicating copy to clipboard operation
odp-dpdk copied to clipboard

Power saving API

Open bogdanPricope opened this issue 2 years ago • 7 comments

Hi,

Have you consider adding API/implementation to reduce power consumption: e.g. sleeping the workers when there is not traffic and awake them on RX interrupts?

DPDK was some API for that: rte_eth_dev_rx_intr_enable()/rte_eth_dev_rx_intr_disable()/rte_eth_dev_rx_intr_ctl_q()/rte_epoll_wait().

Best regards

bogdanPricope avatar Sep 30 '23 11:09 bogdanPricope

Hi,

So far we haven't seen application use-cases, but I can see these being useful for certain applications. We'll add this to our backlog.

Currently, the logical place for power saving is odp_schedule() implementation. @JereLeppanen has actually been testing this and there is a configuration option (sched_basic: powersave), which enables worker threads to sleep for a certain time when no work is available.

MatiasElo avatar Oct 03 '23 12:10 MatiasElo

Hi @MatiasElo,

One can imagine some cases:

  • multiple NFs running on the same machine and not all have the same performance requirements
  • one NF but not all cores have the same requirements or not all the time It brings significant flexibility.

I am not saying 'to save the planet' but to reduce power consumption (costs) when it makes sense... and frankly 'some' setups may overheat at full power on all cores.

Now, odp_schedule() will be ideal but an API at pktin level may cover part of the cases...

FYI next release of nfp (my ofp) will provide a 'power' example and a patch on top of odp-dpdk/linux-generic.

bogdanPricope avatar Oct 03 '23 19:10 bogdanPricope

Hi @MatiasElo,

Please have a look at the odp-dpdk patch and API utilization example:

https://github.com/NetInoSoftware/nfp/blob/master/example/fpm_power/0001-pktin-Add-RX-interrupt-management-API.patch https://github.com/NetInoSoftware/nfp/blob/master/example/fpm_power/app_main.c

As you said, odp_schedule() would be the logical place for power saving but the API proposed by this patch may suffice for 'direct mode' implementations.

Best regards

bogdanPricope avatar Nov 06 '23 09:11 bogdanPricope

Hi @bogdanPricope, thanks for the examples. Adding the new APIs will be a bigger task, but perhaps this functionality could be added to odp_pktin_recv_tmo() implementation without any API changes. Initially the functionality could be enabled/disabled using the config file.

MatiasElo avatar Nov 06 '23 10:11 MatiasElo

Based on quick testing this seems to work: https://github.com/MatiasElo/odp-dpdk/commit/c29b8b1cbe42224afbcb403bb3d24e9bad2a029f

MatiasElo avatar Nov 06 '23 12:11 MatiasElo

Hi @MatiasElo, a requirement for my use case is to wait for multiple pktins (maybe from different interfaces). I guess a change on odp_pktin_recv_mq_tmo() is also needed.

bogdanPricope avatar Nov 06 '23 13:11 bogdanPricope

Okay, implementing that will be more complex but should still be possible.

MatiasElo avatar Nov 06 '23 14:11 MatiasElo