Commit Graph

8 Commits

Author SHA1 Message Date
Sourav Mohapatra
b273c0fa3a qcacld-3.0: Reject down the tree transitions instead of waiting
The driver currently waits for driver transitions (loading/unloading)
to complete before allowing a psoc or vdev level transition/operation.
This can lead to race conditions if the driver acquires rtnl lock as a part
of the operation and simultaneously a driver transition is invoked.

One such scenario occurs if delete virtual interface is invoked in parallel
to rmmod. The timing of the calls can be such that the delete interface is
waiting on DSC queue to complete after rmmod while the rmmod is waiting on
the rtnl lock to be freed by the delete interface resulting in a scenario
where the threads are waiting on the other to complete.

* Thread B - Invokes rmmod and context switch happens before rtnl lock is
             taken

* Thread A - Takes rtnl lock and invokes iw dev wlan0 del
	   - Context switch after entering wlan_hdd_del_virtual_intf
	     before osif_vdev_sync_trans_start_wait

* Thread B - Waits for rtnl lock to be released by Thread A

* Thread A - Waits for driver transition to be completed by Thread B

To avoid this possible scenario, modify the infrastructure such that any
down the tree transitions/operations are rejected if a driver transition
is taking place instead of waiting. Also, modify the corresponding tests
in the DSC unit test framework to correctly verify the changes made.

Change-Id: I61715c8fc2df33fd2deb46389da0375e4df5080c
CRs-Fixed: 2475386
2019-08-08 08:40:17 -07:00
Dustin Brown
06878b3a80 qcacld-3.0: Reject up-tree ops during transition
Currently, the Driver Synchronization Core (DSC) blocks transitions
up-tree and down-tree from a node currently undergoing a transition, but
only rejects operations down-tree from the current node. Instead, reject
new operations both up-tree and down-tree from the current node under
transition. This provides more forgiving safety guarantees to operation
implementations at the cost of a reduced amount of parallelism that can
be achieved.

Change-Id: I09e1c48f7030a2252380d172c1c00ee22eac39c5
CRs-Fixed: 2421786
2019-03-25 12:39:31 -07:00
Dustin Brown
207286b118 qcacld-3.0: Provide reason to QDF_DEBUG_PANIC()
A common pattern in WLAN to panic the driver is to log the reason and
then unconditionally panic. QDF_DEBUG_PANIC() takes a reason string to
help make the reason for the panic more obvious, but it is not always
used. Ensure all callers of QDF_DEBUG_PANIC() provide a reason string.

Change-Id: I3d23a8980adaeaa1a9798a4a6b0fba1f36eb52ad
CRs-Fixed: 2403829
2019-02-23 14:06:21 -08:00
Dustin Brown
26ef417482 qcacld-3.0: Fix race in DSC threaded unit test
Very occasionally, the driver transition thread for the DSC race
condition unit test can be preempted before queuing the driver
transition. This leads to the transitions de-queuing in an unexpected
order, causing the test to fail. In order to close the race window, a
thread would have to set its event _after_ blocking on a pending
transition, which is impossible. So, rather than using events to
synchronize the different threads in this test case, use polling to
ensure the different transitions are queued in the appropriate order.
If the given condition is not met, call schedule() to give the other
threads a greater chance to run.

Change-Id: I05edfa9200ca7831926153f3ff0ec9dbbbab3fed
CRs-Fixed: 2378469
2019-01-10 19:42:10 -08:00
Dustin Brown
7d038e52b4 qcacld-3.0: Use vtable for unit test ioctl
Convert the current hard-coded list of unit-test callbacks in
hdd_we_unit_test() to a vtable. This streamlines future additions.

Change-Id: I216bbb6699ae50eaa96ac559999cb42ba080867c
CRs-Fixed: 2358606
2018-11-29 23:33:20 -08:00
Dustin Brown
4f74e9522b qcacld-3.0: Add transition timeout detection to DSC
In order to catch and debug long running transitions, add a watchdog
timer to Driver Synchronization Core (DSC) transition start/stop call
pairs. If the timer expires, panic the driver for offline debugging.

Change-Id: I9b64fdb9cc20e1225394702d58b24db92a2d67e1
CRs-Fixed: 2328596
2018-10-09 12:37:26 -07:00
Dustin Brown
6661df3104 qcacld-3.0: Add Driver Synchronization Core (unit test)
The Driver Synchronization Core (DSC) is a set of synchronization
primitives for use by the driver's orchestration layer. It provides APIs
for ensuring safe state transitions (including bring up and tear down)
of major driver objects: a single driver, associated psocs, and their
associated vdevs.

APIs are divided into two categories: mutual exclusion of conflicting
transitions, and operation tracking, blocking, and waiting capabilities.

For part 5, add the unit test implementations.

Change-Id: Ia68d6df18894b254c1f5fe3855d896e96be38a90
CRs-Fixed: 2290260
2018-08-06 19:03:05 -07:00
Dustin Brown
424788cfe0 qcacld-3.0: Add Driver Synchronization Core (common)
The Driver Synchronization Core (DSC) is a set of synchronization
primitives for use by the driver's orchestration layer. It provides APIs
for ensuring safe state transitions (including bring up and tear down)
of major driver objects: a single driver, associated psocs, and their
associated vdevs.

APIs are divided into two categories: mutual exclusion of conflicting
transitions, and operation tracking, blocking, and waiting capabilities.

For part 1, add common infrastructure and headers.

Change-Id: Id290e66d2dccd28b89fed5f285d3692ff3c814e7
CRs-Fixed: 2290260
2018-08-06 19:02:53 -07:00