Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp525506imw; Thu, 14 Jul 2022 06:05:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1szNQWvwWtb91DAleSluy1PFDDn/pWxKofURNiZvPh76wYaaj3sZsdiAf9Cq5SkRKEB+ub7 X-Received: by 2002:aa7:d5d7:0:b0:43a:6eda:464a with SMTP id d23-20020aa7d5d7000000b0043a6eda464amr12225932eds.193.1657803925380; Thu, 14 Jul 2022 06:05:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657803925; cv=none; d=google.com; s=arc-20160816; b=g+cf9uSB5u1sFSmIPqxAnlr21GFb+8snDWVGxNE3IhambNlQatPpjz6+8hsRHNrak2 /qWgikI1mjO4+LBECfyzMBQkpV+IS2hDJdojvhuIfO9ADlR0Ujgk4EGfWEgL1DrKe1Rz QNKLCzo2dUxHHJ7bUiivX8YiMXoCaIXOnt4AC6GWQc5QiFRcwWXrVQa26cZ/RTNRMjHz M6wKaB/swcKMdGN9fr1CNuQrcM59hjASJxBs/4wQv31cXapFvby9nA+1jJyAy7QoFkJ+ LWtPHJuqHl/pEFTUz3K2F+wZOzqBJgul074yn0IeKgEpgeNI/392dBdRtRU7+spsDopu o7lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=D+G2aBYdpaVHU1+GCJKc9Xlzh4Vv7A/JYiBlhqiWbx4=; b=BFmfVfWMZ4B1x7x7Wou36hldW8MlVDE8rrYp2TaSP0wn8QodOaxuhf6Iwotp0Ips8a dpzBfXAxxij89fbl95aIUN/RfMsJ07NA1dR97xCK2dXPV2m4pTrx2qHiAxXxnYSh71CY OJnh24rW4hCslp20MkDfSuliRlU7wzlGsoecx3mWyP6FkUQCy3Ao30PUnBmXPAiIJdOJ ZENHrMrNjxAe2BtN7g2hAV6nXeVTMBK5rRYUeQGQ8Wg6sULoylE1AAuY1l4Ta9Sq8LBU nusGtjqW1uSjiEYaCamckvv32RN9i+Gb0CNaLjyhz5DYRZ6DFe1rw9j8jsgjREPYK3Bu 3FLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RSIjoNw+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb15-20020a170907960f00b0072ab9f5ae72si1778349ejc.553.2022.07.14.06.04.59; Thu, 14 Jul 2022 06:05:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RSIjoNw+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239531AbiGNMrH (ORCPT + 99 others); Thu, 14 Jul 2022 08:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239650AbiGNMqr (ORCPT ); Thu, 14 Jul 2022 08:46:47 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 00A6B60518 for ; Thu, 14 Jul 2022 05:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657802702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=D+G2aBYdpaVHU1+GCJKc9Xlzh4Vv7A/JYiBlhqiWbx4=; b=RSIjoNw+uJ5MxQ9boDbSGJNSpwBQmXs1FbH5G+ITh/HbQjN1vIZzCsUOl7t7T7JoUXNXbQ fOogP9JCQfcrkosjj7b6mmPuPc1QKw+y10bmi7dT3RU9EZ4kYbF3ARvO8IqGkHqbPU0hcd ggjJqDjS/bjg6ihZ++Sk9a2noV7aMbI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-241-NhUgbxy5NuisEU3v6EPlOg-1; Thu, 14 Jul 2022 08:44:59 -0400 X-MC-Unique: NhUgbxy5NuisEU3v6EPlOg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B5ED395AFE7; Thu, 14 Jul 2022 12:44:58 +0000 (UTC) Received: from amdlaptop.tlv.redhat.com (dhcp-4-238.tlv.redhat.com [10.35.4.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F1E8401473; Thu, 14 Jul 2022 12:44:54 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Sean Christopherson , Joerg Roedel , Ingo Molnar , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org, Jim Mattson , "Maciej S. Szmigiero" , Maxim Levitsky Subject: [PATCH] KVM: SVM: fix task switch emulation on INTn instruction. Date: Thu, 14 Jul 2022 15:44:53 +0300 Message-Id: <20220714124453.188655-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Recently KVM's SVM code switched to re-injecting software interrupt events, if something prevented their delivery. Task switch due to task gate in the IDT, however is an exception to this rule, because in this case, INTn instruction causes a task switch intercept and its emulation completes the INTn emulation as well. Add a missing case to task_switch_interception for that. This fixes 32 bit kvm unit test taskswitch2. Fixes: 7e5b5ef8dca322 ("KVM: SVM: Re-inject INTn instead of retrying the insn on "failure"") Signed-off-by: Maxim Levitsky --- arch/x86/kvm/svm/svm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 41bd7c5aa06a1e..638dd94f6e11f6 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -2399,6 +2399,7 @@ static int task_switch_interception(struct kvm_vcpu *vcpu) kvm_clear_exception_queue(vcpu); break; case SVM_EXITINTINFO_TYPE_INTR: + case SVM_EXITINTINFO_TYPE_SOFT: kvm_clear_interrupt_queue(vcpu); break; default: -- 2.34.3