Re: Access User address from kernel thread

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

 



On 1/20/07, Karthik.G. <karthik_anandh@xxxxxxxxx> wrote:


Erik Mouw <mouw@xxxxxxxxxxxx> wrote:
On Thu, Jan 18, 2007 at 11:56:07PM -0500, Rik van Riel wrote:
> Karthik.G. wrote:
>
> >The goal is to pass the system call parameters in the a predefined
> >location in the user process .The kernel thread will have to read and
> >execute the particular system call . This will be faster than the
> >normal system call mechanism
>
> No, it won't.
>
> Normal system calls stay in the same process context and can be
> run without a context switch. Your scheme requires a context
> switch and a (complex) lookup and pinning of user pages in a
> different process. That is pretty much guaranteed to be slower.

And you still have to notify the kernel thread that the parameters are
ready to be parsed. One way is to have some kind of system call, but
that defeats the purpose.

Another way would be to have the kernel thread watch a variable that
says "all parameters are ready", but that would require the kernel
thread to watch every millisecond or so which will destroy latency.


Erik

--
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery

Thanks for your replies . I have a small question .Is it possible to access
a page directly from kernel if I know its physical address?
If I get the physical address of the page can i read it directly ,given that
i also know the physical address i need to read from ? Or is kmap essential?

You cannot use a physical address for reading / writing. You will need
a virtual address. If the page is already mapped in kernel virtual
address space, then you can use the macro phys_to_virt() for getting
the virtual address. However, not all the physical addresses are
permanently mapped (high memory) into kernel virtual address space.
For these, you need to use kmap.

However, it is safe to use kmap for all the addresses, because in case
the physical address is already mapped, it will simply return you the
virtual address without creating any mappings.

Regards,

Rajat

--
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