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=-5.5 required=3.0 tests=BAYES_00, 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 C81E3C433E7 for ; Wed, 2 Sep 2020 15:24:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F9C920767 for ; Wed, 2 Sep 2020 15:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728005AbgIBPYT (ORCPT ); Wed, 2 Sep 2020 11:24:19 -0400 Received: from mga09.intel.com ([134.134.136.24]:44207 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbgIBPVD (ORCPT ); Wed, 2 Sep 2020 11:21:03 -0400 IronPort-SDR: WXReCybxJdxHS2J5btFqGPIY4jVz16bnTx3g5NMWm6AWaeZZ9fphe4awJpXVYNpyo89GDnOMd/ 4l0e66/WAcJw== X-IronPort-AV: E=McAfee;i="6000,8403,9732"; a="158398293" X-IronPort-AV: E=Sophos;i="5.76,383,1592895600"; d="scan'208";a="158398293" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 08:18:50 -0700 IronPort-SDR: 84PhDN9HHr/+zSjnMDCSGNAPptVMhcinqyKwasO4yk24J3FhV2mRwDQaVWAeny12WobOhMqmF2 k/mrv8Lkysdg== X-IronPort-AV: E=Sophos;i="5.76,383,1592895600"; d="scan'208";a="446557920" Received: from sjchrist-ice.jf.intel.com (HELO sjchrist-ice) ([10.54.31.34]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 08:18:49 -0700 Date: Wed, 2 Sep 2020 08:18:48 -0700 From: Sean Christopherson To: Vitaly Kuznetsov Cc: Jim Mattson , Paolo Bonzini , Wanpeng Li , kvm list , LKML Subject: Re: [PATCH] KVM: VMX: fix crash cleanup when KVM wasn't used Message-ID: <20200902151848.GA11695@sjchrist-ice> References: <20200401081348.1345307-1-vkuznets@redhat.com> <20200822034046.GE4769@sjchrist-ice> <20200825000920.GB15046@sjchrist-ice> <87pn75wzpj.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87pn75wzpj.fsf@vitty.brq.redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 01, 2020 at 12:36:40PM +0200, Vitaly Kuznetsov wrote: > Sean Christopherson writes: > > > On Mon, Aug 24, 2020 at 03:45:26PM -0700, Jim Mattson wrote: > >> On Mon, Aug 24, 2020 at 11:57 AM Jim Mattson wrote: > >> > > >> > On Fri, Aug 21, 2020 at 8:40 PM Sean Christopherson > >> > wrote: > >> > > I agree the code is a mess (kvm_init() and kvm_exit() included), but I'm > >> > > pretty sure hardware_disable_nolock() is guaranteed to be a nop as it's > >> > > impossible for kvm_usage_count to be non-zero if vmx_init() hasn't > >> > > finished. > >> > > >> > Unless I'm missing something, there's no check for a non-zero > >> > kvm_usage_count on this path. There is such a check in > >> > hardware_disable_all_nolock(), but not in hardware_disable_nolock(). > >> > >> However, cpus_hardware_enabled shouldn't have any bits set, so > >> everything's fine. Nothing to see here, after all. > > > > Ugh, I forgot that hardware_disable_all_nolock() does a BUG_ON() instead of > > bailing on !kvm_usage_count. > > But we can't hit this BUG_ON(), right? I'm failing to see how > hardware_disable_all_nolock() can be reached with kvm_usage_count==0. Correct, I was mostly talking to myself.