Re: [PATCH] mwifiex: add __GFP_REPEAT to skb allocation call

2016-03-28 Thread James Cameron
On Tue, Mar 29, 2016 at 12:47:20PM +0800, Wei-Ning Huang wrote:
> "single skb allocation failure" happens when system is under heavy
> memory pressure.  Add __GFP_REPEAT to skb allocation call so kernel
> attempts to reclaim pages and retry the allocation.

Oh, that's interesting, we're back to this symptom again.

Nice to see this fix.

Heavy memory pressure on 3.5 caused dev_alloc_skb failure in this
driver.  Tracked at OLPC as #12694.

-- 
James Cameron
http://quozl.netrek.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mwifiex: add __GFP_REPEAT to skb allocation call

2016-03-28 Thread Wei-Ning Huang
"single skb allocation failure" happens when system is under heavy
memory pressure.  Add __GFP_REPEAT to skb allocation call so kernel
attempts to reclaim pages and retry the allocation.

Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index b2c839a..c64989c 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -1124,7 +1124,8 @@ static void mwifiex_deaggr_sdio_pkt(struct 
mwifiex_adapter *adapter,
break;
}
skb_deaggr = mwifiex_alloc_dma_align_buf(pkt_len,
-GFP_KERNEL | GFP_DMA);
+GFP_KERNEL | GFP_DMA |
+__GFP_REPEAT);
if (!skb_deaggr)
break;
skb_put(skb_deaggr, pkt_len);
@@ -1374,7 +1375,8 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct 
mwifiex_adapter *adapter,
/* copy pkt to deaggr buf */
skb_deaggr = mwifiex_alloc_dma_align_buf(len_arr[pind],
 GFP_KERNEL |
-GFP_DMA);
+GFP_DMA |
+__GFP_REPEAT);
if (!skb_deaggr) {
mwifiex_dbg(adapter, ERROR, "skb allocation 
failure\t"
"drop pkt len=%d type=%d\n",
@@ -1416,7 +1418,8 @@ rx_curr_single:
mwifiex_dbg(adapter, INFO, "info: RX: port: %d, rx_len: %d\n",
port, rx_len);
 
-   skb = mwifiex_alloc_dma_align_buf(rx_len, GFP_KERNEL | GFP_DMA);
+   skb = mwifiex_alloc_dma_align_buf(rx_len, GFP_KERNEL | GFP_DMA |
+ __GFP_REPEAT);
if (!skb) {
mwifiex_dbg(adapter, ERROR,
"single skb allocated fail,\t"
@@ -1521,7 +1524,8 @@ static int mwifiex_process_int_status(struct 
mwifiex_adapter *adapter)
rx_len = (u16) (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE);
mwifiex_dbg(adapter, INFO, "info: rx_len = %d\n", rx_len);
 
-   skb = mwifiex_alloc_dma_align_buf(rx_len, GFP_KERNEL | GFP_DMA);
+   skb = mwifiex_alloc_dma_align_buf(rx_len, GFP_KERNEL | GFP_DMA |
+ __GFP_REPEAT);
if (!skb)
return -1;
 
-- 
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] wcn36xx: Transition driver to SMD client

2016-03-28 Thread Bjorn Andersson
On Mon, Jan 11, 2016 at 1:02 AM, Eugene Krasnikov  wrote:
> Better late than never! Looks good to me.
>

Unfortunately I ran into an issue with ordering of operations between
the WiFi driver and the wcnss_ctrl driver. So an updated series is on
the way, but this depends on changes to the wcnss_ctrl driver, which
are being reviewed right now.

Regards,
Bjorn

> 2015-12-28 1:34 GMT+00:00 Bjorn Andersson :
>> The wcn36xx wifi driver follows the life cycle of the WLAN_CTRL SMD
>> channel, as such it should be a SMD client. This patch makes this
>> transition, now that we have the necessary frameworks available.
>>
>> Signed-off-by: Bjorn Andersson 
>> ---
>>  drivers/net/wireless/ath/wcn36xx/Kconfig   |   2 +-
>>  drivers/net/wireless/ath/wcn36xx/dxe.c |  16 +++--
>>  drivers/net/wireless/ath/wcn36xx/main.c| 111 
>> +
>>  drivers/net/wireless/ath/wcn36xx/smd.c |  26 ---
>>  drivers/net/wireless/ath/wcn36xx/smd.h |   4 ++
>>  drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  21 ++
>>  6 files changed, 99 insertions(+), 81 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/wcn36xx/Kconfig 
>> b/drivers/net/wireless/ath/wcn36xx/Kconfig
>> index 591ebaea8265..394fe5b77c90 100644
>> --- a/drivers/net/wireless/ath/wcn36xx/Kconfig
>> +++ b/drivers/net/wireless/ath/wcn36xx/Kconfig
>> @@ -1,6 +1,6 @@
>>  config WCN36XX
>> tristate "Qualcomm Atheros WCN3660/3680 support"
>> -   depends on MAC80211 && HAS_DMA
>> +   depends on MAC80211 && HAS_DMA && QCOM_SMD
>> ---help---
>>   This module adds support for wireless adapters based on
>>   Qualcomm Atheros WCN3660 and WCN3680 mobile chipsets.
>> diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c 
>> b/drivers/net/wireless/ath/wcn36xx/dxe.c
>> index f8dfa05b290a..47f3937a7ab9 100644
>> --- a/drivers/net/wireless/ath/wcn36xx/dxe.c
>> +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c
>> @@ -23,6 +23,7 @@
>>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>>
>>  #include 
>> +#include 
>>  #include "wcn36xx.h"
>>  #include "txrx.h"
>>
>> @@ -150,9 +151,12 @@ int wcn36xx_dxe_alloc_ctl_blks(struct wcn36xx *wcn)
>> goto out_err;
>>
>> /* Initialize SMSM state  Clear TX Enable RING EMPTY STATE */
>> -   ret = wcn->ctrl_ops->smsm_change_state(
>> -   WCN36XX_SMSM_WLAN_TX_ENABLE,
>> -   WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY);
>> +   ret = qcom_smem_state_update_bits(wcn->tx_enable_state,
>> + WCN36XX_SMSM_WLAN_TX_ENABLE |
>> + WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY,
>> + WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY);
>> +   if (ret)
>> +   goto out_err;
>>
>> return 0;
>>
>> @@ -676,9 +680,9 @@ int wcn36xx_dxe_tx_frame(struct wcn36xx *wcn,
>>  * notify chip about new frame through SMSM bus.
>>  */
>> if (is_low &&  vif_priv->pw_state == WCN36XX_BMPS) {
>> -   wcn->ctrl_ops->smsm_change_state(
>> - 0,
>> - WCN36XX_SMSM_WLAN_TX_ENABLE);
>> +   qcom_smem_state_update_bits(wcn->tx_rings_empty_state,
>> +   WCN36XX_SMSM_WLAN_TX_ENABLE,
>> +   WCN36XX_SMSM_WLAN_TX_ENABLE);
>> } else {
>> /* indicate End Of Packet and generate interrupt on 
>> descriptor
>>  * done.
>> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
>> b/drivers/net/wireless/ath/wcn36xx/main.c
>> index 7c169abdbafe..8659e3f997d2 100644
>> --- a/drivers/net/wireless/ath/wcn36xx/main.c
>> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
>> @@ -19,6 +19,9 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>> +#include 
>>  #include "wcn36xx.h"
>>
>>  unsigned int wcn36xx_dbg_mask;
>> @@ -981,48 +984,63 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
>>  }
>>
>>  static int wcn36xx_platform_get_resources(struct wcn36xx *wcn,
>> - struct platform_device *pdev)
>> + struct device *dev)
>>  {
>> -   struct resource *res;
>> +   u32 mmio[2];
>> +   int ret;
>> +
>> /* Set TX IRQ */
>> -   res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
>> -  "wcnss_wlantx_irq");
>> -   if (!res) {
>> +   wcn->tx_irq = irq_of_parse_and_map(dev->of_node, 0);
>> +   if (!wcn->tx_irq) {
>> wcn36xx_err("failed to get tx_irq\n");
>> return -ENOENT;
>> }
>> -   wcn->tx_irq = res->start;
>>
>> /* Set RX IRQ */
>> -   res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
>> -  "wcnss_wlanrx_irq");
>> -   

Question on rhashtable in worst-case scenario.

2016-03-28 Thread Ben Greear

Hello!

I have a use case for mac80211 where I create multiple stations to
the same remote peer MAC address.

I'm seeing cases where the rhashtable logic is returning -16 (EBUSY)
on insert (see sta_info_hash_add).
This is with the 4.4.6+ (plus local patches) kernel, and it has the patch 
mentioned
here:

https://lkml.org/lkml/2015/12/3/307

If I understand the code properly, my use case is going to be worst-case 
scenario,
where all of my items in the hash have the same key (peer mac addr).

I have my own secondary hash to handle most of my hot-path lookups, but I still 
need
the main hash to at least function in a linear-search manner.

Any idea what I can do to get rid of the EBUSY return code problem, or how
to debug it further?

Thanks,
Ben

--
Ben Greear 
Candela Technologies Inc  http://www.candelatech.com

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: hashing error in hacked 4.4.6+ kernel.

2016-03-28 Thread Ben Greear

So, it appears at least part of the problem is that the station is not
added to the hash to begin with, and existing code does not check for that 
failure
or deal with it.  I added a check and I see this below.

That -16 value means EBUSY from what I can tell, because two rehashes
are scheduled at once (see hashtable_insert_rehash)

What we can do to protect against this?


ath10k_pci :05:00.0: ATH10K_END
ath10k_pci :05:00.0: Unknown eventid: 36898
sta10: 04:f0:21:db:c8:d1 authenticate with 04:f0:21:f6:85:1c at: 
1459188823.781974
[ cut here ]
WARNING: CPU: 2 PID: 3114 at 
/home/greearb/git/linux-4.4.dev.y/net/mac80211/sta_info.c:327 
sta_info_insert_finish+0x2d1/0x6da [mac80211]()
Modules linked in: nf_conntrack_netlink nf_conntrack nfnetlink nf_defrag_ipv4 8021q garp mrp stp llc bnep bluetooth fuse macvlan wanlink(O) pktgen 
rpcsec_gss_krb5 nfsv4 nfs fscache iTCO_wdt iTCO_vendor_support coretemp ath9k hwmon ath10k_pci intel_rapl iosf_mbi ath9k_common ath10k_core ath9k_hw 
x86_pkg_temp_thermal intel_powerclamp kvm_intel ath joydev kvm mac80211 irqbypass serio_raw pcspkr cfg80211 snd_hda_codec_hdmi lpc_ich i2c_i801 
snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm 8250_fintek snd_timer snd shpchp 
soundcore tpm_tis tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc ata_generic pata_acpi e1000e ptp i915 i2c_algo_bit pps_core drm_kms_helper drm i2c_core video 
fjes ipv6 [last unloaded: nf_conntrack]

CPU: 0 PID: 3114 Comm: wpa_supplicant Tainted: GW  O4.4.6+ #21
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 
4.6.5 05/02/2012
ath10k_pci :05:00.0: ath10k_pci ATH10K_DBG_BUFFER:
ath10k: []: 92F4 07FC4C02 0001 92F4 07FC4C02 0001 92FF 
082C3812
ath10k: [0008]: 000F5C2C 0042507C 92FF 102C3809 143C 0001  

ath10k: [0016]: 9348 17FC5823 004402E0 851C  0040 0001 
934A
ath10k: [0024]: 17FC4C01 0F00851C 000A 06003007 FFAA  934B 
17FC4C01
ath10k: [0032]: 71108880  00C400BF  0FF0 934B 17FC4C01 
71108880
ath10k: [0040]: 0001 00C400BF   934B 17FC4C01 71108880 
0002
ath10k: [0048]: 00C400BF   934B 17FC4C01 71108880 0003 
00C400BF
ath10k: [0056]: 00FF  934B 17FC4C01 71108880 0004 00C400BF 
00FF
ath10k: [0064]:  934B 17FC4C01 71108880 0005 00C400BF 00FF 
FBFF
ath10k_pci :05:00.0: ATH10K_END
  8801fee5b490 8137086d 
 0009 8801fee5b4c8 810ee1eb a07d4519
 8800d5350a60 fff0 8801ff33 8800cec6ca40
Call Trace:
 [] dump_stack+0x81/0xb6
 [] warn_slowpath_common+0x94/0xad
 [] ? sta_info_insert_finish+0x2d1/0x6da [mac80211]
 [] warn_slowpath_null+0x15/0x17
 [] sta_info_insert_finish+0x2d1/0x6da [mac80211]
 [] ? rcu_read_lock_sched_held+0x54/0x5c
 [] ? ath10k_dbg_dump+0x1cc/0x259 [ath10k_core]
 [] ? __lock_acquire+0x641/0xde7
 [] ? ath10k_pci_hif_tx_sg+0x48/0x1b7 [ath10k_pci]
 [] ? __lock_is_held+0x3c/0x57
 [] ? mark_lock+0x24/0x201
 [] ? mark_held_locks+0x5e/0x74
 [] ? __local_bh_enable_ip+0x9f/0xb9
 [] ? trace_hardirqs_on_caller+0x16f/0x18b
 [] ? ath10k_pci_hif_tx_sg+0x182/0x1b7 [ath10k_pci]
 [] ? trace_hardirqs_on+0xd/0xf
 [] ? __local_bh_enable_ip+0xa4/0xb9
 [] ? mark_lock+0x24/0x201
 [] ? __lock_acquire+0x641/0xde7
 [] ? sta_info_insert_rcu+0xa0/0xb7 [mac80211]
 [] ? __lock_is_held+0x3c/0x57
 [] ? lock_is_held+0x49/0x50
 [] ? __lock_is_held+0x3c/0x57
 [] ? mark_lock+0x24/0x201
 [] ? mark_held_locks+0x5e/0x74
 [] ? mutex_lock_nested+0x32e/0x3cf
 [] ? trace_hardirqs_on_caller+0x16f/0x18b
 [] ? mutex_lock_nested+0x336/0x3cf
 [] ? sta_info_insert_rcu+0xa0/0xb7 [mac80211]
 [] ? ___might_sleep+0xc8/0x1ba
 [] sta_info_insert_rcu+0xa8/0xb7 [mac80211]
 [] sta_info_insert+0xa/0x17 [mac80211]
 [] ieee80211_prep_connection+0x743/0x78e [mac80211]
 [] ieee80211_mgd_auth+0x20f/0x2cd [mac80211]
 [] ? cfg80211_get_bss+0x26d/0x2ec [cfg80211]
 [] ? __lock_is_held+0x3c/0x57
 [] ieee80211_auth+0x13/0x15 [mac80211]
 [] cfg80211_mlme_auth+0x1d8/0x277 [cfg80211]
 [] nl80211_authenticate+0x25b/0x283 [cfg80211]
 [] genl_family_rcv_msg+0x23a/0x28a
 [] genl_rcv_msg+0x3f/0x58
 [] ? genl_family_rcv_msg+0x28a/0x28a
 [] netlink_rcv_skb+0x45/0x89
 [] genl_rcv+0x23/0x32
 [] netlink_unicast+0xdc/0x154
 [] netlink_sendmsg+0x4bb/0x4d2
 [] sock_sendmsg+0x2e/0x3f
 [] ___sys_sendmsg+0x1bb/0x253
 [] ? current_kernel_time64+0xb/0x31
 [] ? lock_release+0x1bb/0x3bd
 [] ? lock_acquire+0x152/0x1cb
 [] ? lock_release+0x1bb/0x3bd
 [] ? lock_acquire+0x132/0x1cb
 [] ? read_seqcount_begin.constprop.23+0x6b/0x87
 [] ? trace_hardirqs_on_caller+0x16f/0x18b
 [] ? __fget_light+0x48/0x6c
 [] __sys_sendmsg+0x3d/0x5b
 [] ? __sys_sendmsg+0x3d/0x5b
 [] SyS_sendmsg+0xd/0x17
 [] entry_SYSCALL_64_fastpath+0x16/0x7a

[PATCH] mwifiex: ie_list is an array, so no need to check if NULL

2016-03-28 Thread Colin King
From: Colin Ian King 

ap_ie->ie_list is an array of struct mwifiex_ie and can never
be null, so the null check on this array is redundant and can
be removed.

Signed-off-by: Colin Ian King 
---
 drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c 
b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
index 16d95b2..92ce32f 100644
--- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
@@ -694,7 +694,7 @@ static int mwifiex_uap_custom_ie_prepare(u8 *tlv, void 
*cmd_buf, u16 *ie_size)
struct mwifiex_ie_list *ap_ie = cmd_buf;
struct mwifiex_ie_types_header *tlv_ie = (void *)tlv;
 
-   if (!ap_ie || !ap_ie->len || !ap_ie->ie_list)
+   if (!ap_ie || !ap_ie->len)
return -1;
 
*ie_size += le16_to_cpu(ap_ie->len) +
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [lsb-discuss] Google Summer of Code 2016 - Many new applications

2016-03-28 Thread Greg KH
On Sat, Mar 26, 2016 at 03:07:18PM -0300, Till Kamppeter wrote:
> >If there's anything else I need to do here, becides try to find a
> >co-mentor, please let me know.
> >
> 
> I am grateful if you could enter as co-mentor, especially if there is any
> kernel project now which has only one mentor.

I don't understand, we only have one kernel project with one proposed
mentor (me) right now, are we requiring all projects to have 2 mentors
now?  I've never done it that way in the past...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] iwlwifi: pcie: remove duplicate assignment of variable isr_stats

2016-03-28 Thread Grumbach, Emmanuel
On Mon, 2016-03-28 at 12:33 +0100, Colin King wrote:
> From: Colin Ian King 
> 
> isr_stats is written twice with the same value, remove one of the
> redundant assignments to isr_stats.
> 
> Signed-off-by: Colin Ian King 
> ---


Applied - thanks.

>  drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
> b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
> index 4be3c35..253e4f0 100644
> --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
> +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
> @@ -1805,7 +1805,7 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq,
> void *dev_id)
>   struct msix_entry *entry = dev_id;
>   struct iwl_trans_pcie *trans_pcie =
> iwl_pcie_get_trans_pcie(entry);
>   struct iwl_trans *trans = trans_pcie->trans;
> - struct isr_statistics *isr_stats = isr_stats = _pcie
> ->isr_stats;
> + struct isr_statistics *isr_stats = _pcie->isr_stats;
>   u32 inta_fh, inta_hw;
>  
>   lock_map_acquire(>sync_cmd_lockdep_map);

[PATCH] iwlwifi: pcie: remove duplicate assignment of variable isr_stats

2016-03-28 Thread Colin King
From: Colin Ian King 

isr_stats is written twice with the same value, remove one of the
redundant assignments to isr_stats.

Signed-off-by: Colin Ian King 
---
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index 4be3c35..253e4f0 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -1805,7 +1805,7 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void 
*dev_id)
struct msix_entry *entry = dev_id;
struct iwl_trans_pcie *trans_pcie = iwl_pcie_get_trans_pcie(entry);
struct iwl_trans *trans = trans_pcie->trans;
-   struct isr_statistics *isr_stats = isr_stats = _pcie->isr_stats;
+   struct isr_statistics *isr_stats = _pcie->isr_stats;
u32 inta_fh, inta_hw;
 
lock_map_acquire(>sync_cmd_lockdep_map);
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html