<div dir="ltr"><div><div>What is the concept of bust_spinlocks()<br></div>In do_kernel_fault() function of ARM 64, we can see the following code<br><br><a href="https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/mm/fault.c?id=refs/tags/v3.19#n85">https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/mm/fault.c?id=refs/tags/v3.19#n85</a><br><pre><code><span class="">static void</span> <span class="">__do_kernel_fault</span><span class="">(</span><span class="">struct</span> mm_struct <span class="">*</span>mm<span class="">,</span> <span class="">unsigned long</span> addr<span class="">,</span>
                         <span class="">unsigned int</span> esr<span class="">,</span> <span class="">struct</span> pt_regs <span class="">*</span>regs<span class="">)</span>
<span class="">{</span>
        <span class="">/*</span>
<span class="">         * Are we prepared to handle this kernel fault?</span>
<span class="">         */</span>
        <span class="">if</span> <span class="">(</span><span class="">fixup_exception</span><span class="">(</span>regs<span class="">))</span>
                <span class="">return</span><span class="">;</span>
        <span class="">/*</span>
<span class="">         * No handler, we'll have to terminate things with extreme prejudice.</span>
<span class="">         */</span>
<b>        <span class="">bust_spinlocks</span><span class="">(</span><span class="">1</span><span class="">);</span></b>
        <span class="">pr_alert</span><span class="">(</span><span class="">"Unable to handle kernel %s at virtual address %08lx</span><span class="">\n</span><span class="">"</span><span class="">,</span>
                 <span class="">(</span>addr <span class=""><</span> PAGE_SIZE<span class="">)</span> ? <span class="">"NULL pointer dereference"</span> <span class="">:</span>
                 <span class="">"paging request"</span><span class="">,</span> addr<span class="">);</span>
        <span class="">show_pte</span><span class="">(</span>mm<span class="">,</span> addr<span class="">);</span>
        <span class="">die</span><span class="">(</span><span class="">"Oops"</span><span class="">,</span> regs<span class="">,</span> esr<span class="">);</span>
        <span class="">bust_spinlocks</span><span class="">(</span><span class="">0</span><span class="">);</span>
        <span class="">do_exit</span><span class="">(</span>SIGKILL<span class="">);</span>
<span class="">}</span></code></pre><br></div>I have looked into its definition. It is as follows:<br><pre><code>
<span class="">void</span> <span class="">__attribute__</span><span class="">((</span>weak<span class="">))</span> <span class="">bust_spinlocks</span><span class="">(</span><span class="">int</span> yes<span class="">)</span>
<span class="">{</span>
        <span class="">if</span> <span class="">(</span>yes<span class="">) {</span>
                <span class="">++</span>oops_in_progress<span class="">;</span>
        <span class="">}</span> <span class="">else</span> <span class="">{</span>
<span class="">#ifdef CONFIG_VT</span>
                <span class="">unblank_screen</span><span class="">();</span>
<span class="">#endif</span>
                <span class="">console_unblank</span><span class="">();</span>
                <span class="">if</span> <span class="">(--</span>oops_in_progress <span class="">==</span> <span class="">0</span><span class="">)</span>
                        <span class="">wake_up_klogd</span><span class="">();</span>
        <span class="">}</span>
<span class="">}<br><br></span></code></pre><pre><code><span class="">So basically when i am saying </span></code><code><span class="">bust_spinlocks</span><span class="">(1), it is just incrementing the oops)_in_progress variable. How is it serving the purposr of a lock here?<br><br></span></code></pre><pre><code><span class="">Best Regards,<br></span></code></pre><pre><code><span class="">Manty<br></span></code></pre><br><br></div>