Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4890358ybf; Wed, 4 Mar 2020 12:48:38 -0800 (PST) X-Google-Smtp-Source: ADFU+vtSfUMU7CRsW8t0n+6+OWAloiKhOrldLO8X3cmqmakQ1rM1MWIH+6NI9x1jwG46u1cWQM7S X-Received: by 2002:a9d:3de4:: with SMTP id l91mr3949047otc.35.1583354918702; Wed, 04 Mar 2020 12:48:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583354918; cv=none; d=google.com; s=arc-20160816; b=bj78S8kTgaTXmVc0PN/VMSKDq9P9gTP8rh5E8neJ5KH8oDyyJAKkmXQrViAgFNPQ1+ JrEqMvFXAdzQtmg7Ajm2bNdW9IKest7QqjmUO/3aOj9YQT+xIBGbQ3qC9DeMAxZIA64Y u6/Ie4mfBxJvyWy1UNdMtXUfvQd5R0NZseof67X9hwbnCKghpVC6U2U7hqHWQQTLuXiC ZWzi0xR2B0VIkzLRNj3KluU6IBNNSs/qYCv8utNO/JLBFijxz171vEAHnqvWF6ncnSzM YShUW8Ae/0BX9HjTsMmLFXH2cOdnyXdIF2HOeHZE+WbzOTmujC+1ztbYhF1FOkcdloJ4 NHcA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=5xONO6B/uPuqqTgEHJF5b2cVCeeKOH3J+FZEzd9ew8M=; b=j4ag1K5OoUBeMQWuvzOIEIBxpx3gOIXoigS42kn12KfexhYMZjlpeEIN1ODTIeAfVd PBKzb2pW9bQDF4xN7rShZmA3KMX5wb1WfW/3kXWfcjt68ts5tumAPpitIOzlsmhuZXjn gPS/hj2SniVOiXDYO02ZnEtCk69Bn12DkcfJIDO35FeD/Lut8patDInTEtcY4kFWds5q 8lrzdtruH+BHX6J6BFzZBZPGULCAlo6gycD6DwqC3On6BO1RYpX59S4RhLfKKVKOI1Bv imWOrId9bBfiyh5ZvLjD3t/quQXgP81/652PRJtcmJo4LAcntmZOGG/G9eJzmTUU+plr 4qbQ== 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 w8si1999716otg.26.2020.03.04.12.48.26; Wed, 04 Mar 2020 12:48:38 -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 S2388309AbgCDUrm (ORCPT + 99 others); Wed, 4 Mar 2020 15:47:42 -0500 Received: from mga12.intel.com ([192.55.52.136]:6749 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728539AbgCDUrl (ORCPT ); Wed, 4 Mar 2020 15:47:41 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2020 12:47:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,515,1574150400"; d="scan'208";a="439262784" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by fmsmga005.fm.intel.com with ESMTP; 04 Mar 2020 12:47:40 -0800 Date: Wed, 4 Mar 2020 12:47:40 -0800 From: Sean Christopherson To: Paolo Bonzini Cc: Jan Kiszka , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Xiaoyao Li Subject: Re: [PATCH 3/6] KVM: x86: Add dedicated emulator helper for grabbing CPUID.maxphyaddr Message-ID: <20200304204740.GG21662@linux.intel.com> References: <20200302195736.24777-1-sean.j.christopherson@intel.com> <20200302195736.24777-4-sean.j.christopherson@intel.com> <617748ab-0edd-2ccc-e86b-b86b0adf9d3b@siemens.com> <4ddde497-9c71-d64c-df20-3b4439664336@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4ddde497-9c71-d64c-df20-3b4439664336@redhat.com> 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 Tue, Mar 03, 2020 at 11:14:22AM +0100, Paolo Bonzini wrote: > On 03/03/20 10:48, Jan Kiszka wrote: > >> > >> I don't think this is a particularly useful change.? Yes, it's not > >> intuitive but is it more than a matter of documentation (and possibly > >> moving the check_cr_write snippet into a separate function)? > > > > Besides the non obvious return value of the current function, this > > approach also avoids leaving cpuid traces for querying maxphyaddr, which > > is also not very intuitive IMHO. > > There are already other cases where we leave CPUID traces. We can just > stop tracing if check_limit (which should be renamed to from_guest) is > true; there are other internal cases which call ctxt->ops->get_cpuid, > such as vendor_intel, and those should also use check_limit==true and > check the return value of ctxt->ops->get_cpuid. No, the vendor checks that use get_cpuid() shouldn't do check_limit=true, they're looking for an exact match on the vendor. Not that it matters. @check_limit only comes into play on a vendor check if CPUID.0 doesn't exist, and @check_limit only effects the output if CPUID.0 _does_ exist. I.e. the output for CPUID.0 is unaffected by @check_limit.