Subject: Re: Measuring memory to memory copy operations (+ interrupts, DMA)
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Kamal R Prasad <kamalrpr@in.ibm.com>
List: tech-kern
Date: 08/18/2003 16:01:07
> I am modifying [the clock interrupt handler] and want to add a couple
> of mem-to-mem copys [copy from userspace to kernel space] in the
> handler.

> The code is on AIX -but I expect similar performance on most versions
> of UNIX.

>Well, this is a NetBSD list.  If you want AIX-specific advice, this is
>a wrong place to ask; my comments will apply to NetBSD.

Im aware of this.

>This is a rather dangerous thing to do.  Unless you have arranged for
>something to be present in every process at some userspace address
>that's fixed (or otherwise easily computable), there's no safe way to
>do this.  Even if you have, I'm not entirely convinced it's enough, as
>I'm not sure there's always a userland in the MMU (for example, if no
>process has been run since the last process-exit, I'm not sure what's
>left in the MMU - it's probably port-specific).

http://netbsd.gw.com/cgi-bin/man-cgi?profil+2+NetBSD-current

this function and the code for updating timer ticks is inside the kernel.
 
> is it affordable to copy in about 100 bytes twice [and copy out a few
> bytes] within the routine if it is being called every one second?

>"Probably."  This depends on your CPU speed, how expensive copyin() is
>on the port you're using, and how much performance degradation you're
[snip]

lets assume a 1 GHZ cpu speed and the port is obviously powerpc.
I am looking for info about overhead associated with copying from one 
context to another.

>I do rather wonder, though, how it could possibly be useful to fiddle
>something in the internals of whatever process happens to be current
>(if any) once a second, and why it can't be done with existing
>facilities.

thats exactly what profiling is about:-)

regards
-kamal