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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 88BB8C33CAA for ; Thu, 23 Jan 2020 23:02:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C377218AC for ; Thu, 23 Jan 2020 23:02:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729692AbgAWXCC (ORCPT ); Thu, 23 Jan 2020 18:02:02 -0500 Received: from mga18.intel.com ([134.134.136.126]:46816 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729154AbgAWXCC (ORCPT ); Thu, 23 Jan 2020 18:02:02 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jan 2020 15:01:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,355,1574150400"; d="scan'208";a="276175592" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by FMSMGA003.fm.intel.com with ESMTP; 23 Jan 2020 15:01:25 -0800 Date: Thu, 23 Jan 2020 15:01:25 -0800 From: Sean Christopherson To: Jim Mattson Cc: Paolo Bonzini , Vitaly Kuznetsov , linmiaohe , kvm list , LKML , the arch/x86 maintainers , Radim =?utf-8?B?S3LEjW3DocWZ?= , Wanpeng Li , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" Subject: Re: [PATCH] KVM: nVMX: set rflags to specify success in handle_invvpid() default case Message-ID: <20200123230125.GA24211@linux.intel.com> References: <1579749241-712-1-git-send-email-linmiaohe@huawei.com> <8736c6sga7.fsf@vitty.brq.redhat.com> <1a083ac8-3b01-fd2d-d867-2b3956cdef6d@redhat.com> <87wo9iqzfa.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 23, 2020 at 10:22:24AM -0800, Jim Mattson wrote: > On Thu, Jan 23, 2020 at 1:54 AM Paolo Bonzini wrote: > > > > On 23/01/20 10:45, Vitaly Kuznetsov wrote: > > >>> SDM says that "If an > > >>> unsupported INVVPID type is specified, the instruction fails." and this > > >>> is similar to INVEPT and I decided to check what handle_invept() > > >>> does. Well, it does BUG_ON(). > > >>> > > >>> Are we doing the right thing in any of these cases? > > >> > > >> Yes, both INVEPT and INVVPID catch this earlier. > > >> > > >> So I'm leaning towards not applying Miaohe's patch. > > > > > > Well, we may at least want to converge on BUG_ON() for both > > > handle_invvpid()/handle_invept(), there's no need for them to differ. > > > > WARN_ON_ONCE + nested_vmx_failValid would probably be better, if we > > really want to change this. > > > > Paolo > > In both cases, something is seriously wrong. The only plausible > explanations are compiler error or hardware failure. It would be nice > to handle *all* such failures with a KVM_INTERNAL_ERROR exit to > userspace. (I'm also thinking of situations like getting a VM-exit for > INIT.) Ya. Vitaly and I had a similar discussion[*]. The idea we tossed around was to also mark the VM as having encountered a KVM/hardware bug so that the VM is effectively dead. That would also allow gracefully handling bugs that are detected deep in the stack, i.e. can't simply return 0 to get out to userspace. [*] https://lkml.kernel.org/r/20190930153358.GD14693@linux.intel.com