Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1401601pxj; Fri, 21 May 2021 13:21:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUPN8jBMPOBUS1Xopf64pXer7QQk1r3rasaGqkIC+8pENHj3yGFhnoQewfd2maOtEWOJY3 X-Received: by 2002:a05:6e02:f10:: with SMTP id x16mr565300ilj.65.1621628499048; Fri, 21 May 2021 13:21:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621628499; cv=none; d=google.com; s=arc-20160816; b=HIfppTSzBT1W1CUKKMnuFCv22brZ/vJZvJu93SB5aTQX6zYlakqrk3Gut2DckN9xkn 5eXFWn9agsGLHAfXGHVaWPGfkPR6oxFdKPu+G0TutocbRrCkXqWfjb+ASG5m/MzwDOP0 SkNmiJ36xRfmtV8tt0PFOKO2z9K5labrzo8wOLWIRRlp7f/+0yMoDWfiKVxID2+jfMKy Jt8Pnni0+e49/DonS2ACipLms1prbLy8B4HBAZSfmkytX4eGEx3E/XYfNDdQt2fp5J+3 YGW+K6bWWLWLLdM1h6Gly0CSGtUM6EsIxgYa12YKf+mYN5MrfeglEF2y23fRHQTGbVAV zf9g== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oPQ0WnpZS7sQjm0jySdRKiIFkASQYZuINbenVMidsQE=; b=A4ISCtcxztR0G+MRr/ydq40Xs/lswDyenZ/Bt8m79rql6qyZTQee8jtd4dA8y4SreZ pErVpvCXJZ6O/hM+cnZ0G8K7Jr7ScuYvyidCc7/Dq7v+/IjzKWcfms9fUe3Smew96MNn tuOvy7X6ObRvTw9oOajVoi9P30VIpCEI1xcHMW0rYcWiRex7ItzOa3+C5ZCoFTTqLWJr Q2wewZ75fSF0dSQGYdbm3nF8PvusPIZpXEYI4VMJV/8BEeKHw6Ta0paC4G/4ZMiZfpb/ puBIvsw5n6vegmiVPxQj35u9wSS1Zwn+rOWrg9Rj8qCjPfLMAh1hm0WxPbthQ8C2VjNe G9AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kPraeU7i; 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 i20si6138495jal.25.2021.05.21.13.21.26; Fri, 21 May 2021 13:21:39 -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=20161025 header.b=kPraeU7i; 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 S235824AbhEUP3r (ORCPT + 99 others); Fri, 21 May 2021 11:29:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbhEUP3p (ORCPT ); Fri, 21 May 2021 11:29:45 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6741C0613CE for ; Fri, 21 May 2021 08:28:20 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id 22so14764415pfv.11 for ; Fri, 21 May 2021 08:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=oPQ0WnpZS7sQjm0jySdRKiIFkASQYZuINbenVMidsQE=; b=kPraeU7i1keDTG3M4v8EV1gDxMm5N4/gL9Bu+jMvDUIOHHYosVCkIPSiT/7PRilvUj K3dHq/V+ahl8FL8qFNzlcovHvxxhWoX/YE45wEQsF1FvwdetZZEbkNbvBOAe8uRJF8G6 y9ZgIwiXrl2zsi/oLMzxP9gfUR8/ZbVbAAajzlZdoS9At664CrzX1NCcxXFVuWblpQEW hq5k4PmeG8U+1d/yQa/XVsY5axZK3FDPCH2d2ZAJGCrM75OKaqEvRRs8wTmE5o5JB28u yxzNvm+KlKHXtMV0amfRNHNVNG/pY1p14gUjttgGIOJ9etzHBQonSuGwBkrmxXPmunsB x4XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=oPQ0WnpZS7sQjm0jySdRKiIFkASQYZuINbenVMidsQE=; b=Li4D8hadCDabDrYuh7KlJndtVH1WR6Cfwxz6eyIkkXiWn3FTnu9kPNU/T0BpH8uZJC GBuFoXqax1UUv7a+oU93FCI0bSsOCebuy5BcgpFRCZtDk//IdabNQ5Oju/uLB+3mK5Aj F8WI8fSBoQhuxsUdRvriBgiwlj04r6wNFQ2aZvXTZBf0G7o3EKIlTn8VXHqJAwjyOkHR RUV2Nb0/02gd9/jSkNSbjNRl3WqXYv3Z22P/4mhDUWnLEuTPrK+CFQ/H9WNHVzdYrVer uS++qkHVUcT2s7fFPm5qV79pTl2rX8SBi9b2Gt2t7w55GJhV3VmNsWwUkovLyifOBf6c 4IIw== X-Gm-Message-State: AOAM530ViETYaRxKuz8r0B+4X4vq/V5011Pa6bnkj+TDOL9gzfYhF5z0 UqnaTd3CCiPwh1ifwk6U33NuzA== X-Received: by 2002:a63:338b:: with SMTP id z133mr10495627pgz.442.1621610900180; Fri, 21 May 2021 08:28:20 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id 13sm4737555pfz.91.2021.05.21.08.28.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 08:28:19 -0700 (PDT) Date: Fri, 21 May 2021 15:28:15 +0000 From: Sean Christopherson To: Reiji Watanabe Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/43] KVM: VMX: Set EDX at INIT with CPUID.0x1, Family-Model-Stepping Message-ID: References: <20210424004645.3950558-1-seanjc@google.com> <20210424004645.3950558-3-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 21, 2021, Reiji Watanabe wrote: > On Wed, May 19, 2021 at 11:47 AM Sean Christopherson wrote: > > > > On Tue, May 18, 2021, Reiji Watanabe wrote: > > > BTW, I would think having a default CPUID for CPUID.(EAX=0x1) would be better > > > for consistency of a vCPU state for RESET. I would think it doesn't matter > > > practically anyway though. > > > > Probably, but that would require defining default values for all of CPUID.0x0 and > > CPUID.0x1, which is a can of worms I'd rather not open. E.g. vendor info, basic > > feature set, APIC ID, etc... would all need default values. On the other hand, > > the EDX value stuffing predates CPUID, so using 0x600 isn't provably wrong, just > > a bit anachronistic. :-) > > I see... Then I don't think it's worth doing... > Just out of curiosity, can't we simply use a vcpu_id for the APIC ID ? That would mostly work, but theoretically we could overflow the 8 bit field because max vCPUs is 288. Thanks Larrabee. commit 682f732ecf7396e9d6fe24d44738966699fae6c0 Author: Radim Krčmář Date: Tue Jul 12 22:09:29 2016 +0200 KVM: x86: bump MAX_VCPUS to 288 288 is in high demand because of Knights Landing CPU. We cannot set the limit to 640k, because that would be wasting space. > Also, can't we simply use the same values that KVM_GET_SUPPORTED_CPUID > provides for other CPUID fields ? Yes, that would mostly work. It's certainly possible to have a moderately sane default, but there's essentially zero benefit in doing so since practically speaking all userspace VMMs will override CPUID anyways. KVM could completely default to the host CPUID, but again, it wouldn't provide any meaningful benefit, while doing so would step on userspace's toes since KVM's approach is that KVM is "just" an accelerator, while userspace defines the CPU model, devices, etc... And it would also mean KVM has to start worrying about silly corner cases like the max vCPUs thing. That's why I say it's a can of worms :-)