Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Power saving API #235

Open
bogdanPricope opened this issue Sep 30, 2023 · 7 comments
Open

Power saving API #235

bogdanPricope opened this issue Sep 30, 2023 · 7 comments

Comments

@bogdanPricope
Copy link
Contributor

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

@MatiasElo
Copy link
Contributor

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.

@bogdanPricope
Copy link
Contributor Author

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
Copy link
Contributor Author

bogdanPricope commented Nov 6, 2023

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

@MatiasElo
Copy link
Contributor

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
Copy link
Contributor

Based on quick testing this seems to work: MatiasElo@c29b8b1

@bogdanPricope
Copy link
Contributor Author

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.

@MatiasElo
Copy link
Contributor

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants