overview of bust_spinlocks

manty kuma mantykuma at gmail.com
Fri Feb 20 04:38:20 EST 2015


What is the concept of bust_spinlocks()
In do_kernel_fault() function of ARM 64, we can see the following code

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/mm/fault.c?id=refs/tags/v3.19#n85

static void __do_kernel_fault(struct mm_struct *mm, unsigned long addr,
			      unsigned int esr, struct pt_regs *regs){
	/*	 * Are we prepared to handle this kernel fault?	 */
	if (fixup_exception(regs))
		return;

	/*	 * No handler, we'll have to terminate things with extreme
prejudice.	 */*	bust_spinlocks(1);*
	pr_alert("Unable to handle kernel %s at virtual address %08lx\n",
		 (addr < PAGE_SIZE) ? "NULL pointer dereference" :
		 "paging request", addr);

	show_pte(mm, addr);
	die("Oops", regs, esr);
	bust_spinlocks(0);
	do_exit(SIGKILL);}


I have looked into its definition. It is as follows:

void __attribute__((weak)) bust_spinlocks(int yes){
	if (yes) {
		++oops_in_progress;
	} else {#ifdef CONFIG_VT
		unblank_screen();#endif
		console_unblank();
		if (--oops_in_progress == 0)
			wake_up_klogd();
	}}

So basically when i am saying bust_spinlocks(1), it is just
incrementing the oops)_in_progress variable. How is it serving the
purposr of a lock here?

Best Regards,

Manty
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150220/0f4cbf89/attachment.html 


More information about the Kernelnewbies mailing list