Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp815155rdb; Fri, 26 Jan 2024 11:28:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiZqSX0zG/px1TSD1+CQg2d1rS3G7SqenoJENKm08GBSKpmY2PN3PEzml0EHgH9QzqtKAi X-Received: by 2002:ac8:59cb:0:b0:42a:71aa:7ea9 with SMTP id f11-20020ac859cb000000b0042a71aa7ea9mr683263qtf.25.1706297302776; Fri, 26 Jan 2024 11:28:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706297302; cv=pass; d=google.com; s=arc-20160816; b=TOPA5WW2KSp6XLuowAWM3NqeDjIwxJhF/MkM9I/o/QQsc05pYkiOskXKhnz/cfDu2n bqCUHN49ZImFLnxTc+VrdPFE+TzHcx+rwo6fqJmNKCxgT3wInWjb1g6PS4kLNb6pKwdb ogyBb+zTYsyGQm3pk/04hToR4zF/tbxPvfgm28TSGWAhp4v+8lIjeAlLAZp7DYK1nugY MwKQparEjeDAH0sO1svVGYTzmDmYLAjdtZnSaG/cPwmz6xeBTsp99+lRVXoNutWep1tc DW7Xz5xvt6ECoFTeOEvM34bkKwmzrIuELqQjiiavWpXm8mDu0jQSqPDPCUhZjGaAU5Db VyuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:disposition-notification-to :autocrypt:from:cc:references:to:content-language:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id; bh=THjreHmlTCrMut66fEEYpjSZVjPtbeJLLIKn/ik1asI=; fh=lHJvsb5Xio+XSXuzkn2gawhVzi2spSlrMVggoiV67uM=; b=Y4aOpUACtu9/OglXkW4qD2oJjYJ8sTeYfLaf2NKxrort3fTseRXagGbk1nsnlavp7B 1QmtheMGbNr0XuyT+bmPPGRGkuu+E/rBgUK5GebT01pDVJ5y1GS+6aPLKWsALLbNhXwU pSsgm3zWo1FS8fbjujtmE+hfLEQKDeffRgaZoROVkh9eVRNmdFDfKUWw2DSodYXS9emD 94QdU4bbT+rxQ2L37oADYwN9POdzhUFeFWYhlwGMqviZ3FkIwIK13z9MQeAvAj7Lg66I zESjdiK5nYg6op9DtIUUKOgDCoVDSxKCVzLtxNqBXMieGZ2xMRw1Uj52n3/6xGM9Ybt2 6Y1w== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=maciej.szmigiero.name); spf=pass (google.com: domain of linux-kernel+bounces-40564-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40564-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t1-20020a05622a01c100b0042a32277f76si1886488qtw.134.2024.01.26.11.28.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 11:28:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40564-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=maciej.szmigiero.name); spf=pass (google.com: domain of linux-kernel+bounces-40564-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40564-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 85E601C216FD for ; Fri, 26 Jan 2024 19:28:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B2C3225AC; Fri, 26 Jan 2024 19:28:09 +0000 (UTC) Received: from vps-vb.mhejs.net (vps-vb.mhejs.net [37.28.154.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 887B722618; Fri, 26 Jan 2024 19:28:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.28.154.113 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706297288; cv=none; b=bCAfqjFNoFoLatixn4zj494une1iQNf9/7L/DGcleZFmsSA32IO4G7Opzx1ViQCW5ZjsG1xr355kI4EbKWcb+4+zRgMBZRqJOcYztJSUDV/ovPNPDzLkNwVEj8IRvV9rZqVAXOzh+G6IzcAWGq7NIS3lIDx4v0Atzu/y5un0cHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706297288; c=relaxed/simple; bh=wa6nACIZtRxVnGrD6dWwimJPSEHg1URBTQrkPjgp/ok=; h=Message-ID:Date:MIME-Version:Subject:To:References:Cc:From: In-Reply-To:Content-Type; b=ZLtG93PrHscI78XdEkvSuU3pLAgQmB8dBnFM2blV5q3+lIYnbM1EzQVlentQJnvmrIVxHF5W96Iufa67fkZ9sbeWgtoBekATvlgnhTb6gmER3+M/iUDk9jBKemh0w3Ljtgam0nTwL5OQF+OjN72GXlTM9Yu1kXPPmfJn5HZA72o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=maciej.szmigiero.name; spf=pass smtp.mailfrom=maciej.szmigiero.name; arc=none smtp.client-ip=37.28.154.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=maciej.szmigiero.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=maciej.szmigiero.name 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 1rTRrt-0007KY-Vv; Fri, 26 Jan 2024 20:28:02 +0100 Message-ID: <78e85125-62aa-494d-a3c9-26f183b8d8c6@maciej.szmigiero.name> Date: Fri, 26 Jan 2024 20:27:56 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] KVM: x86: Give a hint when Win2016 might fail to boot due to XSAVES erratum Content-Language: en-US, pl-PL To: Paolo Bonzini References: <20240126184602.2410991-1-pbonzini@redhat.com> Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org 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 9W7Cz0q2Hd7Yu8GOXvMfQfrBiEV4q4PzidUtV6sLqVq0RMK7LEi0RiZpthwxz0IUFwR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amOVfFi8QFQL5 5ZSOo27q/Ox95rwuC/n+PoJxBfqU36XBi886VV4LxuGZ8kfy0qDpL5neYtkC9w== Disposition-Notification-To: "Maciej S. Szmigiero" In-Reply-To: <20240126184602.2410991-1-pbonzini@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 26.01.2024 19:46, Paolo Bonzini 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. > > Because KVM CPU caps are initialized from the kernel boot CPU features this > makes the XSAVES feature also unavailable for KVM guests in this case. > At the same time the XSAVEC feature is left enabled. > > Unfortunately, having XSAVEC but no XSAVES in CPUID breaks Hyper-V enabled > Windows Server 2016 VMs that have more than one vCPU. > > Let's at least give users hint in the kernel log what could be wrong since > these VMs currently simply hang at boot with a black screen - giving no > clue what suddenly broke them and how to make them work again. > > Trigger the kernel message hint based on the particular guest ID written to > the Guest OS Identity Hyper-V MSR implemented by KVM. > > Defer this check to when the L1 Hyper-V hypervisor enables SVM in EFER > since we want to limit this message to Hyper-V enabled Windows guests only > (Windows session running nested as L2) but the actual Guest OS Identity MSR > write is done by L1 and happens before it enables SVM. > > Fixes: b0563468eeac ("x86/CPU/AMD: Disable XSAVES on AMD family 0x17") > Signed-off-by: Maciej S. Szmigiero > Message-Id: > [Move some checks before mutex_lock(), rename function. - Paolo] > Signed-off-by: Paolo Bonzini > --- I have tested this version now and it seems to work well, too. Thanks, Maciej