On Sat, 6 Jul 2013, Preeti U Murthy wrote: > Hi Wang, > > On 07/06/2013 11:42 AM, Wang YanQing wrote: > > On Fri, Jul 05, 2013 at 09:57:11PM +0530, Preeti U Murthy wrote: > >> Elaborate on when deadlocks can occur when a call is made to > >> smp_call_function_single() and its friends. This avoids ambiguity about > >> when to use these calls. > >> > >> + * 2. wait = 0: This function could be called from an interrupt > >> + * context, and can get blocked on the csd_lock(csd) below in > >> + * "non wait cases". > >> + * This is because the percpu copy of csd of this_cpu is used > >> + * in non wait cases. Under such circumstances, if the previous caller > >> + * of this function who got preempted by this interrupt has already > >> taken > >> + * the lock under non wait condition, it will result in deadlock. > >> + * > > > > No, it will not cause deadlock, it is not mutex lock, it is busy wait, so > > when the CSD_FLAG_LOCK be cleared, the code will go on running. > > A deadlock might not result, but a potential long wait in an interrupt > context could result if the source cpu got preempted by an interrupt > between csd_lock(csd) and generic_exec_single(), where it actually > sends an ipi to the target cpu.
See https://lkml.org/lkml/2013/7/5/183 and the related thread for real deadlock scenarios. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/