Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp65901ybm; Wed, 27 May 2020 19:30:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTUaBSuTn6Su/YDeqOSkDJkypUW7y7pkDFqL6g2LK2+kOAIEaYfx+YwM2b6u1+ZWRTARg5 X-Received: by 2002:a17:906:49c7:: with SMTP id w7mr1077444ejv.216.1590633002213; Wed, 27 May 2020 19:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590633002; cv=none; d=google.com; s=arc-20160816; b=Tj79+XKBfGahRfa8HxefMd7fPuGPGz14OqubXPo7Cfvv8BeLUsdWoXW9V37RhsfLEi sFNizrUZ38pvr1yRGMb4PCKm7ZQ5j1Sg/SUG0RJiPBpS8XGeBB4H/7wgGt3y66tft6Q5 MnCB+7qO2EV12NzFc2OugMgckUI9eolL6fod8caFzueqbADDjBlxxkSnhk2TyPsaKv2L kJ692qu9GVZ9iXLZx8DanidSirzBBRJo5/WzEDuievQhJer9mDOyXb1E7CnE3zuGx/PD S8tMd2B/eYOACnwCe3MpsKWVPqsKJsWvTK9BNfivfRP+m0i5coSQdIALfRLe5iDTopjE UPqQ== 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:ironport-sdr:ironport-sdr; bh=AO9RvA9QiXbWS9p7oWVWxudSWdYD6LPjukXT2CV6jaw=; b=nRiGEulhgvmdqDCVZxQ8lfed3xmB/k6jywl8N8aaHhmrLzzHGHPE3hJrZEcwWMn5AD Y9OAtBtlPgc5OgG8cdtcKk0XU9Z0L9RRO2tKwtDqbnrejExCQO8/H1EXYGHP9Yk4FLgP J5Cp0dffUN9KAzGqnfs+0G8JglxsQRSQuvcz4bMmOWZDjRLhAv0b2DpOO8NKzp806TPQ 56a7U0f0C1BQKZJTcRb9IS9p7hXhN/8V7E+hXmpcXDz7W+P9A11BehL9JA1331yVerRi Zdf49ege6ngrZmqM5zTm+uB+gRU+2LiPBsTV7NAoiYHSXz1qtAMDZmEAWUhzMaEsAj6a M28w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id do5si3721518ejc.105.2020.05.27.19.29.39; Wed, 27 May 2020 19:30:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726891AbgE1C1b (ORCPT + 99 others); Wed, 27 May 2020 22:27:31 -0400 Received: from mga06.intel.com ([134.134.136.31]:22888 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725849AbgE1C1b (ORCPT ); Wed, 27 May 2020 22:27:31 -0400 IronPort-SDR: 8f3bTmbZuOGH7yXlZ3Y2GC8WA2sEtl34y6kr35CD8+9RILwhDldoSixBNYkxMGMx5OFR7SvXKp 7TVS5tEJZj+Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2020 19:27:31 -0700 IronPort-SDR: 6zwQDLrGWUi0I7d9r+VRi31OHGVG6seEkmHrcq1o8BsT639tTmyTSUKYYjypC2PChrLLZt2uyI EjXdS/JnZrUA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,443,1583222400"; d="scan'208";a="270692992" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by orsmga006.jf.intel.com with ESMTP; 27 May 2020 19:27:31 -0700 Date: Wed, 27 May 2020 19:27:31 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+904752567107eefb728c@syzkaller.appspotmail.com Subject: Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation Message-ID: <20200528022730.GE25962@linux.intel.com> References: <20200527085400.23759-1-sean.j.christopherson@intel.com> <875zch66fy.fsf@vitty.brq.redhat.com> <20200527162318.GD24461@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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 27, 2020 at 06:56:02PM +0200, Paolo Bonzini wrote: > On 27/05/20 18:23, Sean Christopherson wrote: > > Hmm, one option would be to make .get_tdp_level() pure function by passing > > in vcpu->arch.maxphyaddr. That should make the comment redundant. I don't > > love bleeding VMX's implementation into the prototype, but that ship has > > kinda already sailed. > > Well, it's not bleeding the implementation that much, guest MAXPHYADDR > is pretty much the only reason why it's a function and not a constant. > > Another possibility BTW is to make the callback get_max_tdp_level and > make get_tdp_level a function in mmu.c. I like that idea. We could even avoid get_max_tdp_level() by passing that info into kvm_configure_mmu(), though that may not actually be cleaner. I'll play around with it.