From: Johannes Berg <johannes@sipsolutions.net>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Wey-Yi Guy <wey-yi.w.guy@intel.com>,
Reinette Chatre <reinette.chatre@intel.com>,
"John W. Linville" <linville@tuxdriver.com>,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH w-t] iwlwifi: rewrite iwl-scan.c to avoid race conditions
Date: Wed, 01 Sep 2010 14:52:33 +0200 [thread overview]
Message-ID: <1283345553.4124.6.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <20100831150021.GA10963@redhat.com>
Some comments on the patch:
> static int iwl_send_scan_abort(struct iwl_priv *priv)
> {
> - int ret = 0;
> + int ret;
> struct iwl_rx_packet *pkt;
> struct iwl_host_cmd cmd = {
> .id = REPLY_SCAN_ABORT_CMD,
> .flags = CMD_WANT_SKB,
> };
Since you're going through, and probably know where what lock is needed,
could you annotate the places with, e.g.
lockdep_assert_held(&priv->mutex)?
If you're not sure, that's fine, but if you know already that'd probably
make things easier in the future.
> +static inline void iwl_complete_scan(struct iwl_priv *priv, bool aborted)
These "inline" annotations seem wrong, either the function is used once,
then gcc will inline it, or it is used multiple times, then we shouldn't
inline it.
> +static void iwl_do_scan_abort(struct iwl_priv *priv)
> + lockdep_assert_held(&priv->mutex);
:-)
> +/**
> + * iwl_scan_cancel_sleep - Cancel any currently executing HW scan,
> + * wait for hardware/firmware! completion
> + */
> +int iwl_scan_cancel_sleep(struct iwl_priv *priv)
> +{
> + int ret;
> + unsigned long timeout = jiffies + IWL_SCAN_ABORT_SLEEP;
> +
> + IWL_DEBUG_SCAN(priv, "Scan cancel wait\n");
> +
> + cancel_delayed_work(&priv->scan_timeout);
> + iwl_do_scan_abort(priv);
> +
> + while (time_before_eq(jiffies, timeout)) {
> + if (!test_bit(STATUS_SCAN_HW, &priv->status))
> + break;
> + msleep(20);
> + }
This, and
> +void iwl_wait_for_scan_end(struct iwl_priv *priv)
> +{
> + unsigned long timeout = jiffies + IWL_SCAN_WAIT_END;
> +
> + while (time_before_eq(jiffies, timeout)) {
> + if (!test_bit(STATUS_SCANNING, &priv->status))
> + break;
> + msleep(20);
> + }
this seems like it could use a completion?
johannes
next prev parent reply other threads:[~2010-09-01 12:52 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-31 15:00 [PATCH w-t] iwlwifi: rewrite iwl-scan.c to avoid race conditions Stanislaw Gruszka
2010-09-01 10:59 ` Johannes Berg
2010-09-01 11:58 ` Stanislaw Gruszka
2010-09-01 12:41 ` Johannes Berg
2010-09-01 14:16 ` Stanislaw Gruszka
2010-09-01 14:26 ` Johannes Berg
2010-09-01 15:24 ` Stanislaw Gruszka
2010-09-01 16:04 ` Johannes Berg
2010-09-02 8:47 ` Stanislaw Gruszka
2010-09-02 9:21 ` Johannes Berg
2010-09-02 10:52 ` Stanislaw Gruszka
2010-09-01 12:52 ` Johannes Berg [this message]
2010-09-01 14:16 ` Stanislaw Gruszka
2010-09-01 14:24 ` Johannes Berg
2010-09-02 9:36 ` Johannes Berg
2010-09-02 11:07 ` Stanislaw Gruszka
2010-09-02 11:36 ` Johannes Berg
2010-09-02 11:42 ` Stanislaw Gruszka
2010-09-02 10:17 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1283345553.4124.6.camel@jlt3.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=reinette.chatre@intel.com \
--cc=sgruszka@redhat.com \
--cc=wey-yi.w.guy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).