Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp984879pxb; Fri, 15 Apr 2022 17:25:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4mHQM2wmvcKNnFLGSzbgzOY9sYmLe0b06qPUBXqnXB5FqDjGTrJBBNJ8gbwK2ZDqt//zM X-Received: by 2002:a17:902:7296:b0:151:62b1:e2b0 with SMTP id d22-20020a170902729600b0015162b1e2b0mr1174862pll.165.1650068749569; Fri, 15 Apr 2022 17:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650068749; cv=none; d=google.com; s=arc-20160816; b=oY4sXg36Sd4KwvIsipm3PjkhddjGDVl/8oNpeh1zSnNls/gNj5k/oyAgoGdcXllqS5 H6hoe4sxSX4MQ/ioetgi6cfAIlHkTC6Ldtd/hEa2YVmJXJ7tJYJwj4NyTGHD5uVulCHq dR1uT85JDU75yY1kqP7stAe2wP5rxXj3pbje3J1+qwvwgHSRcUP/TIHHIal2xOsMqBoe idw/webNHj+p82bH/RUGWs30rH0REjMMx0unek8y+YkvSHrqSbISKqopVrlqIlxeue1a ZmeAphkfgkHWT8c71Ip926CzX9EsdRFpJ20ml4lxhBCJ2Q3YtsqpT+j2u7gNBV58MW+F MdEQ== 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=Az4fGj41zOdvkfI9EKM24+0aqWRfUg0i44LnNLGYmEM=; b=0zpAHm5VPKtysNGgwxfyZp72HsXBpwXG+HY3zpyk/Lf14Yd3vqkH2x86fFby09+9e6 i92dp9+RR8Fd0ixZUHPcSyiSL/h7d1FX9XgYX3eU9NgefVn1dzNjzbBOT85OgUx/uH47 wuzZORq35GOZWx9pLfwDFQDV7hn1f4bneqHimkmYLyjVuni1OXDV61HU2rvXKqKO04fL TGxfpCpWW1ecSR2Fq9dDXcoYHEiva3oarv+X1PI/PVZh3fxBHo333S6sVvApnqSmEq3K s46HPXvy0j6IzKJJoWncc3tmRbdpAfnzTJ6M2zPAj9V4zw2hVLGDtI0pXRUNHXIEMsma dpLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="n/ITxv/q"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a38-20020a056a001d2600b0050829a1029csi2728980pfx.357.2022.04.15.17.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:25:49 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="n/ITxv/q"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D0FC4E5435; Fri, 15 Apr 2022 17:24:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354767AbiDOPE3 (ORCPT + 99 others); Fri, 15 Apr 2022 11:04:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354794AbiDOPEZ (ORCPT ); Fri, 15 Apr 2022 11:04:25 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A571B7C5B for ; Fri, 15 Apr 2022 08:01:57 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id mp16-20020a17090b191000b001cb5efbcab6so11966019pjb.4 for ; Fri, 15 Apr 2022 08:01:57 -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=Az4fGj41zOdvkfI9EKM24+0aqWRfUg0i44LnNLGYmEM=; b=n/ITxv/qMhJcXJbybE8llTliBfr1k8JJIzO2zL/ZNTGbt7v3hjI7fWhhJSpIUOVn8o cdpZ7SRiz3M7qD56Hi5kGz9SkKdxY/KMLZCJ8j67oaob5VkwDiq2VOxG3cFQ+7Ch/HgV hjgtWwVDObmDvtJS1lgGc3HBH2SQcHLt5+TArE9Rp9VHezDXcP60FMj902nhDtQZbK+M OuHowPFzQaF1UZT0qECi+VRyyR4Rap2D+F3YMxwT3HUQtmEAYMR2BPJ5TJgeYAFX9qx1 W3q5OUtLUZcL2lj0yylPC2tJZ2hJZt4XrDP6mjpFxhvUg3ZrEA1s6bJbvISQixv1MGNO T+Qg== 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=Az4fGj41zOdvkfI9EKM24+0aqWRfUg0i44LnNLGYmEM=; b=KRqCt7SMru92Qj0WoPi3ru5vYRUn04Ijqh+tm/JQMuo7Z2rEkSRLODLRNp1SZC7QWG LmB4F4A7fAJ3HapVsEKOZy0ztdQ4hD53MHTGhY4YeqTaoIavAi/J3zO22/c7CIZh2m9O XEBJFacxw8NTF9pIJkx/JRfLy3PYWBJM9Oayqg+J9s+FVFUuhq8qh0wFdxho03IkNz9c P6X3GE0EoGsLyVMY96ZekBzQPmtSooZdiABhsbH6vWRg6o4qsB07yU7i1OakTD7nhXqv Vwn+izTzCt5WKTX2m+E4sImRr4DDWx9g9AwLx+25Q5w2olkxK9uu2eZo2sLOWnt0O5fE DW/Q== X-Gm-Message-State: AOAM532ntdWQdnlYwakbrZBBfqBvI+V9HGTLqU6GFR/x4niad6zN8xam I/rpUIyLkIhQYj73IMspkz2avg== X-Received: by 2002:a17:90b:3a82:b0:1cb:9ba8:56a5 with SMTP id om2-20020a17090b3a8200b001cb9ba856a5mr4641840pjb.16.1650034916361; Fri, 15 Apr 2022 08:01:56 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id v4-20020a622f04000000b005057a24d478sm3162719pfv.121.2022.04.15.08.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 08:01:55 -0700 (PDT) Date: Fri, 15 Apr 2022 15:01:52 +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 v8 8/9] KVM: x86: Allow userspace set maximum VCPU id for VM Message-ID: References: <20220411090447.5928-1-guang.zeng@intel.com> <20220411090447.5928-9-guang.zeng@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220411090447.5928-9-guang.zeng@intel.com> X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 11, 2022, Zeng Guang wrote: > @@ -11180,6 +11192,9 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) > struct page *page; > int r; > > + if (vcpu->vcpu_id >= vcpu->kvm->arch.max_vcpu_ids) This belongs in pre-create. > + return -EINVAL; > + > vcpu->arch.last_vmentry_cpu = -1; > vcpu->arch.regs_avail = ~0; > vcpu->arch.regs_dirty = ~0;