Hi all, the context here is a sporadic ovs-ovswitchd segfault I am researching, but I'd like to learn a bit about the locking of resources in ovs.
By studying the git history and reading the code, including commits like: commit eef85380810ab428a193f4874477a6dde5999ab7 Author: Ilya Maximets <[email protected]> Date: Mon Feb 11 20:34:06 2019 +0300 dpif-netdev: Fix unsafe access to pmd polling lists. All accesses to 'pmd->poll_list' should be guarded by 'pmd->port_mutex'. Additionally fixed inappropriate usage of 'HMAP_FOR_EACH_SAFE' (hmap doesn't change in a loop) and dropped not needed local variable 'proc_cycles'. CC: Nitin Katiyar <[email protected]> Fixes: 5bf84282482a ("Adding support for PMD auto load balancing") Signed-off-by: Ilya Maximets <[email protected]> Acked-by: Kevin Traynor <[email protected]> Acked-by: Aaron Conole <[email protected]> And looking at the datastructure struct dp_netdev_pmd_thread, It would seem to me that it is necessary to acquire port_mutex when operating on the member of struct dp_netdev_pmd_thread { struct hmap poll_list OVS_GUARDED; }; Instead in dpif-netdev.c I see that the pmd_thread_main() only acquires the pmd->perf_states.stats_mutex before accessing the poll_list, and then does: 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); } else { pmd->ctx.emc_insert_min = 0; } process_packets = dp_netdev_process_rxq_port(pmd, poll_list[i].rxq, poll_list[i].port_no); rx_packets += process_packets; } The issue I seem to be seeing in my case is that poll_list[i].rxq is actually invalid, ie poll_list[i].rxq->rx->netdev == NULL. We encounter this by running the testpmd application. I suspect I should be wrong, so could you give me an idea how the locking is supposed to happen, why is the port_mutex not acquired ? Thanks, Claudio _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
