Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1168278ybl; Thu, 23 Jan 2020 15:04:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxdhI+5Ug2F7tP857QinqjpQoFMLZ5rwNevPJIcDFpe6WflZxE83ANe0CoXR9BsNLwrzGhM X-Received: by 2002:a05:6830:139a:: with SMTP id d26mr594365otq.75.1579820671483; Thu, 23 Jan 2020 15:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579820671; cv=none; d=google.com; s=arc-20160816; b=u/y+4BCyarGZ2o5Njr6raCIQylJBfpioCC5bcXZwXAeNNca3zJCScZk6+7RAitgjNK afFUlziCxkYHILx1RwtA/tlD0BroUS9u2MME9aElwEQFWQ9Ddq1Ef4o2tVECmBnyvwH6 sViTllhPebuFksL7rQf/HfZKrNyPDVTGn36jyG5uir1jfMEMAByAoIuxYJEcos/XS2ao 1Weatvtz7cgm2nWQYZbzQpU8280UFEjwNL3tj6fnJxKi1TgUlC0j2lLWUmBTP/wqOixB HPomrQhHhtuVVAwS7Y/kmm27WUxLKG4O35oHQzhfM3IRX6vsIMRKKIp6KOxaHGPcLRjx acJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2S1LCGT8jZnLHKFdETxVAJu2QAn8/XwvivZOjX1Amwg=; b=D0DqGoGYhbuadj9iVEnGVSZovWtlgHqoRIPsOgwYYzEQDP+zYDSvfoDOkbP/7zjKp6 to65luIAjAZEioiERiWjQ98B7HkwpRAKLzQKYuW+675QDAtGE1Db83vDRSmfr21jtphW xWSfg6cnt4emxKNE/3l8r2LlOWHAmz6Vmc1KvCBRvu1kY9ReU+IgbwN62/VqAXbu6kx7 4zx8Td46Xrd6YoTzyfsRyPPldhZBBsuCCRCSx/zH4TS+QHeoMcB4sNlTqgJfkXMNTcF6 1lu3tFVy+0mwTVcrOh5mEKgQSgyodRuxpBihew4bQf0v3ylAgC4UbW07+RN0xxV0b3IN 2yMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 25si1393172oiz.230.2020.01.23.15.04.17; Thu, 23 Jan 2020 15:04:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729663AbgAWXCC (ORCPT + 99 others); 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