Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify CBO for unaligned rs1 #1433

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Clarify CBO for unaligned rs1 #1433

wants to merge 1 commit into from

Conversation

Timmmm
Copy link

@Timmmm Timmmm commented May 29, 2024

Rework the text to be much more explicit about the behaviour when rs1 is not aligned to the cache block size.

I also moved & slightly reworded the note about the assembly syntax since it's not relevant to the instruction semantics.

Fixes #1263

Rework the text to be much more explicit about the behaviour when rs1 is not aligned to the cache block size.

I also moved & slightly reworded the note about the assembly syntax since it's not relevant to the instruction semantics.
relevant *tval CSR is written with the faulting effective address (i.e. the same
faulting address value as for other causes of these exceptions).
relevant *tval CSR is written with the faulting effective address (i.e. the
value of _rs1_).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the part that I endorse. My initial reaction is the other changes are not necessary, and maybe not even desirable, but I'll leave that decision to @dkruckemyer-ventana.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at least the bits about not requiring rs1 to be aligned are needed because that isn't specified anywhere currently (unless I missed it).

Copy link
Collaborator

@ved-rivos ved-rivos Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not think there was an intent to support a CMO for flush/invalidate/clean to operate on multiple cache blocks. Its do not think that was the intent when saying access size is a cache block - I understand the intent was to state that the CMO affects all of the cache block. From that perspective it is more reasonable to think of a CMO.flush/invalidate/clean targets the cache block addressed by rs1 and that cache block may be addressed by specifying any byte of that cache block - but a given CMO operates on the one cache block mapped to the address in rs1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, that's what I meant it to say. Does it sound like it's saying it would operate on multiple cache blocks?

that contains the address specified in _rs1_. It is not required that _rs1_ is
aligned to the size of a cache block. On faults the address stored in the *tval
CSR is _rs1_; not the base address of the cache block. The instruction operates
on the set of coherent caches accessed by the agent executing the instruction.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A CMO to flush/invalidate/clean should take effect even if the cache block is cached in a coherent cache that is not directly accessible to the agent executing the corresponding CMO. For instance, the cache block may be cached in the private cache of a hart should be flushed/invalidated/cleaned if a CMO addressing that cache block was executed by another hart.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does say this elsewhere:

Additionally, if a coherent agent in the set executes a CBO instruction that specifies the cache block, the resulting operation shall apply to any and all of the copies in the caches that can be accessed by the load and store operations from the coherent agents.

So I think it's reasonably clear, but if you want to clarify it more here I think it can go in a separate PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"that can be accessed by the load and store operations" - it could be interpreted that CMO will not operate on private caches of other harts because they cannot be "accessed" by load/store operations performed on the hart that executes the CMO. The other interpretation would be that "accessed" includes forwarding of data from private caches of remote harts to the private cache of the hart executing the load/store. I would like to hear @dkruckemyer-ventana interpretation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that's just an oversight here. The other bit I quoted is much more explicit and clearly agrees with what you said.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rewrite "On faults the address stored in the *tval CSR is rs1; not the base address of the cache block." as "On faults, the faulting virtual address is considered to be the value in rs1, rather than the base address of the cache block."

This improves separation of concerns, because faulting virtual addresses might end up in places other than *tval.

@Timmmm
Copy link
Author

Timmmm commented Jul 26, 2024

@ved-rivos @dkruckemyer-ventana any objection to merging this? I think the points Ved raised above are pre-existing issues (unless I've misunderstood) and therefore can be addressed in another PR.

operation.
that contains the address specified in _rs1_. It is not required that _rs1_ is
aligned to the size of a cache block. On faults the address stored in the *tval
CSR is _rs1_; not the base address of the cache block. The instruction operates
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corresponding to the cache block that contains the address specified in _rs1_.
It is not required that _rs1_ is aligned to the size of a cache block. On
faults the address stored in the *tval CSR is _rs1_; not the base address of
the cache block. An implementation may or may not update the entire set of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK with it after the minor suggestions I made, but I still want @dkruckemyer-ventana to sign off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specify mtval for unaligned CMOs
3 participants