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.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham 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 C580CC10F11 for ; Wed, 10 Apr 2019 17:34:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4AB02077C for ; Wed, 10 Apr 2019 17:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729525AbfDJReD (ORCPT ); Wed, 10 Apr 2019 13:34:03 -0400 Received: from mga02.intel.com ([134.134.136.20]:20528 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729473AbfDJReD (ORCPT ); Wed, 10 Apr 2019 13:34:03 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2019 10:34:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,334,1549958400"; d="scan'208";a="149729238" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.181]) by orsmga002.jf.intel.com with ESMTP; 10 Apr 2019 10:34:03 -0700 Date: Wed, 10 Apr 2019 10:34:02 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Krish Sadhukhan , KVM list , Jim Mattson Subject: Re: [PATCH 6/6 v5][kvm-unit-test nVMX]: Check "load IA32_PAT" on vmentry of L2 guests Message-ID: <20190410173402.GB27321@linux.intel.com> References: <20190408213516.17966-1-krish.sadhukhan@oracle.com> <20190408213516.17966-7-krish.sadhukhan@oracle.com> <410b4ab6-65fa-c4c3-caf1-2f5c1ed1162e@redhat.com> <20190410171732.GA27321@linux.intel.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: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, Apr 10, 2019 at 07:22:51PM +0200, Paolo Bonzini wrote: > On 10/04/19 19:17, Sean Christopherson wrote: > >> vmcs_write(ctrl_field, ctrl_saved & ~ctrl_bit); > >> - for (i = 0; i <= PAT_VAL_LIMIT; i++) { > >> + for (i = 0; i < 256; i = (i < PAT_VAL_LIMIT) ? i + 1 : i * 2) { > >> /* Test PAT0..PAT7 fields */ > >> - for (j = 0; j < 8; j++) { > >> + for (j = 0; j < (i ? 8 : 1); j++) { > > I don't think "j < (i ? 8 : 1)" is what you intended. As-is only i==0, > > i.e. UC memtype, gets shortcircuited to test PAT0 only. Did you perhaps > > intend to test only PAT0 for i>8? E.g.: > > No, it is what I intended. The reason is that i == 0 gives the same "i > << (j * 8)" for all values of j. Otherwise, the logs show 8 entries for > GUEST_IA32_PAT = 0. :) *sigh* Math is hard. Thanks!