Closed labrinea closed 1 month ago
@vhscampos @andrewcarlotti @tmatheson-arm
Ok, here's a suggestion that might seem to go against stuff I've previously said. How about we call the FMV feature "memtag2" to deliberately distinguish it from the "memtag" command line option? The justification for this is:
So the FMV feature "memtag2" would deliberately have a slightly different definition to the command line option "memtag". Internally the compiler may choose to handle this by mapping the FMV feature directly to the command line option, with the caveat that enabling the command line option does not necessarily imply that the FMV feature will be enabled at runtime.
(Adding @Wilco1 as well)
My understanding of FEAT_MTE vs FEAT_MTE2 is that (excepting the small number of EL1 instructions that are FEAT_MTE2 only) they offer the same set of instructions, which
As far as the compiler is concerned, there is no difference between FEAT_MTE and FEAT_MTE2. The codegen should be identical. This is probably why they were historically combined into +memtag
. This means that you can compile with +memtag
, and if you have FEAT_MTE, your code will not crash but you won't get any checking, and with FEAT_MTE2 you will get checking. This is also why you can usually configure FEAT_MTE2 at boot, but FEAT_MTE is always on.
FMV complicates the situation because it is for runtime dispatch, and there is a difference between systems that implement FEAT_MTE and FEAT_MTE2. This is why it introduced +memtag
and +memtag2
. The codegen should be the same, but you can do dispatch on them. It's not clear whether that's important.
You might want to detect whether you have FEAT_MTE2 rather than FEAT_MTE in order to use the EL1 instructions. However, apparently FMV targets EL0 which would mean there is no need to support that in FMV.
Since we have gone down the path of keeping FMV names in sync with command line names, I think it would be silly to deviate from that at this point. I suggest we keep memtag
== FEAT_MTE2.
If we're using HWCAPS to control FMV feature gating, then the available HWCAP corresponds to FEAT_MTE2.
I find this argument irrelevant. There are other features we intend to detect with HWCAPS which are available to the user under a different name than the HWCAP macro (HWCAP_PMULL detects "aes" for example), or features whose name corresponds to a different architectural extension (HWCAP_SSBS detects "ssbs" which means FEAT_SSBS2).
If we don't have FEAT_MTE2 at runtime, then the only benefit to using FEAT_MTE instructions would be to avoid runtime dispatch.
Can you explain what do you mean here? I am not getting it.
Since we have gone down the path of keeping FMV names in sync with command line names, I think it would be silly to deviate from that at this point. I suggest we keep memtag == FEAT_MTE2.
I agree.
If we split these features in the compiler (see relevant pull request https://github.com/llvm/llvm-project/pull/109299), we would only be able to hand-write a 'memtag2' version using inline assembly since the compiler cannot generate the instructions that become available with FEAT_MTE2. On top of that these instructions only work at Exception Level 1, so they would be unusable since FMV is a user space facility. I am therefore unifying them in the ACLE specification.
name: Pull request about: Technical issues, document format problems, bugs in scripts or feature proposal.
Thank you for submitting a pull request!
If this PR is about a bugfix:
Please use the bugfix label and make sure to go through the checklist below.
If this PR is about a proposal:
We are looking forward to evaluate your proposal, and if possible to make it part of the Arm C Language Extension (ACLE) specifications.
We would like to encourage you reading through the contribution guidelines, in particular the section on submitting a proposal.
Please use the proposal label.
As for any pull request, please make sure to go through the below checklist.
Checklist: (mark with
X
those which apply)SPDX-FileCopyrightText
lines on top of any file I have edited. Format isSPDX-FileCopyrightText: Copyright {year} {entity or name} <{contact informations}>
(Please update existing copyright lines if applicable. You can specify year ranges with hyphen , as in2017-2019
, and use commas to separate gaps, as in2018-2020, 2022
).Copyright
section of the sources of the specification I have edited (this will show up in the text rendered in the PDF and other output format supported). The format is the same described in the previous item.draftversion
is set totrue
in the YAML header of the sources of the specifications I have modified.