From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3D48C32751 for ; Thu, 1 Aug 2019 00:17:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A96EB206A2 for ; Thu, 1 Aug 2019 00:17:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JCFsLphC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729138AbfHAARc (ORCPT ); Wed, 31 Jul 2019 20:17:32 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:38909 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbfHAARb (ORCPT ); Wed, 31 Jul 2019 20:17:31 -0400 Received: by mail-io1-f66.google.com with SMTP id j6so20571880ioa.5 for ; Wed, 31 Jul 2019 17:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5OGNJ2zIkCd2eyV8mt8HLf/hU6G3Prg746o+XeDun8g=; b=JCFsLphCWpry/6Z2MYbxZsoelgfg0dW6fPui5qNa86PZh7AC//uOmL1tF5DM0fWcws uVCWw7Gg5nO4WE12kTufLugnDNzFoToiSR5Kt7yBOVeK2bA5ME/qMOv+jcsbSex/54dE 7H/wS8SOiUp9UGXC98OBEZDAmbeqjQep+T0MWjoGujTGJOOL9c/eMnJECmN+Ytt6gxyJ wgP4f8kweiH1k8wEvp4jF/KNc2Jh298x0TlgadHwnAap/nzwvIfBrHnAeKE2vPZFXHrB X/JIYcd6D4xrL9N14F89a13JYqFnzkne9eCIkAQR+T5HjRl9whFTOY1AQgXm1Y5HZ/DD OJEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5OGNJ2zIkCd2eyV8mt8HLf/hU6G3Prg746o+XeDun8g=; b=hmnzXNecVKnA68+0MldtDLbHHx59utAV8O5NpJH0HM+kx0H66JL3fUdMJSpjl/eaKn 7H9L1f9Q1rcLSd+/tOOzLEj7dSVQq+zp2jJ0sdppAV0hZRDNtLu/yLvE4FKelOkhqTDQ MGPQhwkb44JDZQHcPHsVzTt5hfxMzx5fZs/BahZQbEkMxofqyWFshRGFf0NyhqkVpY2u b7gDfq6mVHUHtWAEnXeFAQzg/jbjVQaf5WrpBDRXUb16meWD46/D9S+LwHa1BrXa3kaA 5d2BBaTxmJOcrtNuNHeTzDEPoZ+3exh2U08btOFpUhpBrq1DkY4en2LTu/8ddvkvKe8o 0U2Q== X-Gm-Message-State: APjAAAXlZmp1FiCHVRdNPrNsq0+KlvB7uww/VzYIZ8N46QDEwlZN2Un1 a3PfQO6qNszlj/vKuOsasVGWrljaZnvOynxehra2Zw== X-Google-Smtp-Source: APXvYqyFFqBV4DEKqLfGZ756X6zAkYSLEDdAzTvUc0fwEV47BgUGQsmryHFzasj08Mxw4FPOOGKkCfE0xT8+JctkT14= X-Received: by 2002:a6b:f906:: with SMTP id j6mr32237818iog.26.1564618650462; Wed, 31 Jul 2019 17:17:30 -0700 (PDT) MIME-Version: 1.0 References: <20190620110240.25799-1-vkuznets@redhat.com> <20190620110240.25799-4-vkuznets@redhat.com> <87ftmm71p3.fsf@vitty.brq.redhat.com> <36a9f411-f90c-3ffa-9ee3-6ebee13a763f@redhat.com> <20190731233731.GA2845@linux.intel.com> <20190731235637.GB2845@linux.intel.com> <46f3cf18-f167-f66e-18b4-b66c8551dcd8@redhat.com> In-Reply-To: <46f3cf18-f167-f66e-18b4-b66c8551dcd8@redhat.com> From: Jim Mattson Date: Wed, 31 Jul 2019 17:17:18 -0700 Message-ID: Subject: Re: [PATCH RFC 3/5] x86: KVM: svm: clear interrupt shadow on all paths in skip_emulated_instruction() To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , kvm list , LKML , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Joerg Roedel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 31, 2019 at 5:13 PM Paolo Bonzini wrote: > > On 01/08/19 01:56, Sean Christopherson wrote: > > On Wed, Jul 31, 2019 at 04:45:21PM -0700, Jim Mattson wrote: > >> On Wed, Jul 31, 2019 at 4:37 PM Sean Christopherson > >> wrote: > >> > >>> At a glance, the full emulator models behavior correctly, e.g. see > >>> toggle_interruptibility() and setters of ctxt->interruptibility. > >>> > >>> I'm pretty sure that leaves the EPT misconfig MMIO and APIC access EOI > >>> fast paths as the only (VMX) path that would incorrectly handle a > >>> MOV/POP SS. Reading the guest's instruction stream to detect MOV/POP SS > >>> would defeat the whole "fast path" thing, not to mention both paths aren't > >>> exactly architecturally compliant in the first place. > >> > >> The proposed patch clears the interrupt shadow in the VMCB on all > >> paths through svm's skip_emulated_instruction. If this happens at the > >> tail end of emulation, it doesn't matter if the full emulator does the > >> right thing. > > > > Unless I'm missing something, skip_emulated_instruction() isn't called in > > the emulation case, x86_emulate_instruction() updates %rip directly, e.g.: > > Indeed. skip_emulated_instruction() is only used when the vmexit code > takes care of emulation directly. Mea culpa. I had incorrectly assumed that "skip_emulated_instruction" was used when an instruction was emulated. I retract my objection. Having now been twice bitten by misleading function names, I'll be more careful in the future.