Jon Masters | 1 Oct 2004 02:36
Picon

Re: Inter Module communication

On Fri, 1 Oct 2004 00:07:24 +0530, Dhiman, Gaurav <gaurav.dhiman <at> ca.com> wrote:

> If anybody else knows some other synchronizing mechanism in kernel, then
> please do mail about that.

There are reader-writer versions of the locking primitives that you
describe below. Linux 2.6 also introduces two new locking types:

    *). Completion variables - tasks often use this to sync up their actions.
    *). Seq locks - simple retry locks (but as rml points out, they do
favour writers).

> Semaphore: This is a heavy synchronizing mechanism and should be used if
> our critical section is big enough ......

There's a fundamental distinction between semaphores and spinlocks you
need to note - semaphores only work in a process context as they may
sleep. With the preempt stuff on in the kernel we have to worry about
more than just SMP systems, but spinlocks will still disable
pre-emption if necessary by changing preempt_count for us.

Jon.

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

Jon Masters | 1 Oct 2004 02:40
Picon

Re: Can a module block?

On Thu, 30 Sep 2004 22:02:15 +0200, Alberto Rodriguez Galdo
<argaldo <at> gmail.com> wrote:

> Hi, I can't see any reason to implement a tcp server-based app as a
> kernel module and not as an userland app....

It's a bad idea.

You can do this but unless you have some critically important latency
reason to do this inside the kernel then it's just not worth
considering - kernel code is harder to tweak, harder to debug and runs
without a safety net. It's also harder to handle sleeping and other
fundamental issues of socket based communications from within the
kernel.

> Can you tell me your reasons? ... if you don't mind, of course ;-)

Can you tell us your reasons for doing this in-kernel?

Jon.

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

cranium2003 | 1 Oct 2004 04:32
Picon
Favicon

Plzzz help me

Hello,
 I want to know is there any way in linux kernel by
which i can come to know that the outgoing packet is
having destination address is of host not of router?
I want to send different data to host/router depending
on dest. address. 

regards,
cranium.

		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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

mohanlal jangir | 1 Oct 2004 05:33

Re: how does kernel know?

>
>      But what i told you was a practical experience. On my fedora core
> 2 box in the office, for several times, I rmmoded parport, parport_pc
> and lp modules  and checked through lsmod if they did actually got
> removed, they sure did. But they used to get loaded automatically when
> I used to open /dev/lp0. If you have problems believing this, I can
> give you a shell access to my system tomorow morning :) Thanks for the
> help.
>

kernel can load modules as and when needed. For example, if you have
compiled the kernel making parport and parport_pc as modules; these modules
are not loaded at boot time (until configured to load at boot time by
/etc/modules). Whenever any application needs these modules, kernel loads
the modules first (using modprobe) and then applications can avail the
functionality provided by module.

Regards
Mohanlal

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

Thekkedath, Gopakumar | 1 Oct 2004 06:01
Favicon

RE: Seek Help !!! (about getting a pointer to sys_call_table)


>1. - get the pointer to IDT (Interrupt Descriptor Table), using SIDT
>assembly instruction. This instruction will store the value of IDTR
>register of processor, which actually is a pointer to IDT in kernel.

>2. - Once you get the pointer to IDT, get to the 128th entry of IDT by
>multiplying 128 with 8 (as each entry in IDT is of 8 bytes) and adding
>that to the IDT pointer, which we got in first step. This is a pointer
>to the system gate through with system calls enter kernel mode.

	Just a thought, the IDTR holds the physical address of the IDT in
memory right? so to use that in the kernel,
u may have to convert it to virtual address.

gop

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

Raghav K | 1 Oct 2004 06:06

Re: Plzzz help me

>I want to know is there any way in linux kernel by
>which i can come to know that the outgoing packet is
>having destination address is of host not of router?

Assuming that your are referring to MAC address,
you'll have set your ethernet interface to promiscuous
mode and then process the packets you read. 
Refer Stevens N/W Programming Second Edition.

And your really need to work on your subject if you
want more ppl to <b>atleast</b> read your mail.

-raghav-


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

manish regmi | 1 Oct 2004 06:12
Picon

Re: Read operation on Block device.

Thanks prasanna for the correcting me. 
Now, 
 What i understood is the generic_file_read finally calls the
read_page function which is File system specfic.
It then calls the buffer cache function block_read_fullapge and
finally get_block.
If the reqd block is not in the cache, how does it fetch from the physical disk?

thanks 
Manish

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

Prasad | 1 Oct 2004 06:40
Picon

Re: Seek Help !!!

On Thu, 30 Sep 2004, Ashish Mishra wrote:
> But , it seems that this symbol is not exported in linux kernel 2.4.

	Hi there ! 
	No !, This symbol is by default exported in 2.4.x kernel; you need 
not to do anything to export it. It is since 2.5.41 kernel that this 
symbol is not exported by default. 
	You can find a patch to export it may be at  www.tldp.org
--

-- 
regards
   -Prasad

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

Zeeshan Ali | 1 Oct 2004 06:56
Picon
Gravatar

Re: how does kernel know?

Hello,

> kernel can load modules as and when needed. For example, if you have
> compiled the kernel making parport and parport_pc as modules; these modules
> are not loaded at boot time (until configured to load at boot time by
> /etc/modules). Whenever any application needs these modules, kernel loads
> the modules first (using modprobe) and then applications can avail the
> functionality provided by module.

   My question is HOW does it do it. If you had read my question
carefully, then you should have realized that I already know that it
is happening (rather I am seeing it happening) and now i am asking HOW
does it do it.

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

Raghav K | 1 Oct 2004 06:55

Re: Can a module block?

> Hi, I can't see any reason to implement a tcp server-based app as a
> kernel module and not as an userland app....

>>It's a bad idea.

>>You can do this but unless you have some critically important latency
>>reason to do this inside the kernel then it's just not worth
>>considering - kernel code is harder to tweak, harder to debug and runs
>>without a safety net

Yeah absolutely. A TCP server implementation makes no sense as a kernel module, whatever advantage that
you gain by such a implementation  could very easily nullified by a bad carrier and the TCP overhead
is makes things worse.  

-raghav-


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


Gmane