Re: [PATCH v2 2/8] net/netvsc: fix race conditions on VF add/remove events

Stephen Hemminger
2026-02-23T17:40:11Z

On Fri, 20 Feb 2026 18:45:21 -0800
longli@linux.microsoft.com wrote:

> + rte_rwlock_read_lock(&hv->vf_lock);
> + vf_dev = hn_get_vf_dev(hv);
> + if (hv->vf_ctx.vf_vsc_switched && vf_dev &&
> + vf_dev->data->dev_started) {
> + void *sub_q = vf_dev->data->tx_queues[queue_id];
> +
> + nb_tx = (*vf_dev->tx_pkt_burst)
> + (sub_q, tx_pkts, nb_pkts);
> rte_rwlock_read_unlock(&hv->vf_lock);
> + return nb_tx;
> }
> + rte_rwlock_read_unlock(&hv->vf_lock);

ok, but read locks not free. It does incur an additional cache miss
which may impact performance.

Might be better in future to have some form of lockless access here.