[asterisk-bugs] [DAHDI-linux 0017724]: [patch] Race condition in handling writes to proslic LINEFEED register

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Jul 29 05:18:43 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17724 
====================================================================== 
Reported By:                alecdavis
Assigned To:                
====================================================================== 
Project:                    DAHDI-linux
Issue ID:                   17724
Category:                   wctdm24xxp
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
JIRA:                       DAHDI-677 
Reviewboard Link:            
====================================================================== 
Date Submitted:             2010-07-27 06:32 CDT
Last Modified:              2010-07-29 05:18 CDT
====================================================================== 
Summary:                    [patch] Race condition in handling writes to proslic
LINEFEED register
Description: 
set_lasttxhook_interruptible times out waiting for SLIC_LF_OPPENDING on 
fxs->lasttxhook to go.

Even changing the timeout in set_lasttxhook_interruptible to 2 Seconds,
the bottom half of <b>if (SLIC_LF_OPPENDING & fxs->lasttxhook)  {</b>
randomly get executed.




======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0017318 [patch] FXS Polarity Reversal on Hangup...
====================================================================== 

---------------------------------------------------------------------- 
 (0125239) alecdavis (manager) - 2010-07-29 05:18
 https://issues.asterisk.org/view.php?id=17724#c125239 
---------------------------------------------------------------------- 
uploaded wctdm24xxp_fxs_answer.diff3.txt
Self contained patch against DAHDI trunk, ignore previous patches, they
are all included.

wctdm_proslic_recheck_sanity is executed (4 times??) every ~256ms which
monitors and clears the SLIC_LF_OPPENDING on fxs->lasttxhook when the LF
state has been reached.
  
set_lasttxhook_interruptible times out after 100ms waiting fro the
previous write to the SLIC_LF register.

The monitoring and clearing of SLIC_LF_OPPENDING needs to be more
frequently than 256ms, like every 1ms.

This patch adds wctdm_proslic_check_oppending which does the monitoring
and clearing of SLIC_LF_OPPENDING, which is execute every 1ms. It also if
the correct state is not reached within 100ms, resends the lasttxhook
state.

Testing:
Now with a TDM800P, I never get a retry as I was with diff2 patch, and
with the additional debug, printing the intcount, can see that the correct
LF state is reached within a few ms.

debug output:<pre>Jul 29 21:57:28 asterix kernel: [101821.243193]
wctdm24xxp 0000:05:04.0: Setting FXS hook state to 1 (02) intcount=90596
Jul 29 21:57:28 asterix kernel: [101821.252498] wctdm24xxp 0000:05:04.0:
SLIC_LF OK: card=3 shadow=42 lasttxhook=02 intcount=90602
Jul 29 21:57:30 asterix kernel: [101823.408182] wctdm24xxp 0000:05:04.0:
Setting FXS hook state to 2 (04) intcount=92596
Jul 29 21:57:30 asterix kernel: [101823.417951] wctdm24xxp 0000:05:04.0:
SLIC_LF OK: card=3 shadow=24 lasttxhook=04 intcount=92602
Jul 29 21:57:31 asterix kernel: [101823.809558] wctdm24xxp 0000:05:04.0:
Setting FXS hook state to 1 (02) intcount=92996
Jul 29 21:57:31 asterix kernel: [101823.817951] wctdm24xxp 0000:05:04.0:
SLIC_LF OK: card=3 shadow=42 lasttxhook=02 intcount=93002
Jul 29 21:57:31 asterix kernel: [101824.010533] wctdm24xxp 0000:05:04.0:
Setting FXS hook state to 2 (04) intcount=93196
Jul 29 21:57:31 asterix kernel: [101824.026535] wctdm24xxp 0000:05:04.0:
SLIC_LF OK: card=3 shadow=14 lasttxhook=04 intcount=93202
Jul 29 21:57:31 asterix kernel: [101824.030194] wctdm24xxp 0000:05:04.0:
wctdm: Card 3 Going off hook
Jul 29 21:57:31 asterix kernel: [101824.031335] wctdm24xxp 0000:05:04.0:
Setting FXS hook state to 1 (02) intcount=93207
Jul 29 21:57:31 asterix kernel: [101824.031335] wctdm24xxp 0000:05:04.0:
Channel 3 OnHookTransfer abort
Jul 29 21:57:31 asterix kernel: [101824.039336] wctdm24xxp 0000:05:04.0:
SLIC_LF OK: card=3 shadow=42 lasttxhook=02 intcount=93214
Jul 29 21:57:31 asterix kernel: [101824.044172] wctdm24xxp 0000:05:04.0:
wctdm: Card 3 Going on hook
Jul 29 21:57:31 asterix kernel: [101824.048170] wctdm24xxp 0000:05:04.0:
Channel 3 Set Reverse Polarity
Jul 29 21:57:31 asterix kernel: [101824.052172] wctdm24xxp 0000:05:04.0:
SLIC_LF OK: card=3 shadow=66 lasttxhook=06 intcount=93226
Jul 29 21:57:31 asterix kernel: [101824.196034] wctdm24xxp 0000:05:04.0:
wctdm: Card 3 Going off hook
Jul 29 21:58:06 asterix kernel: [101864.205656] wctdm24xxp 0000:05:04.0:
wctdm: Card 3 Going on hook
Jul 29 21:58:07 asterix kernel: [101865.481320] wctdm24xxp 0000:05:04.0:
Channel 3 Set Normal Polarity
Jul 29 21:58:07 asterix kernel: [101865.485320] wctdm24xxp 0000:05:04.0:
Setting FXS hook state to 0 (01) intcount=129293
Jul 29 21:58:07 asterix kernel: [101865.493326] wctdm24xxp 0000:05:04.0:
SLIC_LF OK: card=3 shadow=11 lasttxhook=01 intcount=129298
Jul 29 21:58:11 asterix kernel: [101871.233452] wctdm24xxp 0000:05:04.0:
Setting VMWI on channel 3, messages=0, lrev=0
Jul 29 21:58:11 asterix kernel: [101871.233452] wctdm24xxp 0000:05:04.0:
SLIC_LF OK: card=3 shadow=11 lasttxhook=01 intcount=133309
Jul 29 21:58:11 asterix kernel: [101871.551413] wctdm24xxp 0000:05:04.0:
Channel 3 OnHookTransfer start
Jul 29 21:58:11 asterix kernel: [101871.559973] wctdm24xxp 0000:05:04.0:
SLIC_LF OK: card=3 shadow=22 lasttxhook=02 intcount=133322
Jul 29 21:58:14 asterix kernel: [101874.666063] wctdm24xxp 0000:05:04.0:
Channel 3 OnHookTransfer stop
Jul 29 21:58:14 asterix kernel: [101874.692390] wctdm24xxp 0000:05:04.0:
SLIC_LF OK: card=3 shadow=11 lasttxhook=01 intcount=136314</pre> 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-07-29 05:18 alecdavis      Note Added: 0125239                          
======================================================================




More information about the asterisk-bugs mailing list