linux/drivers/net
Emmanuel Grumbach 2220fb2960 iwlwifi: split the handler and the wake parts of the notification infra
The notification infrastructure (iwl_notification_wait_*
functions) allows to wait until a list of notifications
will come up from the firmware and to run a special handler
(notif_wait handler) when those are received.

The operation mode notifies the notification infrastructure
about any Rx being received by the mean of
iwl_notification_wait_notify() which will do two things:
1) call the notif_wait handler
2) wakeup the thread that was waiting for the notification

Typically, only after those two steps happened, the
operation mode will run its own handler for the notification
that was received from the firmware. This means that the
thread that was waiting for that notification can be
running before the operation mode's handler was called.

When the operation mode's handler is ASYNC, things get even
worse since the thread that was waiting for the
notification isn't even guaranteed that the ASYNC callback
was added to async_handlers_list before it starts to run.
This means that even calling
iwl_mvm_wait_for_async_handlers() can't guarantee that
absolutely everything related to that notification has run.
The following can happen:

Thread sending the command        Operation mode's Rx path
--------------------------        ------------------------
iwl_init_notification_wait()
iwl_mvm_send_cmd()
                                  iwl_mvm_rx_common()
                                  iwl_notification_wait_notify()
iwl_mvm_wait_for_async_handlers()
// Possibly free some data
// structure
                                  list_add_tail(async_handlers_list);
                                  schedule_work(async_handlers_wk);
                                  // Access the freed structure

Split the 'run notif_wait's handler' and the 'wake up the
thread' parts to fix this. This allows the operation mode
to do the following:

Thread sending the command        Operation mode's Rx path
--------------------------        ------------------------
iwl_init_notification_wait()
iwl_mvm_send_cmd()
                                  iwl_mvm_rx_common()
                                  iwl_notification_wait()
                                  // Will run the notif_wait's handler
                                  list_add_tail(async_handlers_list);
                                  schedule_work(async_handlers_wk);
                                  iwl_notification_notify()
iwl_mvm_wait_for_async_handlers()

This way, the waiter is guaranteed that all the handlers
have been run (if SYNC), or at least enqueued (if ASYNC)
by the time it wakes up.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-04-19 22:21:49 +03:00
..
appletalk
arcnet lib/vsprintf.c: remove %Z support 2017-02-27 18:43:47 -08:00
bonding bonding: attempt to better support longer hw addresses 2017-04-05 18:44:54 -07:00
caif virtio: allow drivers to request IRQ affinity when creating VQs 2017-02-27 20:54:04 +02:00
can can: hi311x: Add Holt HI-311x CAN driver 2017-04-04 17:35:59 +02:00
cris net: cris: eth_v10: use new api ethtool_{get|set}_link_ksettings 2017-03-27 15:53:19 -07:00
dsa net: dsa: mt7530: Include gpio/consumer.h for GPIO functions 2017-04-09 18:28:54 -07:00
ethernet ftgmac100: Set default ring sizes to 128 entries 2017-04-12 10:17:02 -04:00
fddi
fjes Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-03-23 16:41:27 -07:00
hamradio driver core patches for 4.11-rc1 2017-02-22 11:44:32 -08:00
hippi
hyperv netvsc: use napi_consume_skb 2017-04-09 18:14:25 -07:00
ieee802154 net: break include loop netdevice.h, dsa.h, devlink.h 2017-03-28 22:46:04 -07:00
ipvlan
irda irda: vlsi_ir: fix check for DMA mapping errors 2017-03-25 20:14:40 -07:00
phy Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-04-06 08:24:51 -07:00
plip
ppp sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
slip sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h> 2017-03-02 08:42:29 +01:00
team team: use ETH_MAX_MTU as max mtu 2017-03-08 22:19:17 -08:00
usb usbnet: pegasus: Use net_device_stats from struct net_device 2017-04-07 07:03:33 -07:00
vmxnet3 net: vmxnet3: use new api ethtool_{get|set}_link_ksettings 2017-03-22 19:26:52 -07:00
wan ucc/hdlc: fix two little issue 2017-03-13 21:53:48 -07:00
wimax net: wimax/i2400m: fix NULL-deref at probe 2017-03-13 12:28:40 -07:00
wireless iwlwifi: split the handler and the wake parts of the notification infra 2017-04-19 22:21:49 +03:00
xen-netback xen-netback: fix race condition on XenBus disconnect 2017-03-12 23:44:43 -07:00
dummy.c Enable tx timestamping on loopback and dummy 2017-03-21 14:40:01 -07:00
eql.c
geneve.c geneve: lock RCU on TX path 2017-03-01 09:58:31 -08:00
gtp.c gtp: support SGSN-side tunnels 2017-03-25 20:11:19 -07:00
ifb.c
Kconfig vmxnet3: prevent building with 64K pages 2017-02-17 15:25:49 -05:00
LICENSE.SRC
loopback.c Cleanup some warning from timestamping code. 2017-03-21 14:40:02 -07:00
macsec.c macsec: fix validation failed in asynchronous operation. 2017-02-21 13:13:51 -05:00
macvlan.c
macvtap.c sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
Makefile net: phy: Allow building mdio-boardinfo into the kernel 2017-03-29 10:32:32 -07:00
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c net: net_netdev: use new api ethtool_{get|set}_link_ksettings 2017-03-13 15:25:53 -07:00
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c sched/headers: Move task_struct::signal and task_struct::sighand types and accessors into <linux/sched/signal.h> 2017-03-03 01:43:37 +01:00
tun.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-03-23 16:41:27 -07:00
veth.c net: veth: use new api ethtool_{get|set}_link_ksettings 2017-03-29 14:07:22 -07:00
virtio_net.c net: virtio_net: use new api ethtool_{get|set}_link_ksettings 2017-03-22 19:26:52 -07:00
vrf.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-03-23 16:41:27 -07:00
vxlan.c vxlan: fix ND proxy when skb doesn't have transport header offset 2017-04-03 18:50:42 -07:00
xen-netfront.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-02-22 10:15:09 -08:00