Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751829AbdFFK5U (ORCPT ); Tue, 6 Jun 2017 06:57:20 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:33977 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbdFFK5S (ORCPT ); Tue, 6 Jun 2017 06:57:18 -0400 From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Longpeng , Huangweidong , Gonglei , wangxin , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PATCH CFT 0/4] VT-d PI fixes Date: Tue, 6 Jun 2017 12:57:03 +0200 Message-Id: <20170606105707.23207-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.13.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1447 Lines: 37 These should fix, or at least help, the kernel panic reported by Longpeng with VT-d posted interrupts. CONFIG_DEBUG_LIST reports a double add, meaning that pi_pre_block ran twice without pi_post_block deleting the vCPU from the blocked_on_vcpu list. The only possibility that I could think of is that this: if (!kvm_arch_has_assigned_device(vcpu->kvm) || !irq_remapping_cap(IRQ_POSTING_CAP) || !kvm_vcpu_apicv_active(vcpu)) return; was false in pi_post_block. In turn, I can only think of hot-unplug as the cause of this imbalance, but maybe there is another way to reach it just via repeated startup and shutdown. Gonglei reported problems with hot-unplug offlist too, so this is a start. In any case, patch 2 replaces it with a check on vcpu->pre_pcpu. A similar change is done in patch 3 to vmx_vcpu_pi_load. I don't have hardware easily accessible with VT-d PI, so these patches are compile-tested only. I apologize for any stupid mistakes. The first three patches are meant for stable versions too. Paolo Paolo Bonzini (4): KVM: VMX: extract __pi_post_block KVM: VMX: avoid double list add with VT-d posted interrupts KVM: VMX: simplify and fix vmx_vcpu_pi_load KVM: VMX: simplify cmpxchg of PI descriptor control field arch/x86/kvm/vmx.c | 228 ++++++++++++++++++++++++++--------------------------- 1 file changed, 110 insertions(+), 118 deletions(-) -- 2.13.0