CPUID leaf 1 bit "HTT" does not mean what it says on the tin

オープン
#1,265 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
cloud

調査の方向性

The CPUID leaf 1 specializer lives in lib/propolis/src/cpuid.rs, where HTT is currently set from has_smt; the topology helpers referenced via #1237 also pass has_smt: true. Read the APM and SDM notes on LogicalProcessorCount and HTT to decide the intended semantics before editing. Done means HTT is set whenever more than one logical processor is exposed, with the specializer and any affected tests updated accordingly.

索引モデルが issue の本文から書いたものです。

説明

bug

we set HTT in the CPUID specializer, here. this will imminently change in form, but not function, with #1237. fundamentally, the interpretation of "HTT", called "Hyper-Threading Technology" in the SDM, was "present if hyperthreading is supported".

now, I remember puzzling over this a bit with Greg when this was first being added; you would imagine that that if SMT is not enabled, clearly HTT should be false, right? other parts of the SDM and APM say that some other topology bits are only valid if HTT is set though. the APM, in particular, says that leaf 1 EBX's LogicalProcessorCount is only meaningful if HTT is set.

additionally,

Multiple Processor Calculation says "When HTT = 0, LogicalProcessorCount is reserved and the package contains one logical processor."

well, that's certainly different from how we're setting it. spelunking through docs and blogs with @acfoltzer, we've found https://github.com/InstLatx64/InstLatx64/tree/refs/heads/master/AuthenticAMD (and the corresponding GenuineIntel CPUID readings) point towards a more expansive use of HTT - the bit first was set in the earliest Pentium 4's that supported HyperThreading, and then is set on all x86 processors after that point with >1 logical processor. this writeup on os2museum.com is great reading with some quotes from older SDMs. AMD set it in the non-SMT multi-core Athlon X2s, even! truly, this bit means "there is more than one processor", and should not be connected to has_smt at all.

.. this has no product implication, as it turns out. we always passed true for the old .with_vcpu_count(), and the topology helpers in #1237 both have has_smt: true as well. so guests in the product always have the HTT bit set (even in single-core VMs, which it turns out is probably legal in practice but not strictly what the APM says).

since we always populate LogicalProcessorCount, NC, and other fields via the specializer, we should probably just always set leaf 1 HTT.

主要言語
Rust
スター
326
フォーク
49
平均マージ
1日 13時間
マージ済み PR(30日)
10

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

oxidecomputer/propolis のほかの issue

oxidecomputer/propolis の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。