Skip to contentSkip to conversation

fix phys. address conversion in ia64_pal_tr_read

PATCH In review Jesse Barnes 2 participants 4 messages Nov 16, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix phys. address conversion in ia64_pal_tr_read

The palinfo module may call ia64_pal_tr_read using an IPI. If the processor receiving the IPI is idle, the call will fail since the idle process stack is in region 5 and ia64_pal_tr_read uses __pa rather than ia64_tpa. This small patch fixes the problem by making it use ia64_tpa instead.

Thanks,
Jesse

===== include/asm-ia64/pal.h 1.9 vs edited =====

include/asm-ia64/pal.h +1 -1
@@ -1531,7 +1531,7 @@
 ia64_pal_tr_read (u64 reg_num, u64 tr_type, u64 *tr_buffer, pal_tr_valid_u_t *tr_valid)
 {
 	struct ia64_pal_retval iprv;
-	PAL_CALL_PHYS_STK(iprv, PAL_VM_TR_READ, reg_num, tr_type,(u64)__pa(tr_buffer));
+	PAL_CALL_PHYS_STK(iprv, PAL_VM_TR_READ, reg_num, tr_type,(u64)ia64_tpa(tr_buffer));
 	if (tr_valid)
 		tr_valid->piv_val = iprv.v0;
 	return iprv.status;
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Jesse Barnes

Jesse> The palinfo module may call ia64_pal_tr_read using an IPI. Jesse> If the processor receiving the IPI is idle, the call will Jesse> fail since the idle process stack is in region 5 and Jesse> ia64_pal_tr_read uses __pa rather than ia64_tpa. This small Jesse> patch fixes the problem by making it use ia64_tpa instead.

Perhaps its worthwhile to do any audit for this kind of problems? It may not be very difficult to hack sparse to add a check for __pa() calls on (stack-)local variables.

	--david
#2 lore raw
In reply to Jesse Barnes
Quoted 9 lines · David Mosberger
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

On Mon, 15 Nov 2004 17:22:41 -0800, Jesse Barnes
<[email protected]> said:

Jesse> The palinfo module may call ia64_pal_tr_read using an IPI. Jesse> If the processor receiving the IPI is idle, the call will Jesse> fail since the idle process stack is in region 5 and Jesse> ia64_pal_tr_read uses __pa rather than ia64_tpa. This small Jesse> patch fixes the problem by making it use ia64_tpa instead.

Quoted 3 lines

Perhaps its worthwhile to do any audit for this kind of problems? It may not be very difficult to hack sparse to add a check for __pa() calls on (stack-)local variables.

I didn't see anything obvious in a quick check of all the ia64 users of __pa (they were mostly referring to stuff in the static data section), but I may have missed something.

Jesse

#3 lore raw
In reply to Jesse Barnes
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Jesse Barnes
Quoted 2 lines · David Mosberger
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

On Mon, 15 Nov 2004 17:22:41 -0800, Jesse Barnes >>>>>

<[email protected]> said:

Jesse> The palinfo module may call ia64_pal_tr_read using an IPI. Jesse> If the processor receiving the IPI is idle, the call will Jesse> fail since the idle process stack is in region 5 and Jesse> ia64_pal_tr_read uses __pa rather than ia64_tpa. This small Jesse> patch fixes the problem by making it use ia64_tpa instead.

Quoted 3 lines
Quoted 3 lines

Perhaps its worthwhile to do any audit for this kind of
problems? It may not be very difficult to hack sparse to add a check for __pa() calls on (stack-)local variables.

Jesse> I didn't see anything obvious in a quick check of all the Jesse> ia64 users of __pa (they were mostly referring to stuff in Jesse> the static data section), but I may have missed something.

OK, thanks for looking!

	--david