Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp602948imw; Thu, 14 Jul 2022 07:28:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vKkPdRqjZG86eYD5561bqpK5NU9R6KDdx9ea7VyfBrCth5ns9V9fH5TQlyC2gChtqWF3ca X-Received: by 2002:a17:906:6d98:b0:715:76eb:9e33 with SMTP id h24-20020a1709066d9800b0071576eb9e33mr9315406ejt.729.1657808903114; Thu, 14 Jul 2022 07:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657808903; cv=none; d=google.com; s=arc-20160816; b=KB0fDQUi8Q2g27+FB/Ge0hApKI204tb8p9xhxoO98TEqQj3aAuwaXvxWNQCoTkwoWF YvKcft8e8A0ZVBMhYshe35EttTzFYUuABayE0F4XWi1AP58EG2r/fiLE1P366QobM/MY p3v+3sMShsW9/GGHzQZMEsPEYElo6eE64me0SClBk+ENdtsrpRXXdvlrRNR3KuWWONWU E5ZSi0LGFZdbIfOBO5+wbvdViqLPGcQgI6eNtqnhnVReDiq3wMVkCd4IO59JLyXlzYhw 3Mm1KueE3jrsEDabUa/3OgO/luowlFzRnDggFMjiV1KSY4M2Xxa4TC0P3xbvGjDz0MZ3 bamg== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=KsB/k7XGvHWoQ6egQzGPsZym+TsC+6TwIfhUT/WwqdM=; b=O+K0dnfzzHlzsUKPsjDJ3XUo4MVPz17HLWYJpPcK3kqMoHQzfmYHc8edTHC/+sIsC6 r5HLczwsFCz6KCa7RXWls6JRuvrgBVpVEFVuCg5xHg6pSiBIRTzOztkGYAjbna6amMAm z4uyVdvdUCZby2zDUnDsLHzYI/SWXfHylVQW7nzWP7u4Jb8He0hyjqyfLnq6ZUY4CTeT NoKg/r6XNL+EgEY8C5zq0pjXjKddqqzN3moQwo4fIPWNepQCnNPGk6tCPQMaOKkqXrfi DIBx3C9kyHQgjeKkvE4OrP3a1a4XNur8SJLbMVDF6DC22E1HbrqqcT3wVTc51pgwBPLc iuzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jUYitV73; 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 g18-20020a170906595200b007156bee9755si1737316ejr.917.2022.07.14.07.27.58; Thu, 14 Jul 2022 07:28:23 -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=jUYitV73; 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 S240158AbiGNOAN (ORCPT + 99 others); Thu, 14 Jul 2022 10:00:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240407AbiGNN6q (ORCPT ); Thu, 14 Jul 2022 09:58:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D2CEA1133 for ; Thu, 14 Jul 2022 06:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657807084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KsB/k7XGvHWoQ6egQzGPsZym+TsC+6TwIfhUT/WwqdM=; b=jUYitV73EP5Nn0VqulsvYOi8ruGNtvRlibhUXyrvCrixGd5YqHi3SU/rqTbhqwDuQaxCtd WGkktn1rUXhsG8kWXmez4EAYuC1L0QBeKC8oRQ1ScNAO1bhqytLpxLgkAk4paT1bWd4+bZ 8u46Ufj0wx2xTy918Lg6OsSHmLabgmA= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-570-2JgjBLVsNraEBAxg5j6ocA-1; Thu, 14 Jul 2022 09:58:03 -0400 X-MC-Unique: 2JgjBLVsNraEBAxg5j6ocA-1 Received: by mail-qk1-f200.google.com with SMTP id ay8-20020a05620a178800b006b57a178418so1198567qkb.12 for ; Thu, 14 Jul 2022 06:58:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=KsB/k7XGvHWoQ6egQzGPsZym+TsC+6TwIfhUT/WwqdM=; b=GhvzfXdWmRjJ4rsJqNs69ucMhaFtuZwvTjSIroqTV9ppTiPHzYAxWqzC1zS50QJ9NH WvTMYPE7aCbYheK+DMrOOJzWrojYp+ThGJQWMXshXcyO66w/OcMUVxzaOAGznp/ibAmQ kMQAQhwzQQl5RHOArtcnbfc4GSebGMQApcgPNh1kC4jj2CO5QJIHXbmspUhFJhvkYhjf iaFnUfZrAQjt96DiolgpxECXVPQQdCUN3QkjHE0UR+mbgYyv0aGoRO5+Iqz0S/8XBOFW T9yDpR+254CDgjkZhcFGMSEusp5Q8bBsvp0Z0OgHjPaIYinNNU3Vn4FvYJllEWRbLHMb jTvQ== X-Gm-Message-State: AJIora8kjs/5/OGR1ielKU9hhmkq0f1U6kGwPlHQhw9Sxdo1FleXWzIJ GrqI5YMFClKthAqb9iZgpECTDF/dSHgUNnZ+LV+rTTDmSwV9rK1n8LNkAXcZTrDI6jpB6ZL13ed t2oTnLnNyOXE9o6ccwbrhmHIX X-Received: by 2002:a05:6214:27cb:b0:473:5954:5951 with SMTP id ge11-20020a05621427cb00b0047359545951mr7919661qvb.2.1657807083227; Thu, 14 Jul 2022 06:58:03 -0700 (PDT) X-Received: by 2002:a05:6214:27cb:b0:473:5954:5951 with SMTP id ge11-20020a05621427cb00b0047359545951mr7919646qvb.2.1657807083040; Thu, 14 Jul 2022 06:58:03 -0700 (PDT) Received: from [10.35.4.238] (bzq-82-81-161-50.red.bezeqint.net. [82.81.161.50]) by smtp.gmail.com with ESMTPSA id cf12-20020a05622a400c00b0031ece0bc9f5sm290591qtb.45.2022.07.14.06.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 06:58:02 -0700 (PDT) Message-ID: <034401953bc935d997c143153938edb1034b52cd.camel@redhat.com> Subject: Re: [PATCH] KVM: SVM: fix task switch emulation on INTn instruction. From: Maxim Levitsky To: "Maciej S. Szmigiero" 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 , kvm@vger.kernel.org Date: Thu, 14 Jul 2022 16:57:56 +0300 In-Reply-To: <52d44630-21ad-1291-4185-40d5728eaea6@maciej.szmigiero.name> References: <20220714124453.188655-1-mlevitsk@redhat.com> <52d44630-21ad-1291-4185-40d5728eaea6@maciej.szmigiero.name> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-5.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Thu, 2022-07-14 at 15:50 +0200, Maciej S. Szmigiero wrote: > On 14.07.2022 14:44, Maxim Levitsky wrote: > > 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 > > --- > > That's a good catch, your patch looks totally sensible to me. > People running Win 3.x or OS/2 on top of KVM will surely be grateful for it :) Yes and also people who run 32 bit kvm unit tests :) BTW, I do have a win98 VM which I run once in a while under KVM. On Intel it works very well, on AMD, only works without NPT and without MMU pre-fetching, due to fact that the OS doesn't correctly invalidate TLB entries. I do need to test KVM with OS/2 on one of the weekends.... ;-) Thanks for the review, Best regards, Maxim Levitsky > > Reviewed-by: Maciej S. Szmigiero > > Thanks, > Maciej >