• Paolo Bonzini's avatar
    KVM: VMX: avoid double list add with VT-d posted interrupts · 8b306e2f
    Paolo Bonzini authored
    In some cases, for example involving hot-unplug of assigned
    devices, pi_post_block can forget to remove the vCPU from the
    blocked_vcpu_list.  When this happens, the next call to
    pi_pre_block corrupts the list.
    
    Fix this in two ways.  First, check vcpu->pre_pcpu in pi_pre_block
    and WARN instead of adding the element twice in the list.  Second,
    always do the list removal in pi_post_block if vcpu->pre_pcpu is
    set (not -1).
    
    The new code keeps interrupts disabled for the whole duration of
    pi_pre_block/pi_post_block.  This is not strictly necessary, but
    easier to follow.  For the same reason, PI.ON is checked only
    after the cmpxchg, and to handle it we just call the post-block
    code.  This removes duplication of the list removal code.
    
    Cc: Huangweidong <weidong.huang@huawei.com>
    Cc: Gonglei <arei.gonglei@huawei.com>
    Cc: wangxin <wangxinxin.wang@huawei.com>
    Cc: Radim Krčmář <rkrcmar@redhat.com>
    Tested-by: default avatarLongpeng (Mike) <longpeng2@huawei.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    8b306e2f
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...