Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3466824pxb; Mon, 4 Apr 2022 17:54:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3IttwemNL4XJt9d63LtykMWjnZkb4eRBPvFTzUgJ2ohCYDhxYwuv0ok1dckuArYYbz4X0 X-Received: by 2002:a17:90a:734a:b0:1ca:8240:9e48 with SMTP id j10-20020a17090a734a00b001ca82409e48mr1046535pjs.174.1649120050138; Mon, 04 Apr 2022 17:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649120050; cv=none; d=google.com; s=arc-20160816; b=eVhryntg2Tljow3qQ+duAD1JU4zWqDkiRgQ8qp87M57CKzwoeuuF53ZC+hxS633Bnx Jb67lEaEzp6cQy35+1F094fxqivHlo4sb4z1GyCbbe55GrFv2JwB9yLIQXCfmWDm56XG RdDr1PAXeqIcybPGYzBPGgdJzES8erdcj33EYvyhS7O/ijRpjwiU5VzC3GPAczqN5wmn e9VfGcXgLRwArvehgQvGtMuJHJScOSR4bCaSWJ5DdZIisGdUwyVYlDStkFiv0WgaLv3N p4TZnj91sINZIKlEIV5em5NlC5xsR6q0+2BeRn4qDMjRQ4DGyf7SrSfELkQSrNlsiXuC fs2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kB7kulErLH1kl+/AkfN+Aryh9y9jz6Qw47u7OIjWlmM=; b=0reCpPusHRkCV8phfd0TQ+g+8i/1q/pmMET+0ARsDCrQjXlrlMVkRto2ySAEKx2WMQ guboQzMI4p7/IVriwgtsdNv3uWXE19jmjni+H0RAnf0DeQKdqj7GKhAcIzL1kt4JO7Nc XAyxQsfpNu8IVvkIYDk50NfNy0r+P4m0w1v28OTYmX6U7fQmX1p2Tc4MSMsZ49x6eDRm gFdJ1d6D5zcSy1LK1CAuCSJHjV384gZzNnzZ7FjrE8vZueqF0ayqmQmk41GKmKuwqJMQ k6ZNobAf/VyhkKC0UsJCzBUx7UzuW9v5BTzn4RVucrm5L6koLpJfQOgbZ+BuPXwUSD75 +ZHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=T8vdp5Vd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c7-20020a056a000ac700b004fb36904b3esi12460824pfl.9.2022.04.04.17.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:54:10 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=T8vdp5Vd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6F9DC118635; Mon, 4 Apr 2022 17:02:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380583AbiDDVsl (ORCPT + 99 others); Mon, 4 Apr 2022 17:48:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380339AbiDDTfs (ORCPT ); Mon, 4 Apr 2022 15:35:48 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B9A763FF for ; Mon, 4 Apr 2022 12:33:50 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id c23so9031894plo.0 for ; Mon, 04 Apr 2022 12:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kB7kulErLH1kl+/AkfN+Aryh9y9jz6Qw47u7OIjWlmM=; b=T8vdp5Vd2LrsNPs6YvCZuqgogEONB0T2IO+VEUWJ5yMRSwDYr2kk/GwmMrzzCucSes q82jwU9p39/ooLngHkw4d+W43XpFKkGy96Hcx7DwKvdeowr0P5edl3Kgaep0e8G7CWYb CKOvtOPXCZrbiLi/l5lwqLW3NZLzfl2HLXZZfa1ptnEWSs/Bv0w9PqXVw5xCh0GOoZce ZWHzLFMb2mak0znwGeqe+emmfKTPk7lf7qXOTaTUZRRqfz7b13htM5P0HRUWfu1j4sC/ 8QCGQSmdY5ivg+WrU5Q9LuCPBcLlcZC5hMOkVd4osPzd3V06zpXl6JGW6mIJanhMmdnT jD3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kB7kulErLH1kl+/AkfN+Aryh9y9jz6Qw47u7OIjWlmM=; b=YRjykHHfFDKVxr4e9yNve6wVluBTUgHVc7B831NU00Uj9btBP6NHDFUaHICOAg9dZm jRI1gvanSLn4HphCdxgXfmnzksEC0OBFy+UP143sYsTEtyIUYesJ3Sp0cyMjv8NmpVpE 5lLOKMLRkFfz7C77+hm0KK+zo3SN6Jye8oQGiSTAoJtoHlKKEiUyCVhZxLkcGX62Fyix MoZA9gcEezFOD6a3+5LJftn6N6L2VANZt9/Rs2XKrpqqhPKKg/5O+8zPzjbMD9/L49HR QH+VeSCAOi9imFAfFGB8WGyUmUxUEIsOqe/RwhC/8DDfW/ol7/lUgsz+bKQUOdPnzLiU vhWA== X-Gm-Message-State: AOAM530QtUv2qpUrdTSHujdXienMg+Mtt8SM8WRNrf1nLy+ps2ViecM9 nrxuAbPxeNkIOqo4tgiZtFJGFQ== X-Received: by 2002:a17:902:b613:b0:156:7d82:c09b with SMTP id b19-20020a170902b61300b001567d82c09bmr1229152pls.80.1649100829838; Mon, 04 Apr 2022 12:33:49 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id 77-20020a621450000000b004fa923bb57asm12500493pfu.201.2022.04.04.12.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 12:33:49 -0700 (PDT) Date: Mon, 4 Apr 2022 19:33:44 +0000 From: Sean Christopherson To: "Maciej S. Szmigiero" Cc: Maxim Levitsky , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/8] KVM: SVM: Re-inject INT3/INTO instead of retrying the instruction Message-ID: References: <20220402010903.727604-1-seanjc@google.com> <20220402010903.727604-6-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Mon, Apr 04, 2022, Maciej S. Szmigiero wrote: > > > > 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. I'll do some debug to figure out why the test passes for me. I'm guessing I either got lucky, e.g. IDT was faulted in already, or I screwed up and the test doesn't actually pass.