Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3433576pxb; Mon, 4 Apr 2022 16:52:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB7EIQ+TLY5D1qIsp/5yZWfkBgnNoE6UDazfkogXfT/HQEEepnYxXJqsdBFUVozK44ijXY X-Received: by 2002:a63:9502:0:b0:386:3916:ca8e with SMTP id p2-20020a639502000000b003863916ca8emr516449pgd.357.1649116356093; Mon, 04 Apr 2022 16:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649116356; cv=none; d=google.com; s=arc-20160816; b=RoMVltRCeOuQkVgBVIuRj6ttPlm/wOcOoeLTmWILdd3E0w5x7qnTUap+k9F+/49qIl VRvH8sUiB2/K+0ZOarSeEMjq8OPntN2X/rKAg2Uh8ifBQq22gJb21cCufGtz1SOCAcIc 70kgB4SgIt5xU34YKAN0MDpriIfB0zFRez0aetIDKNF7TtTpF0x4p2ABM1ewlKfuQyLr RYn2GPc1mTWkHkH6vqaRLOFEkhiH0vLuQQ+k2n+sPxzeQzY+CmtbviNrKjSkQJf8mihK 6QHiHzFJ8/EiSx6oVIQLlZQkNPGzM1PBJyOeyVWpcI854wMHngo1YF5doTOJk4nfCiM1 yo4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=aRrYVFTCL5VGIce7bA8MMcjWLBM4bSeJfFBD3KJfkVA=; b=y1nvZp6UGOyXj897HpUBj5m2J0X8BKq4JdXimtJ+DQ44KsPoayK76hSB3LF4DOJZrs ZKw4G1j3pqOXDb5ERkhrXsWteZafTsC2KRClbzhyeYAbTeCfXqRrpP1db7pR+nzV25Wg RzoV8GTpIfHQwvudVI4n4eJn0TrqRQRo9mR2osmUss2ea51XeFeJm6qabvYyX5AsQm4r ILEiHoFwXBWF8/r6vLGJzL067wb+Xtn77rnnCD9U/aCg+6PUU0uroXbx9G7HQlxGw0Y7 BzcG3AqvHD+ta+0nigASuYqIxyFwAzPOLT1czxzQHZTJjuMB3Si2r5CrwVmIuWNdMrY3 mWPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t13-20020a63eb0d000000b003816043f127si11486348pgh.796.2022.04.04.16.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:52:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ECBDF5D66E; Mon, 4 Apr 2022 16:36:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382575AbiDDVbX (ORCPT + 99 others); Mon, 4 Apr 2022 17:31:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379295AbiDDQzb (ORCPT ); Mon, 4 Apr 2022 12:55:31 -0400 Received: from vps-vb.mhejs.net (vps-vb.mhejs.net [37.28.154.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2459214; Mon, 4 Apr 2022 09:53:33 -0700 (PDT) Received: from MUA by vps-vb.mhejs.net with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nbPxB-0002ta-TY; Mon, 04 Apr 2022 18:53:21 +0200 Message-ID: Date: Mon, 4 Apr 2022 18:53:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 5/8] KVM: SVM: Re-inject INT3/INTO instead of retrying the instruction Content-Language: en-US To: Sean Christopherson Cc: Maxim Levitsky , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220402010903.727604-1-seanjc@google.com> <20220402010903.727604-6-seanjc@google.com> From: "Maciej S. Szmigiero" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_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 >>> index 47e7427d0395..a770a1c7ddd2 100644 >>> --- a/arch/x86/kvm/svm/svm.h >>> +++ b/arch/x86/kvm/svm/svm.h >>> @@ -230,8 +230,8 @@ struct vcpu_svm { >>> bool nmi_singlestep; >>> u64 nmi_singlestep_guest_rflags; >>> >>> - unsigned int3_injected; >>> - unsigned long int3_rip; >>> + unsigned soft_int_injected; >>> + unsigned long soft_int_linear_rip; >>> >>> /* optional nested SVM features that are enabled for this guest */ >>> bool nrips_enabled : 1; >> >> >> I mostly agree with this patch, but think that it doesn't address the >> original issue that Maciej wanted to address: >> >> Suppose that there is *no* instruction in L2 code which caused the software >> exception, but rather L1 set arbitrary next_rip, and set EVENTINJ to software >> exception with some vector, and that injection got interrupted. >> >> I don't think that this code will support this. > > Argh, you're right. Maciej's selftest injects without an instruction, but it doesn't > configure the scenario where that injection fails due to an exception+VM-Exit that > isn't intercepted by L1 and is handled by L0. The event_inj test gets the coverage > for the latter, but always has a backing instruction. Still reviewing the whole patch set, but want to clear this point quickly: The selftest does have an implicit intervening NPF (handled by L0) while injecting the first L1 -> L2 event. Thanks, Maciej