Skip to contentSkip to conversation

KVM: arm64: Improve out-of-order sysreg table diagnostics

PATCH Applied Marc Zyngier 2 participants 3 messages Apr 10, 2024 – Apr 14, 2024

Subsystems (2)
lore
Share & tools
lore

Marc Zyngier

author maintainer
#0 lore raw

PATCH 1/1 KVM: arm64: Improve out-of-order sysreg table diagnostics

Adding new entries to our system register tables is a painful exercise, as we require them to be ordered by Op0,Op1,CRn,CRm,Op2.

If an entry is misordered, we output an error that indicates the pointer to the entry and the number *of the last valid one*.

That's not very helpful, and would be much better if we printed the number of the *offending* entry as well as its name (which is present in the vast majority of the cases).

This makes debugging new additions to the tables much easier.

---
 arch/arm64/kvm/sys_regs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/kvm/sys_regs.c +4 -2
index a23f4e935a2e..60f548d8572e 100644
@@ -3920,12 +3920,14 @@ static bool check_sysreg_table(const struct sys_reg_desc *table, unsigned int n,
 
 	for (i = 0; i < n; i++) {
 		if (!is_32 && table[i].reg && !table[i].reset) {
-			kvm_err("sys_reg table %pS entry %d lacks reset\n", &table[i], i);
+			kvm_err("sys_reg table %pS entry %d (%s) lacks reset\n",
+				&table[i], i, table[i].name);
 			return false;
 		}
 
 		if (i && cmp_sys_reg(&table[i-1], &table[i]) >= 0) {
-			kvm_err("sys_reg table %pS entry %d out of order\n", &table[i - 1], i - 1);
+			kvm_err("sys_reg table %pS entry %d (%s -> %s) out of order\n",
+				&table[i], i, table[i - 1].name, table[i].name);
 			return false;
 		}
 	}
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Marc Zyngier

Adding new entries to our system register tables is a painful exercise, as we require them to be ordered by Op0,Op1,CRn,CRm,Op2.

If an entry is misordered, we output an error that indicates the pointer to the entry and the number *of the last valid one*.

Quoted 7 lines

That's not very helpful, and would be much better if we printed the number of the *offending* entry as well as its name (which is present in the vast majority of the cases).

This makes debugging new additions to the tables much easier.

Thanks.

author maintainer Applied
#2 lore raw
In reply to Marc Zyngier
Quoted 11 lines · Marc Zyngier

Adding new entries to our system register tables is a painful exercise, as we require them to be ordered by Op0,Op1,CRn,CRm,Op2.

If an entry is misordered, we output an error that indicates the pointer to the entry and the number *of the last valid one*.

That's not very helpful, and would be much better if we printed the number of the *offending* entry as well as its name (which is present in the vast majority of the cases).

[...]

Applied to next, thanks!

[1/1] KVM: arm64: Improve out-of-order sysreg table diagnostics

      commit: a88a9ec1729a4687370856567919e1ab79a02483

Cheers,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.