Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp973512imm; Fri, 28 Sep 2018 09:44:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV60AAAxE1/taacHw7mb3ShqkZUx+hEGeBu+v26Le6bkJXKbwUuHz62zkrexS7gRI0tKuIi1w X-Received: by 2002:a17:902:722:: with SMTP id 31-v6mr17151929pli.207.1538153041135; Fri, 28 Sep 2018 09:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538153041; cv=none; d=google.com; s=arc-20160816; b=hwisvTpK9zO93RN7L4cy70DbL9kFMPtH0nzzZyxHpdHVuu+N4krtkFtA4Yo0qQ2G7y cdCC19m/9DXqdlB7ObxS5gsss0+a0yEoecJfe0Eque4hS1g9CaCY2h+BvDad8IChEaGW Dxasb6hxoCQ+Qsq+ujZogeW5hJtaHuGDSL+RWJU5H4bJ2SdYqZDrQaSBZYffdT60Fhty bNphhqB02ExxzGXqcDVRE7ntJIsZdvNr1EVXZowiBSJB37P7wS6U4PFBJig2jhLmac5a io4ABX+3Fg6ZvrG/fzpNildSuiWhr1r8TZ94Qq30E2I4fHmacLGzIK1Og3tWF4yUHeie xIJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=kY/a8lB8mYYxKvICrGfRdv17U+Ty88oAovcOi7cfkCo=; b=WuhFcqp7YMGdsPn8iWz9HmwNvDwEvqPLlU2AZdiGX7qYjERCECDy0xst3I+ZpxRJd/ U1bhm5ose9IusifxeRhc1AV56MvqK7lRUrGG3dTqlkqzPdbSz0NST3l7guTrmkl+OqKv tOswwz9E05AjVqXBXf7GOgxbWliJA5btr7lB0sHzkL2M8mZ9PJ3J2iXQ7fChpiAQQrBF qO495nypIxD8pNPZKVPl8IfIimlhtUQBHZvV7tmc4mBRuDzu24K/z3FHhBpTqD7aCwET KhQUoEP0ZSwUU49SKMAG/vQXg5t0z3Nh8rgG32Y0syWJMztmBzu+PgfWYc900FSKni1n 1ayw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5-v6si5138577pll.414.2018.09.28.09.43.46; Fri, 28 Sep 2018 09:44:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729483AbeI1XGm (ORCPT + 99 others); Fri, 28 Sep 2018 19:06:42 -0400 Received: from mail78-58.sinamail.sina.com.cn ([219.142.78.58]:60965 "HELO mail78-58.sinamail.sina.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726738AbeI1XGl (ORCPT ); Fri, 28 Sep 2018 19:06:41 -0400 X-Greylist: delayed 2274 seconds by postgrey-1.27 at vger.kernel.org; Fri, 28 Sep 2018 19:06:41 EDT Received: from unknown (HELO localhost.localdomain.localdomain)([110.184.35.163]) by sina.com with ESMTP id 5BAE59D300005D8A; Fri, 29 Sep 2018 00:42:04 +0800 (CST) X-Sender: penghao122@sina.com.cn X-Auth-ID: penghao122@sina.com.cn X-SMAIL-MID: 573004400706 From: Peng Hao To: pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, Peng Hao Subject: [PATCH] kvm/x86 : set meaningful return value Date: Fri, 28 Sep 2018 12:41:53 -0400 Message-Id: <1538152913-3036-1-git-send-email-penghao122@sina.com.cn> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Hao kvm_irq_delivery_to_apic_fast()--> kvm_apic_map_get_dest_lapic()--> kvm_apic_disabled_lapic_found() kvm_apic_map_get_dest_lapic return with bitmap==0 and dst[i]==NULL, then (*r == -1) will be returned to qemu and "KVM: injection failed, MSI lost(Operation not permitted)" will be recorded in qemu log. The output is puzzling. Signed-off-by: Peng Hao --- arch/x86/kvm/lapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index fbb0e6d..a8896b3 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -944,7 +944,7 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src, int i; bool ret; - *r = -1; + *r = -ENXIO; if (irq->shorthand == APIC_DEST_SELF) { *r = kvm_apic_set_irq(src->vcpu, irq, dest_map); -- 1.8.3.1