David Marchand, Oct 15, 2024 at 10:02:
On Mon, Oct 14, 2024 at 10:01 PM Stephen Hemminger
If this happens often, and the function takes a long time (like doing i/o)
it might be worth changing this to reader/writer in future.
Yes, this was an option mentionned when we discussed the issue in Montréal.
For now, a spinlock seems enough.
As far as I know, no ethdev telemetry endpoint handlers do any i/o. They
only access stuff in memory.
Also, would be best to add a comment here as to what is being protected
if you do another version.
I can add something when applying, like:
@@ -1400,6 +1400,7 @@ static int eth_dev_telemetry_do(const char *cmd,
const char *params,
{
int ret;
telemetry_cb fn = arg;
+ /* Protect against port removal while invoking callback,
calling ethdev API. */
rte_spinlock_lock(rte_mcfg_ethdev_get_lock());
ret = fn(cmd, params, d);
rte_spinlock_unlock(rte_mcfg_ethdev_get_lock());
Ack, thank you.