* RE: [patch] ia64: fix potential NaT bit error for sys_pipe().
2005-01-19 7:12 [patch] ia64: fix potential NaT bit error for sys_pipe() David Mosberger
@ 2005-01-20 17:52 ` David Mosberger
2005-01-20 19:00 ` Seth, Rohit
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: David Mosberger @ 2005-01-20 17:52 UTC (permalink / raw)
To: linux-ia64
Tony,
Please disregard the patch named in $SUBJECT. It appears to be
breaking light-weight syscalls. That's rather odd, but since Rohit
has some better ideas on how to fix this issue, I'd rather drop this
patch for the time being (the root problem is still there and IMHO,
needs to be fixed urgently).
--david
^ permalink raw reply [flat|nested] 11+ messages in thread* RE: [patch] ia64: fix potential NaT bit error for sys_pipe().
2005-01-19 7:12 [patch] ia64: fix potential NaT bit error for sys_pipe() David Mosberger
2005-01-20 17:52 ` David Mosberger
@ 2005-01-20 19:00 ` Seth, Rohit
2005-01-20 23:22 ` Seth, Rohit
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Seth, Rohit @ 2005-01-20 19:00 UTC (permalink / raw)
To: linux-ia64
David Mosberger <mailto:davidm@napali.hpl.hp.com> wrote on Thursday,
January 20, 2005 9:53 AM:
> Tony,
>
> Please disregard the patch named in $SUBJECT. It appears to be
> breaking light-weight syscalls. That's rather odd, but since Rohit
> has some better ideas on how to fix this issue, I'd rather drop this
> patch for the time being (the root problem is still there and IMHO,
> needs to be fixed urgently).
>
> --david
I will send out the first rev of patch today to address the
functionality issue. This patch will not worry about exporting the NAT
bits in r8-r11 to user. So, the ld.fills will be replaced by simple ld.
Though, as per the disussions with David, there is scope of further
optimization in the way we are saving/restoring r8-r11 in this code.
This will probably need little more analysis to ensure best
placement/scheduling of new code. Will send that later...
Thanks,
-rohit
^ permalink raw reply [flat|nested] 11+ messages in thread* RE: [patch] ia64: fix potential NaT bit error for sys_pipe().
2005-01-19 7:12 [patch] ia64: fix potential NaT bit error for sys_pipe() David Mosberger
2005-01-20 17:52 ` David Mosberger
2005-01-20 19:00 ` Seth, Rohit
@ 2005-01-20 23:22 ` Seth, Rohit
2005-01-20 23:51 ` David Mosberger
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Seth, Rohit @ 2005-01-20 23:22 UTC (permalink / raw)
To: linux-ia64
Seth, Rohit <> wrote on Thursday, January 20, 2005 11:01 AM:
> David Mosberger <mailto:davidm@napali.hpl.hp.com> wrote on Thursday,
> January 20, 2005 9:53 AM:
>
>> Tony,
>>
>> Please disregard the patch named in $SUBJECT. It appears to be
>> breaking light-weight syscalls. That's rather odd, but since Rohit
>> has some better ideas on how to fix this issue, I'd rather drop this
>> patch for the time being (the root problem is still there and IMHO,
>> needs to be fixed urgently).
>>
>> --david
>
> I will send out the first rev of patch today to address the
> functionality issue. This patch will not worry about exporting the
> NAT bits in r8-r11 to user. So, the ld.fills will be replaced by
> simple ld.
>
We are also thinking of reseting the mfh bit on every syscall entry as
an optimization.
Comments?
Thanks, rohit
^ permalink raw reply [flat|nested] 11+ messages in thread* RE: [patch] ia64: fix potential NaT bit error for sys_pipe().
2005-01-19 7:12 [patch] ia64: fix potential NaT bit error for sys_pipe() David Mosberger
` (2 preceding siblings ...)
2005-01-20 23:22 ` Seth, Rohit
@ 2005-01-20 23:51 ` David Mosberger
2005-01-21 3:32 ` Chen, Kenneth W
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: David Mosberger @ 2005-01-20 23:51 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 20 Jan 2005 15:22:59 -0800, "Seth, Rohit" <rohit.seth@intel.com> said:
Rohit> We are also thinking of reseting the mfh bit on every syscall
Rohit> entry as an optimization.
Rohit> Comments?
Sounds OK with me. We should delete this comment from process.c then,
too:
/*
* NOTE: The calling convention considers all floating point
* registers in the high partition (fph) to be scratch. Since
* the only way to get to this point is through a system call,
* we know that the values in fph are all dead. Hence, there
* is no need to inherit the fph state from the parent to the
* child and all we have to do is to make sure that
* IA64_THREAD_FPH_VALID is cleared in the child.
*
* XXX We could push this optimization a bit further by
* clearing IA64_THREAD_FPH_VALID on ANY system call.
* However, it's not clear this is worth doing. Also, it
* would be a slight deviation from the normal Linux system
* call behavior where scratch registers are preserved across
* system calls (unless used by the system call itself).
*/
and change:
#define THREAD_FLAGS_TO_CLEAR (IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID \
| IA64_THREAD_PM_VALID)
to:
#define THREAD_FLAGS_TO_CLEAR (IA64_THREAD_DBG_VALID | IA64_THREAD_PM_VALID)
--david
^ permalink raw reply [flat|nested] 11+ messages in thread* RE: [patch] ia64: fix potential NaT bit error for sys_pipe().
2005-01-19 7:12 [patch] ia64: fix potential NaT bit error for sys_pipe() David Mosberger
` (3 preceding siblings ...)
2005-01-20 23:51 ` David Mosberger
@ 2005-01-21 3:32 ` Chen, Kenneth W
2005-01-21 18:48 ` Chen, Kenneth W
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Chen, Kenneth W @ 2005-01-21 3:32 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 20 Jan 2005 15:22:59 -0800, "Seth, Rohit" <rohit.seth@intel.com> said:
>
> Rohit> We are also thinking of reseting the mfh bit on every syscall
> Rohit> entry as an optimization.
>
> Rohit> Comments?
David Mosberger wrote on Thursday, January 20, 2005 3:51 PM
> Sounds OK with me. We should delete this comment from process.c then,
> ....
> and change:
>
> #define THREAD_FLAGS_TO_CLEAR (IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID \
> | IA64_THREAD_PM_VALID)
>
> to:
>
> #define THREAD_FLAGS_TO_CLEAR (IA64_THREAD_DBG_VALID | IA64_THREAD_PM_VALID)
We would rather not to change THREAD_FLAGS_TO_CLEAR definition. mfh bit in child
pt_regs is cleared right above where the comment is. I think it is better as is
so that child thread fph partition stays invalidated.
- Ken
^ permalink raw reply [flat|nested] 11+ messages in thread* RE: [patch] ia64: fix potential NaT bit error for sys_pipe().
2005-01-19 7:12 [patch] ia64: fix potential NaT bit error for sys_pipe() David Mosberger
` (4 preceding siblings ...)
2005-01-21 3:32 ` Chen, Kenneth W
@ 2005-01-21 18:48 ` Chen, Kenneth W
2005-01-24 6:40 ` David Mosberger
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Chen, Kenneth W @ 2005-01-21 18:48 UTC (permalink / raw)
To: linux-ia64
David Mosberger wrote on Thursday, January 20, 2005 9:53 AM:
> Please disregard the patch named in $SUBJECT. It appears to be
> breaking light-weight syscalls. That's rather odd, but since Rohit
> has some better ideas on how to fix this issue, I'd rather drop this
> patch for the time being (the root problem is still there and IMHO,
> needs to be fixed urgently).
>
Seth, Rohit wrote on Thursday, January 20, 2005 11:01 AM
> I will send out the first rev of patch today to address the
> functionality issue. This patch will not worry about exporting the NAT
> bits in r8-r11 to user. So, the ld.fills will be replaced by simple ld.
>
> Though, as per the disussions with David, there is scope of further
> optimization in the way we are saving/restoring r8-r11 in this code.
> This will probably need little more analysis to ensure best
> placement/scheduling of new code. Will send that later...
Here is the first part of the patch that Rohit mentioned earlier.
--- 1.1/arch/ia64/kernel/entry.S Mon Oct 18 14:53:44 2004
+++ edited/arch/ia64/kernel/entry.S Thu Jan 20 15:21:50 2005
@@ -614,8 +614,8 @@
adds r2=PT(R8)+16,sp // r2 = &pt_regs.r8
adds r3=PT(R10)+16,sp // r3 = &pt_regs.r10
;;
-.mem.offset 0,0; (p6) st8.spill [r2]=r8 // store return value in slot for r8 and set unat bit
-.mem.offset 8,0; (p6) st8.spill [r3]=r0 // clear error indication in slot for r10 and set unat bit
+.mem.offset 0,0; (p6) st8 [r2]=r8 // store return value in slot for r8
+.mem.offset 8,0; (p6) st8 [r3]=r0 // clear error indication in slot for r10
(p7) br.cond.spnt handle_syscall_error // handle potential syscall failure
END(ia64_ret_from_syscall)
// fall through
@@ -708,12 +708,12 @@
(p6) br.cond.spnt .work_pending
;;
// start restoring the state saved on the kernel stack (struct pt_regs):
- ld8.fill r8=[r16],16
- ld8.fill r9=[r17],16
+ ld8 r8=[r16],16
+ ld8 r9=[r17],16
mov f6ð // clear f6
;;
- ld8.fill r10=[r16],16
- ld8.fill r11=[r17],16
+ ld8 r10=[r16],16
+ ld8 r11=[r17],16
mov f7ð // clear f7
;;
ld8 r29=[r16],16 // load cr.ipsr
Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
Signed-off-by: Rohit Seth <rohit.seth@intel.com>
^ permalink raw reply [flat|nested] 11+ messages in thread* RE: [patch] ia64: fix potential NaT bit error for sys_pipe().
2005-01-19 7:12 [patch] ia64: fix potential NaT bit error for sys_pipe() David Mosberger
` (5 preceding siblings ...)
2005-01-21 18:48 ` Chen, Kenneth W
@ 2005-01-24 6:40 ` David Mosberger
2005-01-24 19:17 ` David Mosberger
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: David Mosberger @ 2005-01-24 6:40 UTC (permalink / raw)
To: linux-ia64
>>>>> On Fri, 21 Jan 2005 10:48:46 -0800, "Chen, Kenneth W" <kenneth.w.chen@intel.com> said:
Ken> +.mem.offset 0,0; (p6) st8 [r2]=r8 // store return value in slot for r8
Ken> +.mem.offset 8,0; (p6) st8 [r3]=r0 // clear error indication in slot for r10
Without the .mem.offset, please?
--david
^ permalink raw reply [flat|nested] 11+ messages in thread* RE: [patch] ia64: fix potential NaT bit error for sys_pipe().
2005-01-19 7:12 [patch] ia64: fix potential NaT bit error for sys_pipe() David Mosberger
` (6 preceding siblings ...)
2005-01-24 6:40 ` David Mosberger
@ 2005-01-24 19:17 ` David Mosberger
2005-01-24 19:32 ` Chen, Kenneth W
2005-01-24 19:43 ` David Mosberger
9 siblings, 0 replies; 11+ messages in thread
From: David Mosberger @ 2005-01-24 19:17 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 20 Jan 2005 19:32:48 -0800, "Chen, Kenneth W" <kenneth.w.chen@intel.com> said:
Ken> We would rather not to change THREAD_FLAGS_TO_CLEAR definition.
Ken> mfh bit in child pt_regs is cleared right above where the
Ken> comment is. I think it is better as is so that child thread
Ken> fph partition stays invalidated.
Sorry, I was a bit in a rush when I typed that mail and made some
errors as a result. I think what you propose is reasonable, since
just clearing PSR.MFH will take care of avoiding needless
context-switching of f32-f127. However, I think it'd still be
worthwhile to update the comment in copy_thread() to reflect this
thinking (basically, the paragraph starting with "XXX" would have to
be updated).
--david
^ permalink raw reply [flat|nested] 11+ messages in thread* RE: [patch] ia64: fix potential NaT bit error for sys_pipe().
2005-01-19 7:12 [patch] ia64: fix potential NaT bit error for sys_pipe() David Mosberger
` (7 preceding siblings ...)
2005-01-24 19:17 ` David Mosberger
@ 2005-01-24 19:32 ` Chen, Kenneth W
2005-01-24 19:43 ` David Mosberger
9 siblings, 0 replies; 11+ messages in thread
From: Chen, Kenneth W @ 2005-01-24 19:32 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 20 Jan 2005 19:32:48 -0800, Chen, Kenneth W
Ken> We would rather not to change THREAD_FLAGS_TO_CLEAR definition.
Ken> mfh bit in child pt_regs is cleared right above where the
Ken> comment is. I think it is better as is so that child thread
Ken> fph partition stays invalidated.
David Mosberger Monday, January 24, 2005 11:18 AM
> Sorry, I was a bit in a rush when I typed that mail and made some
> errors as a result. I think what you propose is reasonable, since
> just clearing PSR.MFH will take care of avoiding needless
> context-switching of f32-f127. However, I think it'd still be
> worthwhile to update the comment in copy_thread() to reflect this
> thinking (basically, the paragraph starting with "XXX" would have to
> be updated).
Absolutely agreeing with updating the comments. Also in a way, what
you said earlier also make sense. Since clearing psr.mfh is only half
of the optimization. That would only optimize away the storing part
of context switch. However, if later we take a dfh fault, if thread fph
valid bit is on, we end up loading from memory instead of a simple zeroing.
So I better do both, clearing psr.mfh and fph valid bit in thread.flags.
- Ken
^ permalink raw reply [flat|nested] 11+ messages in thread* RE: [patch] ia64: fix potential NaT bit error for sys_pipe().
2005-01-19 7:12 [patch] ia64: fix potential NaT bit error for sys_pipe() David Mosberger
` (8 preceding siblings ...)
2005-01-24 19:32 ` Chen, Kenneth W
@ 2005-01-24 19:43 ` David Mosberger
9 siblings, 0 replies; 11+ messages in thread
From: David Mosberger @ 2005-01-24 19:43 UTC (permalink / raw)
To: linux-ia64
>>>>> On Mon, 24 Jan 2005 11:32:27 -0800, "Chen, Kenneth W" <kenneth.w.chen@intel.com> said:
Ken> Absolutely agreeing with updating the comments. Also in a way,
Ken> what you said earlier also make sense. Since clearing psr.mfh
Ken> is only half of the optimization. That would only optimize
Ken> away the storing part of context switch. However, if later we
Ken> take a dfh fault, if thread fph valid bit is on, we end up
Ken> loading from memory instead of a simple zeroing. So I better
Ken> do both, clearing psr.mfh and fph valid bit in thread.flags.
OK, I had assumed that you had tested this already. Clearing the
FPH_VALID bit in the syscall path does potentially increase the
syscall overhead as it requires a read-modify-write. Cache-wise we
should be OK, since the neighboring "on_ustack" byte is being touched
anyhow. If the code turns out to be difficult to schedule in the
syscall path, an alternate option would be to make FPH_VALID a
separate byte member, right next to on_ustack, so it can be cleared
with "st1 [rXX]=r0".
--david
^ permalink raw reply [flat|nested] 11+ messages in thread