Commit Graph

46 Commits

Author SHA1 Message Date
Dustin Brown
39bb395e2e qcacmn: Add scheduler history
To help triage issues where the scheduler thread is processing slowly,
add a scheduler processing history for offline analysis. This can also
be useful in determining if a processing delay in some operation is
attributed to the scheduler thread or not.

Change-Id: Icfea17efc34b2a23d4f8b2baebe08db4e2f6ce8b
CRs-Fixed: 2307252
2018-09-05 22:15:13 -07:00
gaurank kathpalia
6e4b9c54b6 qcacmn: Add support for src, dest in scheduler
Currently the scheduler is unaware of the source module
which posts the message to another layer.

To trace the src, dest, and the message under ML
logging, modify current infra, to include the src,
dest in the qip argument of the API
scheduler_post_msg_by_priority

Change-Id: Ia234f60cc33fcc37ab741c462052a6e50993e3bd
CRs-Fixed: 2300537
2018-08-23 15:25:42 -07:00
Vignesh Viswanathan
87a8e44583 qcacmn: Drop beacon/probe frames posted on Scan Queue if queue is full
Drop beacon/probe frames before posting on Scan queue if the queue
already has too many beacon/probes to process.

Also add scheduler API to get the queue size given the module ID.

Change-Id: I9153c7e77e74377863774b68e8163839e992358d
CRs-Fixed: 2298584
2018-08-21 01:51:29 -07:00
Nirav Shah
1b9674e21e qcacmn: umac: Add logging macros without function/line info
Add per module logging macros without function/line info
to avoid adding function/line info where it is not required.

Change-Id: I34ba6f6485f9b506264daf4e116052d2858bed40
CRs-Fixed: 2278876
2018-08-14 21:44:21 -07:00
Dustin Brown
8afde5a83f qcacmn: Reduce/remove scheduler logs
As part of the effort to reduce overly verbose and excessive logging
driver wide, reduce or remove logs in scheduler as much as possible.

Change-Id: I1e45c439315e81d9ff05e1688fe690d0ca30e097
CRs-Fixed: 2280337
2018-07-19 23:11:43 -07:00
Nirav Shah
a175314c51 qcacmn: Map all module logs to per-level log APIs
Map all module level log APIs to per-level log APIs
to compile out specific log level if required.

Change-Id: I4072b6740cb43200fd95c40943b66e1d5f8f1847
CRs-Fixed: 2266719
2018-07-13 10:36:22 -07:00
Dustin Brown
fe41df9c00 qcacmn: Move panic messages into QDF_DEBUG_PANIC
QDF_DEBUG_PANIC has recently gained a reason parameter. Move instance of
logging followed immediately by QDF_DEBUG_PANIC to single calls.

Change-Id: Ifc00be410621005e8494074ed00b1b7e44cc6a03
CRs-Fixed: 2271769
2018-07-09 15:55:35 -07:00
Dustin Brown
92d87f5161 qcacmn: Remove SYS_MSG_ID_MC_THR_PROBE
SYS_MSG_ID_MC_THR_PROBE is no longer used. Remove it from scheduler.

Change-Id: I23504da35778a54404e57df27ff4fa9100fa0cf3
CRs-Fixed: 2250404
2018-06-05 15:57:50 -07:00
Dustin Brown
c7ee85c4a8 qcacmn: Use qdf_flex_mem for scheduler messages
Currently, the scheduler thread keeps a large, pre-allocated array of
messages for use in message posting. The vast majority of the time,
however, the scheduler thread has zero or one messages pending in the
queue. This leads to a huge memory overhead for nominal driver
operation.

Replace the current pre-allocated scheduler message pool with a
hybrid static/dynamic approach.

Change-Id: Ie942bacfef43edf142a9f35ad0309069096cda90
CRs-Fixed: 2204172
2018-05-21 21:48:10 -07:00
Vivek
d78dedc9dd qcacmn: Configure qdf_flex_mem segments for scheduler pool
Configure the qdf_flex_mem segments for scheduler pool
to 32, which creates 1024 scheduler message buffers
during init.

Change-Id: Iefa9427b55b427f79aa21a90cbf6e8a05be35e59
CRs-Fixed:
2018-05-21 21:48:06 -07:00
Jeff Johnson
4865edfd19 qcacmn: scheduler: Fix misspelling of "message"
Address the following issue in scheduler_api.h:
CHECK: 'mesage' may be misspelled - perhaps 'message'?

Change-Id: Iaf5138f335be1dad2db2e3c52ffd47e28da21251
CRs-Fixed: 2241581
2018-05-19 19:40:36 -07:00
Jeff Johnson
80617cac20 qcacmn: scheduler: Remove legacy markings
Per current guidance remove legacy markings.

Change-Id: Ic2fdf678fab90f204c59cc0cbfe616d115b0d6b9
CRs-Fixed: 2230684
2018-05-18 02:17:41 -07:00
Zhu Jianmin
1c6bb03362 qcacmn: Avoid timer double free when disable scheduler
A global timer is created and freed by each module, if passed as
msg to mc queues, shouldn't be freed in scheduler_cleanup_queues,
or double free issue happens

For example, a timer in tLimTimers is freed in mac_stop->pe_stop
->lim_cleanup_mlm

Change-Id: I919b13f2570e3496a1de249fd90a88f3bfeaa131
CRs-Fixed: 2220514
2018-05-17 14:26:28 -07:00
Vignesh Viswanathan
6ecd284e5a qcacmn: Add handlers for scan queue in scheduler core
Add scheduler message handler function for QDF_MODULE_ID_SCAN queue.

Also post scan beacon/probe frames and scan events to SCAN queue instead
of TARGET_IF queue.

Change-Id: I94e3ea2f0eb5c9592f5cfcd91738778fa65ba815
CRs-Fixed: 2214554
2018-04-23 00:30:55 -07:00
Kabilan Kannan
aa6cfd9f97 qcacmn: Add magic string for debug enhancement
Add magic string in the driver to automate the
stability analysis.

Change-Id: Ie98e4abbce04e9528c57158754c27ce76332b283
CRs-Fixed: 2223765
2018-04-18 18:08:09 -07:00
Dustin Brown
c8e2987f93 qcacmn: Reduce SCHEDULER_CORE_MAX_MESSAGES to 1000
After profiling many iterations of several driver operations, the
observed absolute maximum number of queue scheduler messages was 452
during soft AP startup. Typical maximums for this test case are less
than 100, occasionally getting as high as 250. The median for all of
the driver operations in general were in the range of 1-2. Given this
information, a round number around twice the worst case rate was
picked.

Reduce SCHEDULER_CORE_MAX_MESSAGES to 1000, down from 8000 for MCL.
This saves a significant amount of unused statically allocated memory.

Change-Id: I6ef65db84ca524cea68afbc3bb49347c6d996992
CRs-Fixed: 2202692
2018-03-12 22:00:46 -07:00
Dustin Brown
3149adf58a qcacmn: Migrate scheduler logging functions
Part of the scheduler component has been migrated to the new sched_*
logging wrappers, but part of it still remains to be ported. Finish
migrating all of the scheduler logging APIs.

Change-Id: I5065d849a1523d6c27d6c6a27b1ad4605036c3e6
CRs-Fixed: 2201038
2018-03-09 13:39:51 -08:00
Vivek
f227fb7417 qcacmn: Reduce the number of scheduler message buffers for WIN
Reduced the number of scheduler message buffers for WIN to
2k from 4k since WIN is only using 2 scheduler queues.

Changed the order of two members of scheduler messgae structure
to avoid additional padding on 64bit platform.

Change-Id: Ic74d60878867c45413bc4fbd5c56feb4dd421699
CRs-Fixed: 2157621
2018-01-09 06:12:44 -08:00
Dustin Brown
e0c9f6699f qcacmn: split scheduler init/deinit
A commonly used and robust life-cycle pattern consists of the following
4 steps:

	1) create (allocate resources)
	2) start (mark resources as safe for use)
	3) stop (mark resources as unsafe for use)
	4) destroy (deallocate resources)

This pattern effectively prevents access to uninitialized and freed
resources. While the dispatcher psoc life-cycle follows this pattern,
the global life-cycle is condensed into steps 1 and 4. Unsurprisingly,
this led to uninitialized and freed resource access problems, especially
in regards to the scheduler thread.

Split the scheduler init and deinit life-cycle functions into init,
enable, disable, and deinit. Create new global enable and disable
dispatcher functions, and call the new scheduler APIs as appropriate.
This brings the global dispatcher life-cycle in line with the existing
psoc life-cycle, and prevents many scheduler related resource access
issues.

Change-Id: I58b65be0611f48e48354f28c221185f6f490f30c
CRs-Fixed: 2153283
2017-12-15 05:25:35 -08:00
Naveen Rawat
c3b7a68d54 qcacmn: Add SYS_MSG_ID_UMAC_STOP system message
Add SYS_MSG_ID_UMAC_STOP to allow umac close to be done in
mc thread context.

Change-Id: I11946ce7aa21ce96f71d604244b9981dcae9704a
CRs-Fixed: 2156189
2017-12-15 03:42:16 -08:00
Dustin Brown
f4c76f9329 qcacmn: Refactor Scheduler init/deinit paths
There are many minor discrepancies in the scheduler module's init and
deinit paths. Refactor the scheduler init/deinit code paths to address
any discrepancies between the two. Also ensure error path cleanup cleans
up all the resources that were previously created.

Change-Id: Ib392f41a887031cd710aebaca32eb653952550a4
CRs-Fixed: 2153210
2017-12-11 22:08:32 -08:00
Dustin Brown
91abaccb45 qcacmn: Use sched logging helpers in scheduler_api.c
A set of logging helpers for the scheduler component were previously
added to reduce boilerplate logging code. Update scheduler_api.c to use
the new logging helpers.

Change-Id: I45715e40dbdd5a94d064ca4c64290a443cacea34
CRs-Fixed: 2152575
2017-12-11 22:08:30 -08:00
Houston Hoffman
ef615e7655 qcacmn: Use atomic set bit ops for mc thread
The basic qdf bit ops are not atomic.  Race conditions
can lead to messages stuck in queues without mc thread
being woken up.

Change-Id: I42093b863c7ed93c5c2baf0bd14106eb4fe082fc
CRs-Fixed: 2118014
2017-10-17 21:49:24 -07:00
Poddar, Siddarth
5c57a8905e qcacmn: Add register/deregister data stall detect cb api
Add register and deregister data stall detect callback apis.

Change-Id: I59d5871b7ec03da4b4f69d87b14f7eb5e8606c4a
CRs-Fixed: 2090654
2017-10-06 12:27:19 -07:00
Jeff Johnson
b12e92eccd qcacmn: scheduler: Replace instances of unadorned %p
Replace instances of unadorned %p in scheduler.

Change-Id: Ia2571f2296ca657485568dcbf949316ffe8fa0df
CRs-Fixed: 2111274
2017-09-28 04:48:04 -07:00
Dustin Brown
7b32946958 qcacmn: Dump scheduler thread stack for watchdog bite
In the event of a scheduler thread watchdog bite, dump the scheduler
thread stack trace to aid in debugging.

Change-Id: I222556c7cb01985abe20b04a9383fc6c6d0724fc
CRs-Fixed: 2091875
2017-09-13 15:25:43 -07:00
Jeff Johnson
9b24afb720 qcacmn: Remove obsolete START and STOP SYS_MSG_IDs
The SYS_MSG_ID_MC_START and SYS_MSG_ID_MC_STOP message IDs are no
longer being used. so remove them.

Change-Id: I8d35a537ac2c2f7436b23033561e5d0ef09895df
CRs-Fixed: 2107075
2017-09-12 23:27:33 -07:00
Dustin Brown
bac753d968 qcacmn: Avoid WD panic during scheduler shutdown
Avoid scheduler watchdog panic during scheduler shutdown to avoid
interfering with recovery mechanisms.

Change-Id: If32cc77a9725fdb61fc09c4065fc2603f2e8e00b
CRs-Fixed: 2069429
2017-08-01 12:46:21 -07:00
Rajeev Kumar
e7e6e37448 qcacmn: Properly format new line spacing in scheduler_api.h
In scheudler_api.h properly format new line spacing between functions
and include files.

Change-Id: I7960ea7aeec3aef9c50a4a39efcd9db4d6f3951f
CRs-Fixed: 2051329
2017-05-30 17:31:20 -07:00
Dustin Brown
d2cd9eab9b qcacmn: Remove assert in Scheduler thread post message path
In situations where the scheduler thread has been stopped, but some
threads are still trying to post massages to it, a particular assert
can be triggered excessively. Remove the post message assert when the
scheduler thread is stopped, and instead simply log an error.

Change-Id: I5b898dc3ea22bbedcdf2287ef6f3bcee1560bb6b
CRs-Fixed: 2046232
2017-05-26 07:50:51 -07:00
Dustin Brown
e1d3d092f6 qcacmn: Add scheduler logging macros
To reduce boilerplate code, add standard logging macros to the scheduler
module.

Change-Id: I478ec2d16d340f419135101704f0ab3a5bf0b4d8
CRs-Fixed: 2042761
2017-05-19 23:58:21 -07:00
Vivek
83f387ac42 qcacmn: Change log levels in scheduler API's
Changed the log levels from ERROR to DEBUG for few prints
in the scheduler API's since the prints were not for errors
but for debugging purposes.

Change-Id: I2a351de5933cfe6ec7e52d48fbc6e32880854276
CRs-Fixed: 2034873
2017-05-16 07:26:48 -07:00
Krunal Soni
1880b6f8a6 qcacmn: Change init-deinit sequence of scheduler & call flush callback
Provide fix such a way that scheduler's initialization happens at the end after
all components' initialization gets done. Same-way scheduler's
deinitiazation happens very first before other component's deinit gets
started.

scheduler also need to call component's provided callback to notify
that component while flushing component's message queue.

CRs-Fixed: 2034772
Change-Id: I2c46bf9e68b93ecbc2ce9659d56de2887573411e
2017-05-03 03:06:33 -07:00
Rajeev Kumar
62d6736a1c qcacmn: Rename vStatus to linux style variable name
In scheduler core message processor rename camel case variable name
vStatus to qdf_status.

Change-Id: I2b22915269aad9583ab4a360b92938df3d976c66
CRs-Fixed: 2037960
2017-05-02 20:06:38 -07:00
Rajeev Kumar
7fb1969017 qcacmn: Rename pMsgWrapper to linux style variable name
In scheduler core message processor rename camel case variable name
pMsgWrapper to msg_wrapper.

Change-Id: Ica6715d9b14a807fdabc2da302de6ead4509aef8
CRs-Fixed: 2037958
2017-05-02 20:06:36 -07:00
Dustin Brown
e226cebdd2 qcacmn: Add Scheduler Watchdog Timer
In order to catch long running scheduler messages, start a watchdog
timer before processing each message, and stop the timer after each
message is processed. When the watchdog timer expires, immediately
crash the device in debug builds for easier debugging.

Change-Id: I4b43a9e12fc1f5b8a795fec790fe7548a100d9db
CRs-Fixed: 2037094
2017-04-26 17:01:52 -07:00
Rajeev Kumar
928e3ecad0 qcacmn: Add provision for flush callback in scheduler message
Add provision for flush callback in scheduler message such that
during driver unload scheduler can invoke the flush callback and
components can release the common object ref count which is taken
before posting the message.

Change-Id: I28490e18247239af27feef3a4b53e5080ab012fc
CRs-Fixed: 2034772
2017-04-18 17:13:14 -07:00
Rajeev Kumar
afc63bc8af qcacmn: Initialize scheduler_msg on stack before posting message
Initialize scheduler_msg on stack before posting using scheduler API
such that un-used fields in message structure are initialized to 0.

Change-Id: Ib3183b2c65eb9affd6610f4572c751c39a25fff7
CRs-Fixed: 2034772
2017-04-17 23:18:18 -07:00
Krunal Soni
c8039e3fa4 qcacmn: Validate existence of sch thread before posting a message
If scheduler thread thread doesn't exist or has been shutdown then
don't post a message otherwise it will cause a memory leak.

validate the existence of scheduler thread before posting a message.

Change-Id: Id0e75bdebc7db8c00d9efb8a6e8678491b21a20f
CRs-Fixed: 2031651
2017-04-17 20:47:26 -07:00
Rajeev Kumar
99a10d078d qcacmn: Do not allocate scheduler context dynamically
Scheduler context size is more than 400KB so run time memory
allocation may fail when system memory is fragmented. Do not
allocate scheduler context memory dynamcially instead allocate
it from .bss section.

Change-Id: I19ebd0689f81b971bde271e1a540952cf41a6cba
CRs-Fixed: 2020711
2017-03-16 19:14:46 -07:00
Krunal Soni
dce49ecf59 qcacmn: Deregister legacy & target queue callbacks upon scheduler down
Driver is missing couple of deregister handler while bringing down the
scheduler.

Change-Id: I99fe6e9a5d3cac800154945e41e707ebb7ee6396
CRs-Fixed: 2001133
2017-02-07 15:02:27 -08:00
Krunal Soni
ba5d80ca81 qcacmn: Initialize qid to qidx mapping to max value
By default qid to qidx mapping gets value zero as default
initialization which creates issue to identify whether zero
is valid or invalid index.

Initializing to maximum value will eliminate above mentioned
issue.

Change-Id: I4c0e2ba45e67fe6e167bd965bdb7ab901c3828a8
CRs-Fixed: 2001133
2017-02-07 15:02:26 -08:00
Vivek
315fe40bee qcacmn: Enable the scheduler based timer
Exporting the QDF timer API's required for enabling scheduler based timers.
Fixed the compilation issues when scheduler code is enabled.

Change-Id: I148bb17c361fdff101fab3711af3c0a6c4158963
CRs-Fixed: 1117366
2017-02-05 02:12:31 -08:00
Yuanyuan Liu
58cac671f3 qcacmn: decrement scheduler qidx count during deregister
Decrement scheduler qidx count during deregister.

Change-Id: Idabb59628aa9f493f17cfdc72aca1699e1b71e4d
CRs-Fixed: 1111374
2017-01-16 18:36:40 -08:00
Rajeev Kumar
73c05a8087 qcacmn: Add changes to detect if scheduler thread is stuck
Scheduler thread can get stuck because of many reasons like
mutex deadlock, resource starvation etc. Add changes to detect
if scheduler thread is stuck.

Change-Id: Ib9d4e3b240077464b3a51ab6be6af728cb845bfe
CRs-Fixed: 1107636
2017-01-10 18:20:24 -08:00
Rajeev Kumar
cd39549564 qcacmn: Rename control path scheduler from sch to scheduler
Legacy protocol engine already has a module name 'sch' rename
control path scheduler from sch to scheduler to avoid naming
conflict with protocol sch.

Change-Id: I94ce9aa5037aa75319aaad2287116462444c03f4
CRs-Fixed: 1105115
2016-12-27 16:37:34 -08:00