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=-6.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,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 005DDC433F5 for ; Fri, 17 Sep 2021 16:10:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC1E1611C4 for ; Fri, 17 Sep 2021 16:10:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243347AbhIQQLl (ORCPT ); Fri, 17 Sep 2021 12:11:41 -0400 Received: from mga01.intel.com ([192.55.52.88]:9698 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242637AbhIQQLh (ORCPT ); Fri, 17 Sep 2021 12:11:37 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10110"; a="245224085" X-IronPort-AV: E=Sophos;i="5.85,301,1624345200"; d="scan'208";a="245224085" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2021 09:10:13 -0700 X-IronPort-AV: E=Sophos;i="5.85,301,1624345200"; d="scan'208";a="546477010" Received: from zengguan-mobl.ccr.corp.intel.com (HELO [10.254.208.219]) ([10.254.208.219]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2021 09:10:08 -0700 Subject: Re: [PATCH v4 6/6] KVM: VMX: enable IPI virtualization To: Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , "kvm@vger.kernel.org" , Dave Hansen , "Luck, Tony" , Kan Liang , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Kim Phillips , Jarkko Sakkinen , Jethro Beekman , "Huang, Kai" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "Hu, Robert" , "Gao, Chao" References: <20210809032925.3548-1-guang.zeng@intel.com> <20210809032925.3548-7-guang.zeng@intel.com> From: Zeng Guang Message-ID: Date: Sat, 18 Sep 2021 00:10:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/11/2021 7:55 AM, Sean Christopherson wrote: > On Fri, Sep 10, 2021, Sean Christopherson wrote: >> On Mon, Aug 09, 2021, Zeng Guang wrote: >>> + if (!pages) >>> + return -ENOMEM; >>> + >>> + to_kvm_vmx(kvm)->pid_table = (void *)page_address(pages); >>> + to_kvm_vmx(kvm)->pid_last_index = KVM_MAX_VCPU_ID; >> I don't see the point of pid_last_index if we're hardcoding it to KVM_MAX_VCPU_ID. >> If I understand the ucode pseudocode, there's no performance hit in the happy >> case, i.e. it only guards against out-of-bounds accesses. >> >> And I wonder if we want to fail the build if this grows beyond an order-1 >> allocation, e.g. >> >> BUILD_BUG_ON(PID_TABLE_ORDER > 1); >> >> Allocating two pages per VM isn't terrible, but 4+ starts to get painful when >> considering the fact that most VMs aren't going to need more than one page. For >> now I agree the simplicity of not dynamically growing the table is worth burning >> a page. > Ugh, Paolo has queued a series which bumps KVM_MAX_VCPU_ID to 4096[*]. That makes > this an order-3 allocation, which is quite painful. One thought would be to let > userspace declare the max vCPU it wants to create, not sure if that would work for > xAPIC though. > > [*] https://lkml.kernel.org/r/1111efc8-b32f-bd50-2c0f-4c6f506b544b@redhat.com Thus we keep current design as no change.