Skip to contentSkip to conversation

powerpc/xmon: symbol lookup length fixed

PATCH Superseded Mukesh Kumar Chaurasiya 2 participants 5 messages Oct 23, 2024 – Oct 25, 2024 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/xmon: symbol lookup length fixed

Currently xmon cannot lookup symbol beyond 64 characters in some cases.

Fix this by using KSYM_NAME_LEN instead of fixed 64 characters.

---
 arch/powerpc/xmon/xmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/xmon/xmon.c +3 -3
index e6cddbb2305f..22b8b5cc4df0 100644
@@ -3662,7 +3662,7 @@ symbol_lookup(void)
 	int type = inchar();
 	unsigned long addr, cpu;
 	void __percpu *ptr = NULL;
-	static char tmp[64];
+	static char tmp[KSYM_NAME_LEN];
 
 	switch (type) {
 	case 'a':
@@ -3671,7 +3671,7 @@ symbol_lookup(void)
 		termch = 0;
 		break;
 	case 's':
-		getstring(tmp, 64);
+		getstring(tmp, KSYM_NAME_LEN);
 		if (setjmp(bus_error_jmp) == 0) {
 			catch_memory_errors = 1;
 			sync();
@@ -3686,7 +3686,7 @@ symbol_lookup(void)
 		termch = 0;
 		break;
 	case 'p':
-		getstring(tmp, 64);
+		getstring(tmp, KSYM_NAME_LEN);
 		if (setjmp(bus_error_jmp) == 0) {
 			catch_memory_errors = 1;
 			sync();
Signature · 1 line
2.47.0
#1 lore raw
Quoted 1 line · Mukesh Kumar Chaurasiya

Currently xmon cannot lookup symbol beyond 64 characters in some cases.

Can you mention which commands? It looks like it's "ls" and "lp".

Quoted 12 lines

Fix this by using KSYM_NAME_LEN instead of fixed 64 characters.

---
 arch/powerpc/xmon/xmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/xmon/xmon.c +0 -0
index e6cddbb2305f..22b8b5cc4df0 100644

arch/powerpc/xmon/xmon.c symbol_lookup(void) · line 3665

Quoted 5 lines
arch/powerpc/xmon/xmon.c +1 -1
@@ -3662,7 +3662,7 @@ symbol_lookup(void)
 	int type = inchar();
 	unsigned long addr, cpu;
 	void __percpu *ptr = NULL;
-	static char tmp[64];
+	static char tmp[KSYM_NAME_LEN];

I think you could use the existing tmpstr buffer.

It is global so it's a little hard to track down all the users, but I think it's only used briefly in get_function_bounds(), xmon_print_symbol() and scanhex(). ie. none of the uses persist across function calls.

We don't want to have two 512 byte static arrays lying around if we can get by with one.

cheers

Quoted 22 lines
arch/powerpc/xmon/xmon.c +2 -2
 	switch (type) {
 	case 'a':
@@ -3671,7 +3671,7 @@ symbol_lookup(void)
 		termch = 0;
 		break;
 	case 's':
-		getstring(tmp, 64);
+		getstring(tmp, KSYM_NAME_LEN);
 		if (setjmp(bus_error_jmp) == 0) {
 			catch_memory_errors = 1;
 			sync();
@@ -3686,7 +3686,7 @@ symbol_lookup(void)
 		termch = 0;
 		break;
 	case 'p':
-		getstring(tmp, 64);
+		getstring(tmp, KSYM_NAME_LEN);
 		if (setjmp(bus_error_jmp) == 0) {
 			catch_memory_errors = 1;
 			sync();
Signature · 1 line
2.47.0
#2 lore raw
Quoted 4 lines · Michael Ellerman
Quoted 1 line · Mukesh Kumar Chaurasiya

Currently xmon cannot lookup symbol beyond 64 characters in some cases.

Can you mention which commands? It looks like it's "ls" and "lp".

Sure.

Quoted 26 lines
Quoted 13 lines

Fix this by using KSYM_NAME_LEN instead of fixed 64 characters.

---
 arch/powerpc/xmon/xmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/xmon/xmon.c +0 -0
index e6cddbb2305f..22b8b5cc4df0 100644

arch/powerpc/xmon/xmon.c symbol_lookup(void) · line 3665

Quoted 5 lines
arch/powerpc/xmon/xmon.c +1 -1
@@ -3662,7 +3662,7 @@ symbol_lookup(void)
 	int type = inchar();
 	unsigned long addr, cpu;
 	void __percpu *ptr = NULL;
-	static char tmp[64];
+	static char tmp[KSYM_NAME_LEN];

I think you could use the existing tmpstr buffer.

It is global so it's a little hard to track down all the users, but I think it's only used briefly in get_function_bounds(), xmon_print_symbol() and scanhex(). ie. none of the uses persist across function calls.

Quoted 4 lines

We don't want to have two 512 byte static arrays lying around if we can get by with one.

cheers

Sure.

Will send out V2.

Quoted 22 lines
Quoted 22 lines
arch/powerpc/xmon/xmon.c +2 -2
 	switch (type) {
 	case 'a':
@@ -3671,7 +3671,7 @@ symbol_lookup(void)
 		termch = 0;
 		break;
 	case 's':
-		getstring(tmp, 64);
+		getstring(tmp, KSYM_NAME_LEN);
 		if (setjmp(bus_error_jmp) == 0) {
 			catch_memory_errors = 1;
 			sync();
@@ -3686,7 +3686,7 @@ symbol_lookup(void)
 		termch = 0;
 		break;
 	case 'p':
-		getstring(tmp, 64);
+		getstring(tmp, KSYM_NAME_LEN);
 		if (setjmp(bus_error_jmp) == 0) {
 			catch_memory_errors = 1;
 			sync();
Signature · 1 line
2.47.0
#3 lore raw
Quoted 32 lines · Mukesh Kumar Chaurasiya
Quoted 4 lines · Michael Ellerman
Quoted 1 line · Mukesh Kumar Chaurasiya

Currently xmon cannot lookup symbol beyond 64 characters in some cases.

Can you mention which commands? It looks like it's "ls" and "lp".

Sure.

Quoted 26 lines
Quoted 13 lines

Fix this by using KSYM_NAME_LEN instead of fixed 64 characters.

---
 arch/powerpc/xmon/xmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/xmon/xmon.c +0 -0
index e6cddbb2305f..22b8b5cc4df0 100644

arch/powerpc/xmon/xmon.c symbol_lookup(void) · line 3665

Quoted 5 lines
arch/powerpc/xmon/xmon.c +1 -1
@@ -3662,7 +3662,7 @@ symbol_lookup(void)
 	int type = inchar();
 	unsigned long addr, cpu;
 	void __percpu *ptr = NULL;
-	static char tmp[64];
+	static char tmp[KSYM_NAME_LEN];

I think you could use the existing tmpstr buffer.

It is global so it's a little hard to track down all the users, but I think it's only used briefly in get_function_bounds(), xmon_print_symbol() and scanhex(). ie. none of the uses persist across function calls.

Quoted 5 lines
Quoted 4 lines

We don't want to have two 512 byte static arrays lying around if we can get by with one.

cheers

Sure.

For now i don't think so we can get by with only one. There is a lookup being done when the scanhex is using the tmpstr for another lookup.

I'll send a V2 with commit message change.

Quoted 25 lines

Will send out V2.

Quoted 22 lines
Quoted 22 lines
arch/powerpc/xmon/xmon.c +2 -2
 	switch (type) {
 	case 'a':
@@ -3671,7 +3671,7 @@ symbol_lookup(void)
 		termch = 0;
 		break;
 	case 's':
-		getstring(tmp, 64);
+		getstring(tmp, KSYM_NAME_LEN);
 		if (setjmp(bus_error_jmp) == 0) {
 			catch_memory_errors = 1;
 			sync();
@@ -3686,7 +3686,7 @@ symbol_lookup(void)
 		termch = 0;
 		break;
 	case 'p':
-		getstring(tmp, 64);
+		getstring(tmp, KSYM_NAME_LEN);
 		if (setjmp(bus_error_jmp) == 0) {
 			catch_memory_errors = 1;
 			sync();
Signature · 1 line
2.47.0
#4 lore raw
Quoted 33 lines · Mukesh Kumar Chaurasiya
Quoted 32 lines · Mukesh Kumar Chaurasiya
Quoted 4 lines · Michael Ellerman
Quoted 1 line · Mukesh Kumar Chaurasiya

Currently xmon cannot lookup symbol beyond 64 characters in some cases.

Can you mention which commands? It looks like it's "ls" and "lp".

Sure.

Quoted 26 lines
Quoted 13 lines

Fix this by using KSYM_NAME_LEN instead of fixed 64 characters.

---
 arch/powerpc/xmon/xmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/xmon/xmon.c +0 -0
index e6cddbb2305f..22b8b5cc4df0 100644

arch/powerpc/xmon/xmon.c symbol_lookup(void) · line 3665

Quoted 5 lines
arch/powerpc/xmon/xmon.c +1 -1
@@ -3662,7 +3662,7 @@ symbol_lookup(void)
 	int type = inchar();
 	unsigned long addr, cpu;
 	void __percpu *ptr = NULL;
-	static char tmp[64];
+	static char tmp[KSYM_NAME_LEN];

I think you could use the existing tmpstr buffer.

It is global so it's a little hard to track down all the users, but I think it's only used briefly in get_function_bounds(), xmon_print_symbol() and scanhex(). ie. none of the uses persist across function calls.

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

We don't want to have two 512 byte static arrays lying around if we can get by with one.

cheers

Sure.

For now i don't think so we can get by with only one. There is a lookup being done when the scanhex is using the tmpstr for another lookup.

Yeah I see it, when handling lp <symbol> <cpu>.

That's a bit annoying because for that command the CPU number is only meant to be a number, it never makes sense to do a $symbol lookup there.

But I agree with the way the code is structured it's best not to reuse tmpstr there.

cheers