[Lldb-commits] [lldb] [lldb][AArch64] Read SME2's ZT0 register from Linux core files (PR #70934)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 1 06:07:15 PDT 2023


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/70934

The ZT0 register is always 64 bytes in size so it is a lot easier to handle than ZA which is scalable. In addition, reading an inactive ZT0 via ptrace returns all 0s, unlike ZA which returns no register data.

This means that a corefile from a process where ZA and ZT0 were inactive still contains an NT_ARM_ZT note and we can simply say that if it's there, then we should be able to read from it.

Along the way I removed a redundant check on the size of the ZA note. If that note's size is < the ZA header size, we do not have SME, and therefore could not have SME2 either.

I have added ZT0 to the existing SME core files tests. This means that you need an SME2 system to generate them (Arm's FVP at this point). I think this is a fair tradeoff given that this is all running in simulation anyway and seperate ZT0 tests would be 99% identical copies of the ZA only tests.

>From cb4ccd594c948548d4e906391e45f65809c2f2aa Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 6 Oct 2023 17:26:44 +0100
Subject: [PATCH] [lldb][AArch64] Read SME2's ZT0 register from Linux core
 files

The ZT0 register is always 64 bytes in size so it is a lot easier
to handle than ZA which is scalable. In addition, reading an
inactive ZT0 via ptrace returns all 0s, unlike ZA which returns
no register data.

This means that a corefile from a process where ZA and ZT0 were
inactive still contains an NT_ARM_ZT note and we can simply say that
if it's there, then we should be able to read from it.

Along the way I removed a redundant check on the size of the ZA note.
If that note's size is < the ZA header size, we do not have SME,
and therefore could not have SME2 either.

I have added ZT0 to the existing SME core files tests. This means
that you need an SME2 system to generate them (Arm's FVP at this point).
I think this is a fair tradeoff given that this is all running in
simulation anyway and seperate ZT0 tests would be 99% identical
copies of the ZA only tests.
---
 .../RegisterContextPOSIXCore_arm64.cpp        |  36 +++++++++++-------
 .../elf-core/RegisterContextPOSIXCore_arm64.h |   1 +
 .../TestAArch64LinuxSMECoreFile.py            |   5 +++
 .../aarch64/sme_core_file/core_0_16_32_1      | Bin 20480 -> 20480 bytes
 .../aarch64/sme_core_file/core_0_32_16_0      | Bin 20480 -> 20480 bytes
 .../aarch64/sme_core_file/core_1_16_32_0      | Bin 20480 -> 20480 bytes
 .../aarch64/sme_core_file/core_1_32_16_1      | Bin 20480 -> 20480 bytes
 .../linux/aarch64/sme_core_file/generate.sh   |   9 +++++
 .../API/linux/aarch64/sme_core_file/main.c    |  29 +++++++++++---
 9 files changed, 61 insertions(+), 19 deletions(-)
 create mode 100644 lldb/test/API/linux/aarch64/sme_core_file/generate.sh

diff --git a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
index db37b7cbb99d7e8..85073b56f64bf79 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
@@ -54,6 +54,13 @@ RegisterContextCorePOSIX_arm64::Create(Thread &thread, const ArchSpec &arch,
   if (mte_data.GetByteSize() >= sizeof(uint64_t))
     opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskMTE);
 
+  DataExtractor zt_data = getRegset(notes, arch.GetTriple(), AARCH64_ZT_Desc);
+  // Although ZT0 can be in a disabled state like ZA can, the kernel reports
+  // its content as 0s in that state. Therefore even a disabled ZT0 will have
+  // a note containing those 0s. ZT0 is a 512 bit / 64 byte register.
+  if (zt_data.GetByteSize() >= 64)
+    opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskZT);
+
   auto register_info_up =
       std::make_unique<RegisterInfoPOSIX_arm64>(arch, opt_regsets);
   return std::unique_ptr<RegisterContextCorePOSIX_arm64>(
@@ -98,6 +105,9 @@ RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(
   if (m_register_info_up->IsMTEPresent())
     m_mte_data = getRegset(notes, target_triple, AARCH64_MTE_Desc);
 
+  if (m_register_info_up->IsZTPresent())
+    m_zt_data = getRegset(notes, target_triple, AARCH64_ZT_Desc);
+
   ConfigureRegisterContext();
 }
 
@@ -298,19 +308,7 @@ bool RegisterContextCorePOSIX_arm64::ReadRegister(const RegisterInfo *reg_info,
     if (m_za_data.GetByteSize() < sizeof(sve::user_za_header))
       return false;
 
-    if (!IsSMEZA(reg)) {
-      offset = reg_info->byte_offset - m_register_info_up->GetSMEOffset();
-      assert(offset < sizeof(m_sme_pseudo_regs));
-      // Host endian since these values are derived instead of being read from a
-      // core file note.
-      value.SetFromMemoryData(
-          *reg_info, reinterpret_cast<uint8_t *>(&m_sme_pseudo_regs) + offset,
-          reg_info->byte_size, lldb_private::endian::InlHostByteOrder(), error);
-    } else {
-      // If the process did not have the SME extension.
-      if (m_za_data.GetByteSize() < sizeof(sve::user_za_header))
-        return false;
-
+    if (m_register_info_up->IsSMERegZA(reg)) {
       // Don't use the size of the note to tell whether ZA is enabled. There may
       // be non-register padding data after the header. Use the embedded
       // header's size field instead.
@@ -339,6 +337,18 @@ bool RegisterContextCorePOSIX_arm64::ReadRegister(const RegisterInfo *reg_info,
       value.SetFromMemoryData(*reg_info, src + sizeof(sve::user_za_header),
                               reg_info->byte_size, lldb::eByteOrderLittle,
                               error);
+    } else if (m_register_info_up->IsSMERegZT(reg)) {
+      value.SetFromMemoryData(*reg_info, m_zt_data.GetDataStart(),
+                              reg_info->byte_size, lldb::eByteOrderLittle,
+                              error);
+    } else {
+      offset = reg_info->byte_offset - m_register_info_up->GetSMEOffset();
+      assert(offset < sizeof(m_sme_pseudo_regs));
+      // Host endian since these values are derived instead of being read from a
+      // core file note.
+      value.SetFromMemoryData(
+          *reg_info, reinterpret_cast<uint8_t *>(&m_sme_pseudo_regs) + offset,
+          reg_info->byte_size, lldb_private::endian::InlHostByteOrder(), error);
     }
   } else
     return false;
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
index 86bdeb426ab3fe0..95527af74fb5334 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
@@ -60,6 +60,7 @@ class RegisterContextCorePOSIX_arm64 : public RegisterContextPOSIX_arm64 {
   lldb_private::DataExtractor m_tls_data;
   lldb_private::DataExtractor m_za_data;
   lldb_private::DataExtractor m_mte_data;
+  lldb_private::DataExtractor m_zt_data;
 
   SVEState m_sve_state = SVEState::Unknown;
   uint16_t m_sve_vector_length = 0;
diff --git a/lldb/test/API/linux/aarch64/sme_core_file/TestAArch64LinuxSMECoreFile.py b/lldb/test/API/linux/aarch64/sme_core_file/TestAArch64LinuxSMECoreFile.py
index f65e64f9db739ae..a5fdd0ab2068cbb 100644
--- a/lldb/test/API/linux/aarch64/sme_core_file/TestAArch64LinuxSMECoreFile.py
+++ b/lldb/test/API/linux/aarch64/sme_core_file/TestAArch64LinuxSMECoreFile.py
@@ -89,14 +89,19 @@ def check_corefile(self, corefile):
             # Each row of ZA is set to the row number plus 1. For example:
             # za = {0x01 0x01 0x01 0x01 <repeat until end of row> 0x02 0x02 ...
             make_row = repeat_bytes
+            expected_zt0 = "{{{}}}".format(
+                " ".join(["0x{:02x}".format(i + 1) for i in range(512 // 8)])
+            )
         else:
             # When ZA is disabled lldb shows it as 0s.
             make_row = lambda _, n: repeat_bytes(0, n)
+            expected_zt0 = "{{{}}}".format(" ".join(["0x00" for i in range(512 // 8)]))
 
         expected_za = "{{{}}}".format(
             " ".join([make_row(i + 1, svl) for i in range(svl)])
         )
         self.expect("register read za", substrs=[expected_za])
+        self.expect("register read zt0", substrs=[expected_zt0])
 
     @skipIfLLVMTargetMissing("AArch64")
     def test_sme_core_file_ssve_vl32_svl16_za_enabled(self):
diff --git a/lldb/test/API/linux/aarch64/sme_core_file/core_0_16_32_1 b/lldb/test/API/linux/aarch64/sme_core_file/core_0_16_32_1
index b7c6250324cc21e121506a4027737fcf6c79693f..b7345748c36374141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ELGMG``4A}UCN1#7G+RNI2}U<!8*
zG@}PErXkS-+5}w>keJ9#5{Ys#v4#W;8ZRC&CVm8yIy*Z{#G^XN?!4cd_ukCD`R{02
z7)=Wk7m(GJ>fehRSIL^>N at bnoA+m{UO&r~*d1Ijk+2pi0lgp*tPSP%5x#kRqF$(xB
zhgk~#-(l2*3WVip69N=)56`)SusG3^Ax}}gJk6XhONc`(mgjgxDqCdpgE1D(tQ#Vh
zVR_y-&?C`jJ0}2SX%L%<TPhWQSOg--d#sq}ZrwsZ)GuwXc&ogli2(T{`hfsm*s}Y&
zx_A_w%!C}dEqN-NSEr@`yptzcthfJEOpi<yG%~+#>tj)2U2G|v`?kW0pXLE+&b?-W
zgLKNxp-so7`GM-laGX^#Ue#(iJTh2yH5$1R9Eel6*ssQevABBF->!y3L&FI*5Qq+3
zZm3gZgTcOmNHo}YDHIN>tPrljo(5cd0DCa`EYIv>eFdoH8{l%oaB$AiK^By1T?s#x
zDv at 3k*`K#V$Bw+-y7_hElS($ipC@&5C+Ata(N8<)H#D9s<uwXli7Vfo<c)G{ZWvIV
z>5T<28f+$;3=YF at o)MV*XgE_I-$|cLW+DXWraEAQGbEWH4Pmea&cL(@aNbN{@}v=S
z-R!1~Dmv?$qchVUfZJT)3~R=E8TYG$LveK^6pi;qBN2LY$$z*<__Nqw)ao=v at jr@%
zgIcepRL~LyO-QVzf9(@1Mv6tdR-_1I$+itihOK=syoD at Y+7k>QfabA_h>TlZB;za=
zse^dzPO{>((nr!hIp2%g?xOMX$KC|0eDJDnW?_2$<Mq33nZo-*{j=Cun?idl@&0z`
u;@54NOt$vO%SXi5K27i)6qwnn9X at u*Fn#3a at h{vteBvGwJX&e{2jv$*_Mf%@

diff --git a/lldb/test/API/linux/aarch64/sme_core_file/core_0_32_16_0 b/lldb/test/API/linux/aarch64/sme_core_file/core_0_32_16_0
index cba6c0f0738370ab858b1d796bce8584238d6501..713fb2384a29f4384d916cac272dd74d47be99da 100644
GIT binary patch
delta 1045
zcm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=T5)>e}G)a?<T2tw>d>?{XNRpx)y!
zL7{yG+_La1u&Sg5_$jEv{Ky at wN<+hg<Rz|G(k%F{m^h?$$|T>B%oN$%!CKSe)MZIk
z5=HaYd!9+Y%3}y1LpKS_55VVA;aPTWfgoj5-ZEdS^D^YHT)KAVMlmf0klk-S65#Ev
z*GEZ0-YBiPK1fF8vWnUC*cgC!<R(jdyN*Q7da>LLi;Fv^ZDu2z%TqC{TqDmXICqHs
z4$`LV42s7J>-U8FbWw|1j}{8`_iViw310|w>lDs*X?h^4YkS&TwNS9PFQ)nZk?!*i
zby~D1(Agc11Uk<JLjjEyQmfV4ZE8&ewdAWZzJYZYpq5{tZnhi;XR{+@%I2Y3Sh9H}
zIxSL_RYvJx*6F&@E7k`U|JwW}Zo2C^Pu#Zh1)Rs}e)2J^5q&3x+3q;+lH>Po!Qu?>
zp4DA(7{Fq1SXR6cm;&hyOnm$%(+Fld1UNypz!qnSGfe^<7YWXgu%>-V#F<3t(a8sF
z%)AU`Q+Je@{s7z}!5J2<d^wM6J-xctAB^aok#LyKE&dNvgg=Y at MXfd=iT_b76fin+
zN{|uD-GQZA`scn_rD9u-k#yM*@w#L(XLn$Eg^eHiX*tJBdqd}lfYcN?jr+OTm`oSC
zFd(DJrB^)n#&G51_jTh_>7|8B!!1wqAEEkJ(Sa5l?WoMVddL*K=__Pp?@8s;Zs~*1
hK)&sWxqFS~eY-5zN3QPw#)Ewa9%58ul(f#<egX@)rXK(R

diff --git a/lldb/test/API/linux/aarch64/sme_core_file/core_1_16_32_0 b/lldb/test/API/linux/aarch64/sme_core_file/core_1_16_32_0
index dcda36c862bfb6643ee8ba28685a2ef90d8c075f..9d6efd7f9c7510f26d32f9e26147be0077e1dfd1 100644
GIT binary patch
delta 1451
zcmZwFO=uit7zglYX5N`B$xJ%gueOOKv+;v8w8_>FTC~!)M#VrV+k+5W50g+KJ!m6s
zq#mT>K|OfLW**Uca_|F7shD;TRcK+bJ$O*r9s~;!$AdS)1-%G`^*=N31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q9LHz&MR^pq^brJuQ@{s=vaLL96l0|-HX)=QOi)R%U=1~ens&i at FfIQ9
z&76#hAtW{iH9^+{BqrjCAVj%%sG8`-c*U4_kpyRFXYg at U=klA+?=`c(`EGs==I7w-
zWue_!7(FDct>P`oT_`#6L%}X?y=3SW)^`KFf?b}gDDLbOyiOc}NcJNJGX#*A!7_p9
zuaM`^Dj<20LyQ1wVKuh}B+j-J at iU=YUZl=f^;i}6$SW+PP^z;>fweYy)lHGKD7~;Q
z^jHkHU4Q_TND{ZK0HA8Vv+Nx=hEfCeOO;hSY&j~)1ftSj*V_Z{NJju{)8<V9SohT`
zI4|uNYb%TRzSP*ZzPhjgKxn>}hC`$0GG^0k#TxbVgEkd9(cY#gvib#Cf}im)FHrHI
zd^EwY%x$bAHKp at r#CB-O<n)B^dOCG2KBg16GOFqEjIN!GMzmyNaw at CEV(GE*o-Qpj
z5g!>#rQ;)46Un$n8=(LS^q|he$dB+Bd8wJs7=TW806J)GRL15^@P^W1s$yI5iR966
zds(B217*WqLoL=P)$gXS=FIIr#><)&uVFk+^6~q!ApC~iHgAp%O8tFcfN0JfESWg9
zyqGgkEkC~_pi(61RE6v$({QGOw6s8 at j6sfy6M!Ki7P=S%s#5?iaX*zR$yjNoFU_(E
zoBAU}bqIi$2N;7bE8fKX+Qg);O()X&NII1wFPHm=cLaYn`-@(KTonJKSu$=6mp4Eo
zTj3J0-&3bT34npf;Q1l)^{A8l(od_9pp+X0j{<SXBjJyBRgiwNv0WWBD_!`k!&M$4
zLqh;ShyyiFoOjraydx-KpQMsn8{Tw#1OSa*kKXzuloi?@yzW}sSp5F^#@+r$)kWC-
zJTud;kb}t`=o&Ep3v(yq`M!(thZEwPumQtIAl>#E$4?!zwqbnh^jGGbI&)8e0iz-E
GN%;ZW^rb%l

diff --git a/lldb/test/API/linux/aarch64/sme_core_file/core_1_32_16_1 b/lldb/test/API/linux/aarch64/sme_core_file/core_1_32_16_1
index 7ec49584f2b64245c1990ac8b54f083e62f64aa2..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05%OHU_knx~Yn`*luGVR;?HtwG>K;U_oo4Nn at muw9zE3@gQmO
z=p|wBP_d;52B`|s_0WQ#HwF7b at DQoki+U2{0}&L~+1c4*J*s>8=J(C_nEB?vqf=;f
z3Z?y=r7Y9Gi<{5kg5b>L9r!M1<qHc8UEJd8Mk{9(m#$<rE#q?F4kU~IaRy at qeAgMw
z5*Ym*awb%BvbbVGfPim;<&1MO|70SIA8}3M3Uw}&V>`cDEU<`7ev{P)?3-j+mv~a|
z^OA9(`@GlMg8=d*h+6CtDtNyQVI=Ob*jZ}XI&x8;u%-IdyRRe>pg5}^2;ljLeg5ul
zvjc#cpy6wRyJj&rJq_S_ah1k;`j5x;$Ykj}^_y8s5}jgeRW5H7KfwahjC;)lJMI$q
zhu0jJ6baNthZANoV(XMhWMr`Rd at On{6ig5})2}2#@q}{N*P%qhL&HfW5Qqf_nj4k)
zV5lz`jfMKoh9e<`7Lwg^!yeh)Of3E+&TOM|1!!Om<ekQ1^`e at l;W?>JSHe%JmM0H|
zcNbOa*jd!uIP==LQaMZ4w5KV3xs~zkM`Pc{_!)`E%SA2d8+I1EQfyH6wF3j9GkvfC
z#(>RalfiEI%`*a(9|@<*W1VzkG8G}fDWU`VF at _WsB)~~?gE3HT0-QGeRGuWYaD%=y
zD??b<p-#H?09>mZ27_$aD&|)PhZ4$2IF{&(MWf{9QvdLd at Mp2VsMTeP;(rv2gw)=W
z3Zy1WH*$i0VVt(O_#pXxA6jHiDp4;uC4`r)WY<`$-`BUY$d(P;OFU#s<V6uu-8P=X
z1CDyE2zGqiQON;P>umy3WoNqPfhWn;+*xd#nallne{r(?-uf(RdK at 2Xmq<(6m)K7I
vFVN2*;+t(f;+sSKORtK&dl6l>sRxf7FqU3?`REts96ol7LvFRA<E``yfP$_{

diff --git a/lldb/test/API/linux/aarch64/sme_core_file/generate.sh b/lldb/test/API/linux/aarch64/sme_core_file/generate.sh
new file mode 100644
index 000000000000000..5e75a5cdb8bd03b
--- /dev/null
+++ b/lldb/test/API/linux/aarch64/sme_core_file/generate.sh
@@ -0,0 +1,9 @@
+run () {
+  ./a.out "$@"
+  mv core core_$(echo "$*" | sed 's/ /_/g')
+}
+
+run 0 16 32 1
+run 0 32 16 0
+run 1 16 32 0
+run 1 32 16 1
diff --git a/lldb/test/API/linux/aarch64/sme_core_file/main.c b/lldb/test/API/linux/aarch64/sme_core_file/main.c
index 21793a4ad63d39e..10fc92ba2fcabe0 100644
--- a/lldb/test/API/linux/aarch64/sme_core_file/main.c
+++ b/lldb/test/API/linux/aarch64/sme_core_file/main.c
@@ -1,16 +1,21 @@
 // clang-format off
 // Compile with:
-// clang -target aarch64-unknown-linux-gnu main.c -o a.out -g -march=armv8.6-a+sve+sme
+// clang -target aarch64-unknown-linux-gnu main.c -o a.out -g -march=armv8.6-a+sve+sme+sme2
 //
 // For minimal corefile size, do this before running the program:
-// echo 0x20 > /proc/self/coredeump_filter
+// echo 0x20 > /proc/self/coredump_filter
 //
-// Must be run on a system that has SVE and SME, including the smefa64
-// extension. Example command:
-// main 0 32 64 1
+// Must be run on a system that has SVE, SME and SME2, including the smefa64
+// extension.
+//
+// Example command:
+// ./a.out 0 32 64 1
 //
 // This would not enter streaming mode, set non-streaming VL to 32
-// bytes, streaming VL to 64 bytes and enable ZA.
+// bytes, streaming VL to 64 bytes and enable ZA and ZT0.
+//
+// To generate all the test files, use the generate.sh script that's in this
+// folder.
 // clang-format on
 
 #include <stdbool.h>
@@ -94,6 +99,17 @@ void set_za_register(int streaming_vl) {
                  "r"(&data)
                  : "w12");
   }
+#undef MAX_VL_BYTES
+}
+
+void set_zt0_register() {
+#define ZTO_LEN (512 / 8)
+  uint8_t data[ZTO_LEN];
+  for (unsigned i = 0; i < ZTO_LEN; ++i)
+    data[i] = i + 1;
+
+  asm volatile("ldr zt0, [%0]" ::"r"(&data));
+#undef ZT0_LEN
 }
 
 void set_tpidr2(uint64_t value) {
@@ -132,6 +148,7 @@ int main(int argc, char **argv) {
   if (strcmp(argv[4], "1") == 0) {
     SMSTART_ZA;
     set_za_register(streaming_vl);
+    set_zt0_register();
   }
 
   *(volatile char *)(0) = 0; // Crashes here.



More information about the lldb-commits mailing list