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.3 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 B69D8C43603 for ; Wed, 18 Dec 2019 00:24:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 894C82176D for ; Wed, 18 Dec 2019 00:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726402AbfLRAYL (ORCPT ); Tue, 17 Dec 2019 19:24:11 -0500 Received: from mga17.intel.com ([192.55.52.151]:10966 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725975AbfLRAYL (ORCPT ); Tue, 17 Dec 2019 19:24:11 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Dec 2019 16:24:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,327,1571727600"; d="scan'208";a="415653162" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by fmsmga005.fm.intel.com with ESMTP; 17 Dec 2019 16:24:11 -0800 Date: Tue, 17 Dec 2019 16:24:10 -0800 From: Sean Christopherson To: Jim Mattson Cc: Nadav Amit , Paolo Bonzini , kvm list Subject: Re: [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check Message-ID: <20191218002410.GN11771@linux.intel.com> References: <20190518163743.5396-1-nadav.amit@gmail.com> <51BBC492-AD4F-4AA4-B9AD-8E0AAFFC276F@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Fri, Dec 13, 2019 at 09:30:45AM -0800, Jim Mattson wrote: > On Fri, Dec 13, 2019 at 1:13 AM Nadav Amit wrote: > > > > > On Dec 13, 2019, at 12:59 AM, Jim Mattson wrote: > > > > > > On Sat, May 18, 2019 at 4:58 PM Nadav Amit wrote: > > >> The test that checks the maximum VMCS field encoding does not probe all > > >> possible VMCS fields. As a result it might fail since the actual > > >> IA32_VMX_VMCS_ENUM.MAX_INDEX would be higher than the expected value. > > >> > > >> Change the test to check that the maximum of the supported probed > > >> VMCS fields is lower/equal than the actual reported > > >> IA32_VMX_VMCS_ENUM.MAX_INDEX. > > > > > > Wouldn't it be better to probe all possible VMCS fields and keep the > > > test for equality? > > > > It might take a while though… > > > > How about probing VMREAD/VMWRITE to MAX_INDEX in addition to all the known > > VMCS fields and then checking for equation? > > > It can't take that long. VMCS field encodings are only 15 bits, and > you can ignore the "high" part of 64-bit fields, so that leaves only > 14 bits. Unless kvm-unit-tests is being run in L1, in which case things like this are painful. That being said, I do agree that probing "all" VMCS fields is the way to go. Walking from highest->lowest probably won't even take all that many VMREADS. If it is slow, the test can be binned to its own config.