lkml.org 
[lkml]   [2021]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 2/2] mwifiex: Try waking the firmware until we get an interrupt
Hi,

On Sun, Oct 3, 2021 at 2:18 AM Jonas Dreßler <verdre@v0yd.nl> wrote:
> So I think I have another solution that might be a lot more elegant, how
> about this:
>
> try_again:
> n_tries++;
>
> mwifiex_write_reg(adapter, reg->fw_status, FIRMWARE_READY_PCIE);
>
> if (wait_event_interruptible_timeout(adapter->card_wakeup_wait_q,
> READ_ONCE(adapter->int_status) != 0,
> WAKEUP_TRY_AGAIN_TIMEOUT) == 0 &&
> n_tries < MAX_N_WAKEUP_TRIES) {
> goto try_again;
> }

Isn't wait_event_interruptible_timeout()'s timeout in jiffies, which
is not necessarily that predictable, and also a lot more
coarse-grained than we want? (As in, if HZ=100, we're looking at
precision on the order of 10ms, whereas the expected wakeup latency is
~6ms.) That would be OK for well-behaved PCI cases, where we never
miss a write, but it could ~double your latency for your bad systems
that will need more than one run of the loop.

Also, feels like a do/while could be cleaner, but that's a lesser detail.

> and then call wake_up_interruptible() in the mwifiex_interrupt_status()
> interrupt handler.
>
> This solution should make sure we always keep wakeup latency to a minimum
> and can still retry the register write if things didn't work.

Brian

\
 
 \ /
  Last update: 2021-10-04 19:53    [W:0.113 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site