From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (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 41CB72376E4 for ; Tue, 6 Jan 2026 17:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.208.42 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767722212; cv=pass; b=TaBF7sqyi+5do/j66y0tVkkjTj2Tobxc3IFhCrcLbwkxhsYfSK9pc1JQszzUresdEdNFgZienAze3IOamR/VEzIAIvW2lY2x3slkgyD5flSLJ7ULMzVcnsp/KrPYhyPjFuQ5LYwNrTQj3y78Y+HLlzG+e8U6fXgAic65lYmPsd4= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767722212; c=relaxed/simple; bh=b1EoNNjieLxcoSo0AfHltNs1toOanJO0lCrICvL08UU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=gvgAYLJpd+zAcaIfLhzH56fc5R57WRQI1weD/nPj3bx08AkozqGV0TRwr2qsIGDx6OACZ4WPuGGdfMzTPGacQpyBodz5VR37KolqGJVbBaOMMXy9MnN/ax66Gm2PxAKmyGjUqnrE4J2EMYbHeolyV6bF7jZET/y82UvuGz+u1zg= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=i/v+mhsp; arc=pass smtp.client-ip=209.85.208.42 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="i/v+mhsp" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-64b72793544so280a12.1 for ; Tue, 06 Jan 2026 09:56:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1767722208; cv=none; d=google.com; s=arc-20240605; b=iLCDljAFdQtS12k2Jv216WWX9h7Pr4SLDT5bVDBpdkNy1uHpOwhdXG9gaAzpncct77 4aVrHIT9PWsxckncz4Q+q10TpqbHcFP1RRZ2nTnPOQswwPzvWOS/ARQTmCJ/fkoS4Ncm EfjsuM+WrnERkSXeXq+HNGBw2XbO74+TVFuFIIch2wvysXOy8ppwxJU9ig0mWWkvTkAT z8avKkuZ8aynojiL946LqaWoOwAWBp6RdvnMPQiAT0bm5QOe+qLiB4IwhEdSRSpAR/pV vhI/A4JKB/ZIsnjf7aAcfiurg7lhFnVXtNZXzltRETSBGrUJVCX07QiqiSgdPj6Yi3G5 bZUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=QYxpL+XnUS5UB2Ui7qcrOxbu+fTcZjWEGOnFGGJMq0w=; fh=HQ7h6YNxNUV0SDy4UeWYdG3JCowRhEmTttiTRQunXZc=; b=d3RIxzkXTLKaDxMyUSY+0CkgXucfemZ7GrpWwJY2MAwwqw+sjKRmUX6xi5yAx8xUn5 2z0lCeq2KvyU8Gdmtz7im7oyPzRkSoIAPV7/CPvl4Z0B47KsXW4fM95xtS4XR5JtwvdE VrAQFXJ9GaAloRtzXYDrJvvXkgyUHjWoLFP76BREOXqeMcJGG/FgVOp2UVASR8XANzdH 0rouDl8sdBRK8KSP20SBvHb8g/syWTtWPRCGLHW78Cua5530QYunCmXoOsmARtT2TNVD 8zFsQ4hL1nJOp/5f5+spbfnD6BMe/Vchf5/vKf/iz9ZiZf2d5WpubikTeAYg2LdMY1qB MiVw==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767722208; x=1768327008; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QYxpL+XnUS5UB2Ui7qcrOxbu+fTcZjWEGOnFGGJMq0w=; b=i/v+mhspmYYRWZL5UHeqx7uEVuojyOIHnb1Lhm3+loxCqyD+4+AoYnJNNGu8CR9jo9 TbTlbcfmSEpX/LebGAQWybe0laWU6RH1NeLhrJWotkfjnP31pKxUbpq4EEOT8HYiX4or eXqJevgssbTiOO1n5Pjq/Q7IbiRcMMdU944HG4OaIrSLsT/zZ0NfivhmE6RM3HYfsfSV HtDYK2HRr/CfmNT70+8KIKbaa5xWL7DiHflmvw/3opCFxtTAXzaLSJ56CIYpxNfjGzBf seIHyOyZxJWug6UKDHbDp+llbV6S8l8aGKpge88tkUu3ygYRiQLzv4eCEaEZzGaH4b+w dS4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767722208; x=1768327008; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QYxpL+XnUS5UB2Ui7qcrOxbu+fTcZjWEGOnFGGJMq0w=; b=ftYzSsg0gsj7Ud1uhZhfvU4pzGdKr3b8YZwe3nlZDFAvikhBi6QlHHBYE4c5tCo9ik 2NfIK6KkMXBwkg596ismit6arbcr1LLeIr+Z90CJRPxXdPz5+CTC6QCUyA42mIdOW3Mk 26kMeWS6FXKjEcnqCak1Q+THVcrEJfHNBJoQ67Qrocf3DI0Yt45+rGpEvee3RE80x/p1 mNpnt6jWh2fTIbCV3/lgr1ZU5fQ99fexCPlucP5cOdI3rW2Rzk5ti/cF94lStf4OR7Dv 8gQj7czhM4cr1YA3ipQ72o2GlVqNgxQ4VsNI1HKRo8GQ3RKxch67AkyCZWyQ0N2Jw9dC BRfQ== X-Forwarded-Encrypted: i=1; AJvYcCXpxdTS3W33uqPd8BOfLWtR9MigYzDZOJUc4W4Qx81mMmAt+v7EyAxtRLVB83QkU7XWj6+GrJfPpkYNac4=@vger.kernel.org X-Gm-Message-State: AOJu0YxZp/RZlm6dj8iAKQvl4snu7Ui+wEVwOs9dhDmgzRZg/puIV5HO FG2zTmD9/pUOLy7oAvK6+A0hFPWCX6Oy0Eatc29e50q6e+jWHCVOskcpnAHF4N6wxA4Vt44JTFl pv2Nq1Kp8LIvEcmySj02CFTFbj8be1zGw/lYhmcq/ X-Gm-Gg: AY/fxX6xOWeGZcrQtGTLPl7HHfqQLwlGq9CDRmHJmIX99ZrOegKM2LTd+JYctGXHRz5 bTYKKCO36arD0KsyW3yWkxMLgDtrcZi+53dsU1KK7j0nRbhiE44w+Kmw9PuCRdFas1cCNpo+8Yw gTNyjSVXzUzRXm1EuDkzBBFQhz6so0Tv/6Wk0Lvd1x/1XzqvFh0wuTU6in03kGOZa2MzB/XDHKL qWN1nxOBg1aZomnWO5ld0j2PLDc6JCvMHMyhF1SAKJrnHuYKv8dP3wUIodJteZt3Wrk4vI= X-Google-Smtp-Source: AGHT+IHKi5u0ZUoIiLDKZvTW1fieJbK4f2Ck1yEd4b1rskSfipnf8lmsJb/sxIxC/QxMT48vm6QhJurThfZqBdXk6DI= X-Received: by 2002:a05:6402:1811:b0:643:6975:537f with SMTP id 4fb4d7f45d1cf-65080907a25mr39042a12.13.1767722208281; Tue, 06 Jan 2026 09:56:48 -0800 (PST) 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> In-Reply-To: From: Jim Mattson Date: Tue, 6 Jan 2026 09:56:35 -0800 X-Gm-Features: AQt7F2ri3iKInZYTA5GeVwZP_koMuCHpRuMrgpaA7xmYZy37HUARMY0JidPig6w Message-ID: Subject: Re: [PATCH 1/4] x86/fpu: Clear XSTATE_BV[i] in save state whenever XFD[i]=1 To: Sean Christopherson 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 5, 2026 at 5:17=E2=80=AFPM Sean Christopherson wrote: > > 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* immediate= ly revert > > > + * the save state to initialized. > > > > 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 th= e APM, > *sigh*), "recommends" that software not rely on state being maintained wh= en 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 stat= e may > have negative power and performance implications and will prevent the e= xecution > of In-Field Scan tests. In addition, software should not rely on the st= ate of > the tile data after setting IA32_XFD[17] or IA32_XFD[18]; software shou= ld always > reload or reinitialize the tile data after clearing IA32_XFD[17] and IA= 32_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 oper= ate correctly > for a variety of reasons. One is that the LDTILECFG and TILERELEASE ins= tructions > 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 TILEDA= TA 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 sta= te, but > it's darn close. > > I'm definitely not opposed to officially documenting KVM's virtual CPU im= plementation, > but IMO calling it an erratum is a bit unfair. Apologies. You're right. Though Intel is a bit coy, the only way to interpret that section of the SDM is to conclude that the AMX state in the CPU becomes undefined when XFD[18] is set.