mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
dpif-netdev: Only poll enabled vhost queues.
We currently poll all available queues based on the max queue count exchanged with the vhost peer and rely on the vhost library in DPDK to check the vring status beneath. This can lead to some overhead when we have a lot of unused queues. To enhance the situation, we can skip the disabled queues. On rxq notifications, we make use of the netdev's change_seq number so that the pmd thread main loop can cache the queue state periodically. $ ovs-appctl dpif-netdev/pmd-rxq-show pmd thread numa_id 0 core_id 1: isolated : true port: dpdk0 queue-id: 0 (enabled) pmd usage: 0 % pmd thread numa_id 0 core_id 2: isolated : true port: vhost1 queue-id: 0 (enabled) pmd usage: 0 % port: vhost3 queue-id: 0 (enabled) pmd usage: 0 % pmd thread numa_id 0 core_id 15: isolated : true port: dpdk1 queue-id: 0 (enabled) pmd usage: 0 % pmd thread numa_id 0 core_id 16: isolated : true port: vhost0 queue-id: 0 (enabled) pmd usage: 0 % port: vhost2 queue-id: 0 (enabled) pmd usage: 0 % $ while true; do ovs-appctl dpif-netdev/pmd-rxq-show |awk ' /port: / { tot++; if ($5 == "(enabled)") { en++; } } END { print "total: " tot ", enabled: " en }' sleep 1 done total: 6, enabled: 2 total: 6, enabled: 2 ... # Started vm, virtio devices are bound to kernel driver which enables # F_MQ + all queue pairs total: 6, enabled: 2 total: 66, enabled: 66 ... # Unbound vhost0 and vhost1 from the kernel driver total: 66, enabled: 66 total: 66, enabled: 34 ... # Configured kernel bound devices to use only 1 queue pair total: 66, enabled: 34 total: 66, enabled: 19 total: 66, enabled: 4 ... # While rebooting the vm total: 66, enabled: 4 total: 66, enabled: 2 ... total: 66, enabled: 66 ... # After shutting down the vm total: 66, enabled: 66 total: 66, enabled: 2 Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
committed by
Ian Stokes
parent
934a85a877
commit
35c91567c8
@@ -592,6 +592,8 @@ struct polled_queue {
|
||||
struct dp_netdev_rxq *rxq;
|
||||
odp_port_t port_no;
|
||||
bool emc_enabled;
|
||||
bool rxq_enabled;
|
||||
uint64_t change_seq;
|
||||
};
|
||||
|
||||
/* Contained by struct dp_netdev_pmd_thread's 'poll_list' member. */
|
||||
@@ -1164,6 +1166,8 @@ pmd_info_show_rxq(struct ds *reply, struct dp_netdev_pmd_thread *pmd)
|
||||
}
|
||||
ds_put_format(reply, " port: %-16s queue-id: %2d", name,
|
||||
netdev_rxq_get_queue_id(list[i].rxq->rx));
|
||||
ds_put_format(reply, " %s", netdev_rxq_enabled(list[i].rxq->rx)
|
||||
? "(enabled) " : "(disabled)");
|
||||
ds_put_format(reply, " pmd usage: ");
|
||||
if (total_cycles) {
|
||||
ds_put_format(reply, "%2"PRIu64"",
|
||||
@@ -5202,6 +5206,11 @@ dpif_netdev_run(struct dpif *dpif)
|
||||
}
|
||||
|
||||
for (i = 0; i < port->n_rxq; i++) {
|
||||
|
||||
if (!netdev_rxq_enabled(port->rxqs[i].rx)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dp_netdev_process_rxq_port(non_pmd,
|
||||
&port->rxqs[i],
|
||||
port->port_no)) {
|
||||
@@ -5375,6 +5384,9 @@ pmd_load_queues_and_ports(struct dp_netdev_pmd_thread *pmd,
|
||||
poll_list[i].rxq = poll->rxq;
|
||||
poll_list[i].port_no = poll->rxq->port->port_no;
|
||||
poll_list[i].emc_enabled = poll->rxq->port->emc_enabled;
|
||||
poll_list[i].rxq_enabled = netdev_rxq_enabled(poll->rxq->rx);
|
||||
poll_list[i].change_seq =
|
||||
netdev_get_change_seq(poll->rxq->port->netdev);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -5440,6 +5452,10 @@ reload:
|
||||
|
||||
for (i = 0; i < poll_cnt; i++) {
|
||||
|
||||
if (!poll_list[i].rxq_enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (poll_list[i].emc_enabled) {
|
||||
atomic_read_relaxed(&pmd->dp->emc_insert_min,
|
||||
&pmd->ctx.emc_insert_min);
|
||||
@@ -5476,6 +5492,16 @@ reload:
|
||||
if (reload) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < poll_cnt; i++) {
|
||||
uint64_t current_seq =
|
||||
netdev_get_change_seq(poll_list[i].rxq->port->netdev);
|
||||
if (poll_list[i].change_seq != current_seq) {
|
||||
poll_list[i].change_seq = current_seq;
|
||||
poll_list[i].rxq_enabled =
|
||||
netdev_rxq_enabled(poll_list[i].rxq->rx);
|
||||
}
|
||||
}
|
||||
}
|
||||
pmd_perf_end_iteration(s, rx_packets, tx_packets,
|
||||
pmd_perf_metrics_enabled(pmd));
|
||||
|
Reference in New Issue
Block a user