[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOFLbXbK5LmZbLcEs5e-0twoSkxkyKy8S6ZJVsz9Ap_a_iGZPA@mail.gmail.com>
Date: Mon, 4 Oct 2021 10:52:11 -0700
From: Brian Norris <briannorris@...omium.org>
To: Jonas Dreßler <verdre@...d.nl>
Cc: Amitkumar Karwar <amitkarwar@...il.com>,
Ganapathi Bhat <ganapathi017@...il.com>,
Xinming Hu <huxinming820@...il.com>,
Kalle Valo <kvalo@...eaurora.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Tsuchiya Yuto <kitakar@...il.com>,
Linux Wireless <linux-wireless@...r.kernel.org>,
"open list:NETWORKING DRIVERS" <netdev@...r.kernel.org>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Linux PCI <linux-pci@...r.kernel.org>,
Maximilian Luz <luzmaximilian@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Pali Rohár <pali@...nel.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Johannes Berg <johannes@...solutions.net>,
"# 9798ac6d32c1 mfd : cros_ec : Add cros_ec_cmd_xfer_status helper"
<stable@...r.kernel.org>
Subject: Re: [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@...d.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
Powered by blists - more mailing lists