• Michal Schmidt's avatar
    iavf: fix temporary deadlock and failure to set MAC address · 4411a608
    Michal Schmidt authored
    We are seeing an issue where setting the MAC address on iavf fails with
    EAGAIN after the 2.5s timeout expires in iavf_set_mac().
    
    There is the following deadlock scenario:
    
    iavf_set_mac(), holding rtnl_lock, waits on:
      iavf_watchdog_task (within iavf_wq) to send a message to the PF,
     and
      iavf_adminq_task (within iavf_wq) to receive a response from the PF.
    In this adapter state (>=__IAVF_DOWN), these tasks do not need to take
    rtnl_lock, but iavf_wq is a global single-threaded workqueue, so they
    may get stuck waiting for another adapter's iavf_watchdog_task to run
    iavf_init_config_adapter(), which does take rtnl_lock.
    
    The deadlock resolves itself by the timeout in iavf_set_mac(),
    which results in EAGAIN returned to userspace.
    
    Let's break the deadlock loop by changing iavf_wq into a per-adapter
    workqueue, so that one adapter's tasks are not blocked by another's.
    
    Fixes: 35a2443d ("iavf: Add waiting for response from PF in set mac")
    Co-developed-by: default avatarIvan Vecera <ivecera@redhat.com>
    Signed-off-by: default avatarIvan Vecera <ivecera@redhat.com>
    Signed-off-by: default avatarMichal Schmidt <mschmidt@redhat.com>
    Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    4411a608
iavf_main.c 145 KB