All of lore.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org, Ping-Ke Shih <pkshih@realtek.com>
Subject: Re: [PATCH 11/11] rtlwifi: Add work queue for c2h cmd.
Date: Sat, 28 Jan 2017 11:31:29 -0600	[thread overview]
Message-ID: <a26323a4-cde7-8e8e-1a0c-f9de8ea4b366@lwfinger.net> (raw)
In-Reply-To: <87ziibfzcm.fsf@purkki.adurom.net>

On 01/28/2017 12:55 AM, Kalle Valo wrote:
> Larry Finger <Larry.Finger@lwfinger.net> writes:
>
>> From: Ping-Ke Shih <pkshih@realtek.com>
>>
>> btcoex needs to sleep, thus it must run in thread context.
>>
>> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>
> [...]
>
>> +void rtl_c2hcmd_launcher(struct ieee80211_hw *hw, int exec)
>> +{
>> +	struct rtl_priv *rtlpriv = rtl_priv(hw);
>> +	unsigned long flags;
>> +	struct rtl_c2hcmd *c2hcmd;
>> +
>> +	while (true) {
>> +		/* dequeue a task */
>> +		spin_lock_irqsave(&rtlpriv->locks.c2hcmd_lock, flags);
>> +
>> +		c2hcmd = list_first_entry_or_null(&rtlpriv->c2hcmd_list,
>> +						  struct rtl_c2hcmd, list);
>> +
>> +		if (c2hcmd)
>> +			list_del(&c2hcmd->list);
>> +
>> +		spin_unlock_irqrestore(&rtlpriv->locks.c2hcmd_lock, flags);
>> +
>> +		/* do it */
>> +		if (!c2hcmd)
>> +			break;
>> +
>> +		if (rtlpriv->cfg->ops->c2h_content_parsing && exec)
>> +			rtlpriv->cfg->ops->c2h_content_parsing(hw,
>> +					c2hcmd->tag, c2hcmd->len, c2hcmd->val);
>> +
>> +		/* free */
>> +		kfree(c2hcmd->val);
>> +
>> +		kfree(c2hcmd);
>> +	}
>> +}
>
> Never ending loops are not really preferred in kernel, with a simple bug
> it could cause annoying system-wide problems. Can you add a some sort of
> failsafe mechanism, for example bailing out from the loop if it has been
> running more than 200 ms or something like that?

Certainly.

Larry

  reply	other threads:[~2017-01-28 17:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07  3:29 [PATCH 00/11 V4] rtlwifi: Various updates Larry Finger
2017-01-20 21:27 ` [PATCH 03/11] rtlwifi: Add a new enumeration value to btc_set_type Larry Finger
2017-01-20 21:27 ` [PATCH 05/11] rtlwifi: btcoexist: Change logging in halbtc8192e2ant.c Larry Finger
2017-01-28  6:46   ` Kalle Valo
2017-01-20 21:27 ` [PATCH 09/11] rtlwifi: btcoex: move bt_type declaration Larry Finger
2017-02-01 20:48 ` [PATCH 01/11 V2] rtlwifi: Fix programing CAM content sequence Larry Finger
2017-02-06 11:50   ` Kalle Valo
2017-02-06 12:45   ` [PATCH 01/11 V3] " Kalle Valo
2017-02-07  3:29     ` Larry Finger
2017-02-07  5:42     ` Larry Finger
2017-02-07  7:08       ` Kalle Valo
2017-02-01 20:48 ` [PATCH 11/11 V2] rtlwifi: Add work queue for c2h cmd Larry Finger
2017-01-28  6:55   ` [PATCH 11/11] " Kalle Valo
2017-01-28 17:31     ` Larry Finger [this message]
2017-02-03 17:32 ` [PATCH 02/11 V3] rtlwifi: Set retry limit depends on vif type Larry Finger
2017-02-03 17:32 ` [PATCH 04/11 V3] rtlwifi: btcoexist: Add vendor definition for new btcoexist Larry Finger
2017-02-07  3:30 ` [PATCH 05/11 V4] rtlwifi: btcoexist: Change logging in halbtc8192e2ant.c Larry Finger
2017-02-07  3:30 ` [PATCH 06/11 V4] rtlwifi: rtl8723be: btcoexist: Add single_ant_path Larry Finger
2017-02-07  3:30 ` [PATCH 07/11 V4] rtlwifi: move btcoex's ant_num declaration Larry Finger
2017-02-07  3:30 ` [PATCH 08/11 V4] rtlwifi: rtl8723be: btcoex: add package_type function to btcoex Larry Finger
2017-02-07  3:30 ` [PATCH 10/11 V4] rtlwifi: rtl8723be: fix ant_sel code Larry Finger
2017-02-07  7:29 ` [PATCH 00/11 V4] rtlwifi: Various updates Kalle Valo

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=a26323a4-cde7-8e8e-1a0c-f9de8ea4b366@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.