Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3264977rdh; Mon, 27 Nov 2023 09:47:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6mErv3B9slyldPxYuYjwdOm4VPA9Rybd5fO/4sCylfowEVRmaNbicI+SdaD3pIFc5oyhj X-Received: by 2002:a05:6a21:33aa:b0:18b:9428:cd1f with SMTP id yy42-20020a056a2133aa00b0018b9428cd1fmr17379371pzb.21.1701107257183; Mon, 27 Nov 2023 09:47:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701107257; cv=none; d=google.com; s=arc-20160816; b=wrAKO0nZISKCU1AFZanFQS3ch5iPpzRI3SqGXxiYv4J8Z2+o0rC8HYf55WwQfjTef+ 9HeWYyfYs1zr1rJXbHGiaBDrA81CtSW1JQJfDlHy3/hX6e+9fbjgZu9l50oMeAXSMm3g 0UUsf0emj//PF8xFn3JUnsRMDR14lMPwdAFyE7QbTMGBqS99otNHYLCc6gIzvVBuFJ7r i4gNPZZaShf7Updw66DM49rQnBuvkFR63PrKpz/msDz51KVJ+8f38+Z0fvx/3kXrzgxz yVT+ss+W5QElu0e2MPpuS8DPRKnlvtIH9Rz62b9w419xZf/S0fNHwTd+O9oNUUEPGKWA yb2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id; bh=WtTeuBfE/kggb/Y04FytG0Knhuftl/rBAifi1Tx4PMg=; fh=IczE/FYqinQ7k7O3D1SswHC93QrfXqbblVYzr34TRlc=; b=j1pdLkO92rgUfR+UfCYRB9iALRtXtQIgKnbkc0iCbMFAPcJ1yfdTiT2ssJX17iFx1j Ien3TMmM0HgHqu7Bzczok6/+qmlEtlbl1OnhwAOME7575YRhvLFE7+C+hc2S0yMQsPNt fGgVSgklRCJ419/XfBplOyjEUhWPR2U7NRJmX09SLAYkcV/nZAk4Hxh5npxPLvHtdm51 VWxnOSdvqhv1DP/J7bXU6t/2I5n85xXRwkNr1YV6xnIy4bAX9UV+s9vQPaiBaeHYZztm lav/wKA5TB47NJ1CyzdFwJXfkaN6r20UKN8REU0m+wKP3BwEgaQ+hVrHZajANtQ2IQ4n CVdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id f22-20020a635116000000b005be007363a4si9644498pgb.669.2023.11.27.09.47.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 09:47:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9854A8076640; Mon, 27 Nov 2023 09:47:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbjK0RrQ (ORCPT + 99 others); Mon, 27 Nov 2023 12:47:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbjK0RrP (ORCPT ); Mon, 27 Nov 2023 12:47:15 -0500 Received: from vps-vb.mhejs.net (vps-vb.mhejs.net [37.28.154.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5265A111; Mon, 27 Nov 2023 09:47:20 -0800 (PST) Received: from MUA by vps-vb.mhejs.net with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r7fhU-0000lN-D1; Mon, 27 Nov 2023 18:47:16 +0100 Message-ID: <50076263-8b4f-4167-8419-e8baede7e9b0@maciej.szmigiero.name> Date: Mon, 27 Nov 2023 18:47:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] KVM: x86: Allow XSAVES on CPUs where host doesn't use it due to an errata Content-Language: en-US, pl-PL To: Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: From: "Maciej S. Szmigiero" Autocrypt: addr=mail@maciej.szmigiero.name; keydata= xsFNBFpGusUBEADXUMM2t7y9sHhI79+2QUnDdpauIBjZDukPZArwD+sDlx5P+jxaZ13XjUQc 6oJdk+jpvKiyzlbKqlDtw/Y2Ob24tg1g/zvkHn8AVUwX+ZWWewSZ0vcwp7u/LvA+w2nJbIL1 N0/QUUdmxfkWTHhNqgkNX5hEmYqhwUPozFR0zblfD/6+XFR7VM9yT0fZPLqYLNOmGfqAXlxY m8nWmi+lxkd/PYqQQwOq6GQwxjRFEvSc09m/YPYo9hxh7a6s8hAP88YOf2PD8oBB1r5E7KGb Fv10Qss4CU/3zaiyRTExWwOJnTQdzSbtnM3S8/ZO/sL0FY/b4VLtlZzERAraxHdnPn8GgxYk oPtAqoyf52RkCabL9dsXPWYQjkwG8WEUPScHDy8Uoo6imQujshG23A99iPuXcWc/5ld9mIo/ Ee7kN50MOXwS4vCJSv0cMkVhh77CmGUv5++E/rPcbXPLTPeRVy6SHgdDhIj7elmx2Lgo0cyh uyxyBKSuzPvb61nh5EKAGL7kPqflNw7LJkInzHqKHDNu57rVuCHEx4yxcKNB4pdE2SgyPxs9 9W7Cz0q2Hd7Yu8GOXvMfQfrBiEV4q4PzidUtV6sLqVq0RMK7LEi0RiZ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6YNFo+BHYTfamOVfFi8QFQL5 5ZSOo27q/Ox95rwuC/n+PoJxBfqU36XBi886VV4LxuGZ8kfy0qDpL5neYtkC9w== In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 27 Nov 2023 09:47:30 -0800 (PST) On 27.11.2023 18:24, Sean Christopherson wrote: > On Thu, Nov 23, 2023, Maciej S. Szmigiero wrote: >> From: "Maciej S. Szmigiero" >> >> Since commit b0563468eeac ("x86/CPU/AMD: Disable XSAVES on AMD family 0x17") >> kernel unconditionally clears the XSAVES CPU feature bit on Zen1/2 CPUs. >> >> Since KVM CPU caps are initialized from the kernel boot CPU features this >> makes the XSAVES feature also unavailable for KVM guests in this case, even >> though they might want to decide on their own whether they are affected by >> this errata. >> >> Allow KVM guests to make such decision by setting the XSAVES KVM CPU >> capability bit based on the actual CPU capability > > This is not generally safe, as the guest can make such a decision if and only if > the Family/Model/Stepping information is reasonably accurate. If one lies to the guest about the CPU it is running on then obviously things may work non-optimally. >> This fixes booting Hyper-V enabled Windows Server 2016 VMs with more than >> one vCPU on Zen1/2 CPUs. > > How/why does lack of XSAVES break a multi-vCPU setup? Is Windows blindly doing > XSAVES based on FMS? The hypercall from L2 Windows to L1 Hyper-V asking to boot the first AP returns HV_STATUS_CPUID_XSAVE_FEATURE_VALIDATION_ERROR. It's apparently a "should never happen" scenario for Windows since it crashes soon after. That's why uniprocessor configurations aren't broken - the BSP doesn't need to be specifically booted by the L2 guest. Unfortunately, Windows Server 2016 mainstream support has ended in Jan 2022 so it is only getting security updates. And you can't really break into an OS that you can't even start. Thanks, Maciej