Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1880860pxb; Fri, 10 Sep 2021 16:57:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXlwaiLWIc3Iy/jH9uT9PS2wGeHRlpV4i7lvUPhGduAXWON+Q4LuyoY2Gaw1CTV7gFqjMc X-Received: by 2002:a05:6e02:1250:: with SMTP id j16mr151489ilq.215.1631318243270; Fri, 10 Sep 2021 16:57:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631318243; cv=none; d=google.com; s=arc-20160816; b=EHVVBY8eZt2xiZAOEpAHmoO/BJ7hLj/uyqY/TyKX7edQo/pJpUtIffQR0w0ayZ5von QdhvYkKNrZedbFpehh+LyCa1WhGLQF7KZ/kiSq6RTot7sIdE9D7FvkzozeGGsgQZ5bA2 4QZKSuBOkGIsRWIMKHk9SSiNxXeJkFnZhwLFFe3ab1shBuYh9CC9fPi9f/6COxd08Hrh 08nsw4ypQ3li56iiIKC8ID8CE7Ivko4JQshNfzIBx5bCpLtFIkFWbax9zIEnA7iCo/r7 FfvWrse4GQ+q9PlTaGR0gNkfqQmrDEDZYlJrGYdHYllU9dJRRElXIpNWWsFp0cJsPR3C J2Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Lj4EQSAtjojNeOo+5AIxnfhqBrNwaP0Usia46GVY1oQ=; b=GdWnYCiFqBsBCIDDx3FOXn/AKVCR8Pi9y/xyEQMQKCvayoRHBW4EYT2LC8+FdTbSH9 CadT0//eHfySn4g+mX6gpQ/+tI6toKC8WcweGnpacO5ttbWFxa5e1pqPz/TB+6CGPVfV lZV32qBrvdG+Hzga9d0Q/Sl/SYieXgRxTKKr85Yw396dUKwPI6Lb1a3DeUDdDcQ31P2x 1ddSKeiwvG+iUyZMWEoOGlEzl7qtmD/s+owFkBgpNPDilDQt4UoSrPlh5IvTCPk5GTUo IuBvIdy99fGTrut38XfeBMzbS9JdVKqKvuAKi6cD+TpZXSfWH3v+/u2ZLmdBSHu5gcva VUrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="P2Y9yL/p"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d11si185079jaf.24.2021.09.10.16.57.11; Fri, 10 Sep 2021 16:57:23 -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; dkim=pass header.i=@google.com header.s=20210112 header.b="P2Y9yL/p"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234887AbhIJX4m (ORCPT + 99 others); Fri, 10 Sep 2021 19:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233946AbhIJX4l (ORCPT ); Fri, 10 Sep 2021 19:56:41 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76D05C061756 for ; Fri, 10 Sep 2021 16:55:30 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id gp20-20020a17090adf1400b00196b761920aso2516304pjb.3 for ; Fri, 10 Sep 2021 16:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Lj4EQSAtjojNeOo+5AIxnfhqBrNwaP0Usia46GVY1oQ=; b=P2Y9yL/ptNBIkgV2RV1ndLR/eMSVc/fsViMjX3kFRfgr6q4MrkOMcgd2f5ArvU/vQD xal7x4pdT+BNm7K7oodlNFs5rfif4USN/CVluAoxvUAYVAqL5BWnqFH8V1m9ZotHj/FV WEH5ZklYjE90+sxvPNoKKhV8iXPvLrqWIxSqzDfOW1nHFyDF9s3WUCMrTXud7dOLxE74 gNBGBcSpa/95/ClNgU+Xd8QaN+ReSUJFdryu/CBrGHmAOlu0KevlhgjtxB76wKHhQLZJ PqoTZp9ltAYrzoPT/fX7pxFveU3Bvd9WSOGjEymXtMONBS44d4uOK7Y+JKt/VUprf0DJ G2YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Lj4EQSAtjojNeOo+5AIxnfhqBrNwaP0Usia46GVY1oQ=; b=DkcH8ppF3LojLlplyMFkjPgeQkh8RiRsQo6JQjIvsJa/K1EM+fJZGK2K6zlCNhusR8 5WxMMSXTgKKPCRXR2yS5A/j7ZB6+cFFNwpXpvlimai8H7CXp4jW3D9Ey58CGnpsRYhxV Ky0OFi0zJjxBgY90o3U+QNiof1mxNomSD/Z95dygJI4HHqQ0X551byXANGEcnQjjZELJ WrmbpOAWZ1Cwepk9z4zJ2m8Gj2J4p9pfA5iabDXNJV/HNN7h3Ju0xvbG34jPvd28iAe3 dbM5+WVwcUgJpCq0v6v8bzRbFDa45p3tiqnw6Lgi23S8tk7HEjkWl8sZRsbr3QrDQ8Kx EjhQ== X-Gm-Message-State: AOAM5314YcuQV59mnwIMHkrkIfD7WBxJdT96c5VKZqdc7NBsoNTOQOQE XDlxtdywddmhBCavKfS8tzK2zQ== X-Received: by 2002:a17:90b:198c:: with SMTP id mv12mr125644pjb.223.1631318129721; Fri, 10 Sep 2021 16:55:29 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id n14sm60042pgd.48.2021.09.10.16.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 16:55:29 -0700 (PDT) Date: Fri, 10 Sep 2021 23:55:25 +0000 From: Sean Christopherson To: Zeng Guang Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, Dave Hansen , Tony Luck , Kan Liang , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Kim Phillips , Jarkko Sakkinen , Jethro Beekman , Kai Huang , x86@kernel.org, linux-kernel@vger.kernel.org, Robert Hu , Gao Chao Subject: Re: [PATCH v4 6/6] KVM: VMX: enable IPI virtualization Message-ID: References: <20210809032925.3548-1-guang.zeng@intel.com> <20210809032925.3548-7-guang.zeng@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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