A problem in entry.S

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

My aim was to place some code inside entry.S such that when a user space
application invokes a system call I can do some instrumentation related
work like taking the reading of the 64-bit time stamp etc. etc. 

My code can be found at the end of this email. Now my code seems to work
fine on a uni processor kernel, but gives me some funny errors on a SMP
kernel. My code gets activated when I write 1 to /proc/sched/start. At
that point hn_trace_start gets toggled to 1.

echo "1" > /proc/sched/start

As soon as I do this, I get the following weird errors when I invoke
commands which internally call a system call (ls, rm, cat, anything!).

<errors>
[root@llm05 /]# rm
-bash: child setpgid (-38 to -38): Invalid argument

[root@llm05 root]# ls
-bash: child setpgid (-38 to -38): Invalid argument
ls: write error: Function not implemented

[root@llm05 hareesh]# cat /proc/sched/cpu0
-bash: child setpgid (-38 to -38): Invalid argument
cat: /proc/sched/cpu0: Function not implemented

[root@llm05 hareesh]# reboot
-bash: child setpgid (-38 to -38): Invalid argument
</errors>

What could be the problem? Should I place my code at a 'safer' point
inside entry.S?

Thank you.
-- 
Hareesh Nagarajan
WEB: http://puggy.symonds.net/~hareesh

<code>
	cmpl $__PAGE_OFFSET-3,%ebp
	jae syscall_fault
1:	movl (%ebp),%ebp
.section __ex_table,"a"
	.align 4
	.long 1b,syscall_fault
.previous

	pushl %eax
	SAVE_ALL
	GET_THREAD_INFO(%ebp)

	/*--------------   MY CODE BEGINS ------------------*/
	cmpl    $0, hn_trace_start		# Allow tracing?
	je      .no_start
	
	GET_CPU(%ecx)
	GET_RECORD_SIZE(%ecx)
	GET_RECORD($hn_arr, %ecx, %ebx)
	addl	$BUF_SIZE, %ebx			
	movl	$0, %ecx			
	cmpl	%ecx, (%ebx, %ecx, 4)		
	jne     .no_start			
	addl	$4, %ebx			
	cmpl    %ecx, (%ebx, %ecx, 4)		
	jne	.no_start			

        rdtsc					

        movl    %edx, (%ebx, %ecx, 4)		
	subl	$4, %ebx			
        movl	%eax, (%ebx, %ecx, 4)		
.no_start:
	/*--------------   MY CODE ENDS ------------------*/
</code>



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux