From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dDeDJeVQ" Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF2E185 for ; Mon, 27 Nov 2023 09:24:11 -0800 (PST) Received: by mail-pj1-x104a.google.com with SMTP id 98e67ed59e1d1-28583d0fd4eso4888550a91.0 for ; Mon, 27 Nov 2023 09:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701105851; x=1701710651; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=rL9LfDvcE9DBnUyEpS1p+L6oMlIKUpS9e4ZuAaaj8xo=; b=dDeDJeVQHlQ994p98Okkt8Fi8rO1ymAvpvZY+lNMB0xLQP3k3YRPwn9ZU9FM10XfYP MpWA0na4iyrnNjsT1acdT0xPP8jDcuoea7DyqVPE2BudYQTvoI4nvsdOXtnIxvyqE9m1 fqNWvqdHvZVzjONjkZAQVCua/7BOXMe1xSrmLKgk9Ac2Vs5kx8zUcTeWZoqNhqVerl1K dpBkNjWJrHd8C8c+ubG39GQute/aj+q7GVgozK+sqjlEpTI17g3cIPVDJbYny4+OwWI5 7P464B7FJqQt+9EbtT/IrxqNel4bMvdakiNUUYr6hzJ69vYfrNJu+6r1HE2cXoZGrqjJ VqKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701105851; x=1701710651; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rL9LfDvcE9DBnUyEpS1p+L6oMlIKUpS9e4ZuAaaj8xo=; b=jaJeJnSdlf4wGMkDwRW1uD1OW2X428nP1+ezUAiEfQBXdaUg2aanba574UrmuIx8IB tRR4p8QpjKYEag8oK1M6LjvIKQ8FFZw5qQ4A60IX7Brkg4cKD6t90kDIq0RiVE/sUm9g RJ/9QQPKQGR/OGPHa6m7iSB7Ksq0F/gPJyzuB7elDqH2eHyQh/LOkAWYy3x+0Qz8rruw JkCfzra+WWIUvKz21iGb3/K7LNfFBw67SfctIbJCWBKe4STKnM1Dzp5JqNaZy9zgp5Wr MZZx1/JAbFmDQRw/uy2x6tmAYKi+DhD6Cojuio0/H4v4kVKCjpCwv8A+C8dCE3YI7FE4 921A== X-Gm-Message-State: AOJu0Yy9RiEc8AjlMXpJ6j/PvSo1td3Pn7nRYZuKuWdcNS9HI3On0+eY IUEe0M5nyajVBsxa3mf5XFaMOP7QrdM= X-Google-Smtp-Source: AGHT+IECzk14EwMjjFb3/1urDD+Q4mbeNYdw2g1/0ksrRD/AQy7nqH1ycmu7b6tnBPlSMiaoFaFQgGrTeFU= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90b:e8e:b0:285:b86b:6412 with SMTP id fv14-20020a17090b0e8e00b00285b86b6412mr1194032pjb.4.1701105850944; Mon, 27 Nov 2023 09:24:10 -0800 (PST) Date: Mon, 27 Nov 2023 09:24:09 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: Message-ID: Subject: Re: [PATCH] KVM: x86: Allow XSAVES on CPUs where host doesn't use it due to an errata From: Sean Christopherson To: "Maciej S. Szmigiero" Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" 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. > 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?