• Juergen Gross's avatar
    xen/sched: fix latent races accessing vcpu->dirty_cpu · 99266e31
    Juergen Gross authored
    
    
    The dirty_cpu field of struct vcpu denotes which cpu still holds data
    of a vcpu. All accesses to this field should be atomic in case the
    vcpu could just be running, as it is accessed without any lock held
    in most cases. Especially sync_local_execstate() and context_switch()
    for the same vcpu running concurrently have a risk for failing.
    
    There are some instances where accesses are not atomically done, and
    even worse where multiple accesses are done when a single one would
    be mandated.
    
    Correct that in order to avoid potential problems.
    
    Add some assertions to verify dirty_cpu is handled properly.
    Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
    Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
    99266e31
sched.h 34 KB