• Michal Schmidt's avatar
    ice: do not busy-wait to read GNSS data · 2f8fdcb0
    Michal Schmidt authored
    The ice-gnss-<dev_name> kernel thread, which reads data from the u-blox
    GNSS module, keep a CPU core almost 100% busy. The main reason is that
    it busy-waits for data to become available.
    
    A simple improvement would be to replace the "mdelay(10);" in
    ice_gnss_read() with sleeping. A better fix is to not do any waiting
    directly in the function and just requeue this delayed work as needed.
    The advantage is that canceling the work from ice_gnss_exit() becomes
    immediate, rather than taking up to ~2.5 seconds (ICE_MAX_UBX_READ_TRIES
    * 10 ms).
    
    This lowers the CPU usage of the ice-gnss-<dev_name> thread on my system
    from ~90 % to ~8 %.
    
    I am not sure if the larger 0.1 s pause after inserting data into the
    gnss subsystem is really necessary, but I'm keeping that as it was.
    
    Of course, ideally the driver would not have to poll at all, but I don't
    know if the E810 can watch for GNSS data availability over the i2c bus
    by itself and notify the driver.
    Signed-off-by: default avatarMichal Schmidt <mschmidt@redhat.com>
    Reviewed-by: default avatarArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
    Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
    Tested-by: Sunitha Mekala <sunithax.d.mekala@intel.com> (A Contingent worker at Intel)
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    2f8fdcb0
ice_gnss.c 10.9 KB