From: jason <huz...@gm...> - 2011-03-24 14:54:01
|
Hi All, When I studying tipc-1.7.6 code. I see a potaintial issue that when a user thread which calls send_msg() and is scheduled out because port congestion, it may not be wake up any more by tipc_recv_msg(). Let's see send_msg related pseudo code: 01 add self to link.sleep_queue 02 if port.congest == 1 { 03 schedule(); 04 } and see tipc_recv_msg related code: 01 if link.sleep_queue empty { 02 port.congest = 0; 03 wakeup; 04 } Say we are SMP. Right after CPU0 runs at tipc_recv_msg related code line 01 and see link.sleep_queue IS empty, CPU1 execute send_msg related code from line 01 to 04. In this conditon, send_msg will be schedule out by CPU1 and CPU0 loss the opptunity to wake it up. If there is no incoming message any more, then send_msg thread will not be waken any more. If my analysis is right, I think one way to solve whis issue is to swap tipc_recv_msg related code line 01 and 02, and smp_wmb should also be placed between them. But real code change is not as easy as a code line swapping. Thanks! -- Yours, jason |