riscv/riscv-isa-manual

`mhartid` wording re. hart ID zero confusing/incorrect?

TommyMurphyTM1234 opened this issue · 3 comments

The latest release of the privilged spec:

has this (emhpasis is mine):

3.1.5. Hart ID (mhartid) Register

The mhartid CSR is an MXLEN-bit read-only register containing the integer ID of the hardware
thread running the code. This register must be readable in any implementation. Hart IDs might not
necessarily be numbered contiguously in a multiprocessor system, but at least one hart must have a
hart ID of zero
. Hart IDs must be unique within the execution environment.

Is "at least one hart must have a hart ID of zero" actually correct? Can more than one hart have an ID of zero? Or is it the case that exactly one hart must have an ID of zero?

The next sentence says "Hart IDs must be unique within the execution environment" which means that more than one hart cannot have an ID of zero.

Thanks @pdonahue-ventana.

The next sentence says "Hart IDs must be unique within the execution environment" which means that more than one hart cannot have an ID of zero.

Yes - I know - that's why I think that "at least one hart must have a hart ID of zero" is unnecessarily confusing and should actually be "exactly one hart must have a hart ID of zero". Why have one sentence specify a looser constraint only for the next sentence to further tighten it up when it can be stated more clearly, concisely and correctly in the first place/sentence?

Also - I wasn't sure if "in a multiprocessor subsystem" and "within the execution environment" were different contexts that mayhe had different constraints in this respect.

The wording seems unnecessarily confusing in my opinion.

I had mentally swapped the original text and your proposed text. I assume that the key lies in the fact that a multiprocessor system may have more than one execution environment, but I'll let others (who know more) address that.