From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CE27328B56 for ; Tue, 6 Jan 2026 01:17:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767662247; cv=none; b=YavQYOD/D/fkyHRhJAFFsWo1yBpVo/yMMlN/qe99BbVLtCZ+q2XUvOUg6MYq7cicASJfgoS+/mWr5HV6Sg4a84KqdSftEafVYrxa2C/WsNAxt7oi91O6V+XAeb8sknU7kVzGd1X/W/O+iv4tTL44zrh5Tu43pv565DR7zxW7oUo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767662247; c=relaxed/simple; bh=Vkn6d+IzHDTnJtRWg0esRaoSELl3xH6rHxdNRh7E4kQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=QO1rPSZRl8LygSYaLS86ybBRh4vF7vYjBq+xO4lPXe3P+erXNAp8en3GD8OCwpcDTw/bVLVjDPExwTGianH+JejxaT1cjp4n5OO7AQlLrg3Tgl/n/hWZvhG2GVN3cZUlTrLpjy3l79VBTlU0z5zzpC1J6tq6I/+85e3mWWGQXdc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=srukJ5bz; arc=none smtp.client-ip=209.85.210.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="srukJ5bz" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-7f89d880668so936712b3a.2 for ; Mon, 05 Jan 2026 17:17:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767662245; x=1768267045; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=LHeIv2XQKWavHCM7YPXAh7Bmr80lyuwrW8phEkPDzPc=; b=srukJ5bzvW9Ojh7G3bI0aqEPyws40pOFcZzoyMjcW59bJogNbwN+OOginc2psgwcfl 0FG/mhPx9UrlvRgQjhDZ24j1frLhm1ovJoxemadn0k3Q/X56x+lFUk3h3hvCv4FS71Y3 Zgt6RIy6jThs1B+OJoZJ1tecn8QitiJaESLUKzhIcXSKcgMdMUzRInnv3lojXw2dKY5b yp8LTAVi9vGc0WNLQ99LUxu0ht+UMBSNqjdtDcJU0AxombQW1bvBEbdbeOU6wEbLnTKd tOg2fmO0OsNbXwHnm0FiOunSctCvDvCQzpJwQOcbk08BLv+a5gZlYbcgTKClgsDSWEE3 otqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767662245; x=1768267045; h=content-transfer-encoding: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=LHeIv2XQKWavHCM7YPXAh7Bmr80lyuwrW8phEkPDzPc=; b=U5aF2nqlcdzeU8VX0mGc5yaar5oq7NEnKomTgVbLq63GGXtaAMH//Fo9zAEG9l7tY2 6OJzdYCH7fZ2mbdjUhbXIljmwIO3oHAGz66SjJ87nTwJRpJCH2rY4H5HgQYMfCH9WQ5A AxIDZETVICoZDpc7zNgdYUsLr1tzap6ygOHYIlBXFI25zEnuSgktn7pvFR/sJ6lpDj9l kxhyQGrCHUL0olAdma/+4ZAAHAQsbR0tCOl0zNZ4fJtad0LTddK9qYYGJjVTd1NyX33T l0w9ErnW7Sz3ikDmk8DiEE9O+34SphkrawdO9F0X1K4TPtFkTcDKjKJ4a7cKrWiV0/74 KX6g== X-Forwarded-Encrypted: i=1; AJvYcCVG9aBgzB0gESSXSlITA4Xu3ukNYGVFnOjYJDAk96/3vJHUW1kPnge9HynHT77N5cfVXt9Aa3q0TBcefYE=@vger.kernel.org X-Gm-Message-State: AOJu0YwFVsTPNVPdGwyr8cYV73Jx3f+hTmiEhN0voc0FZZbdiWzBoubD WvtgB9WdCcLxUkxofLPRJ2cfMKvYbw3U9xOZh0wTaXVQH4AuytfGrudNk//RfB3VlsKWWT8xTUA Mpe1tew== X-Google-Smtp-Source: AGHT+IH/IIcpsomoZZuFOHAD7u0wqzN+TzokWJVvCMAPsUDjfqeJDbBC1q7HMCbobbBwmcXf/oHu2fSRIbE= X-Received: from pffy8.prod.google.com ([2002:aa7:93c8:0:b0:802:f63a:105d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:428a:b0:7e8:4398:b36e with SMTP id d2e1a72fcca58-8188008db4dmr961948b3a.65.1767662245227; Mon, 05 Jan 2026 17:17:25 -0800 (PST) Date: Mon, 5 Jan 2026 17:17:23 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260101090516.316883-1-pbonzini@redhat.com> <20260101090516.316883-2-pbonzini@redhat.com> Message-ID: Subject: Re: [PATCH 1/4] x86/fpu: Clear XSTATE_BV[i] in save state whenever XFD[i]=1 From: Sean Christopherson To: Jim Mattson Cc: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Mon, Jan 05, 2026, Jim Mattson wrote: > On Thu, Jan 1, 2026 at 1:13=E2=80=AFAM Paolo Bonzini wrote: > > > > From: Sean Christopherson > > ... > > + /* > > + * KVM's guest ABI is that setting XFD[i]=3D1 *can* immediately= revert > > + * the save state to initialized. >=20 > This comment suggests that an entry should be added to > Documentation/virt/kvm/x86/errata.rst. Hmm, I don't think it's necessary, the SDM (in a style more suited for the = APM, *sigh*), "recommends" that software not rely on state being maintained when= disabled via XFD. Before doing so, system software should first initialize AMX state (e.g.,= by executing TILERELEASE); maintaining AMX state in a non-initialized state = may have negative power and performance implications and will prevent the exe= cution of In-Field Scan tests. In addition, software should not rely on the stat= e of the tile data after setting IA32_XFD[17] or IA32_XFD[18]; software should= always reload or reinitialize the tile data after clearing IA32_XFD[17] and IA32= _XFD[18]. System software should not use XFD to implement a =E2=80=9Clazy restore= =E2=80=9D approach to management of the TILEDATA state component. This approach will not operat= e correctly for a variety of reasons. One is that the LDTILECFG and TILERELEASE instr= uctions initialize TILEDATA and do not cause an #NM exception. Another is that an= execution of XSAVE, XSAVEC, XSAVEOPT, or XSAVES by a user thread will save TILEDATA= as initialized instead of the data expected by the user thread. I suppose that doesn't _quite_ say that the CPU is allowed to clobber state= , but it's darn close. I'm definitely not opposed to officially documenting KVM's virtual CPU impl= ementation, but IMO calling it an erratum is a bit unfair.