Hi,
     I see  cpu_public->cpu_suspended is protected by spinlock,  but I
see there is no concurrency problem for the cpu_public->cpu_suspended.
 check_events() is the only place to change cpu_public->cpu_suspended
variable, other CPU can not change is variable, also  check_events()
is
not preempted in the current CPU, because IRQ is masked in the current
CPU.  So there is no need to add spin_lock for
cpu_public->cpu_suspended variable.


static void check_events(struct public_per_cpu *cpu_public)
{
        bool reset = false;

        spin_lock(&cpu_public->control_lock);

        while (cpu_public->suspend_cpu) {
                cpu_public->cpu_suspended = true;

                spin_unlock(&cpu_public->control_lock);

                while (cpu_public->suspend_cpu)
                        cpu_relax();

                spin_lock(&cpu_public->control_lock);
        }

        cpu_public->cpu_suspended = false;
         ..............
        spin_unlock(&cpu_public->control_lock);
        ............
}

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/CABSBigRew4uS4Hg2QAvRgLJM3MvV60ff3E1wvsv%2BU52u-MYTbA%40mail.gmail.com.

Reply via email to