Linux-Development-Sys Digest #105, Volume #8 Sun, 27 Aug 00 15:13:11 EDT
Contents:
device driver problems (Brian J Luczkiewicz)
Re: device driver problems (Pete Zaitcev)
Re: device driver problems (Kaz Kylheku)
Re: device driver problems (Kaz Kylheku)
kernel compiles root device as (3,65); boots for (3,41) (xavian anderson macpherson)
Re: Kernel panic: VFS: (xavian anderson macpherson)
Time critical code (Yusuf Motiwala)
Re: where is "make" in linux ("Christos Karayiannis")
Re: device driver problems (Bill Waddington)
wait queue and cli() ("Peter Huang")
Re: wait queue and cli() (Andi Kleen)
Re: wait queue and cli() (Kaz Kylheku)
Re: Time critical code (Kaz Kylheku)
----------------------------------------------------------------------------
From: Brian J Luczkiewicz <[EMAIL PROTECTED]>
Subject: device driver problems
Date: Sun, 27 Aug 2000 00:55:04 -0400
I am writing a _very_ simple device driver for an I/O card (in house).
So simple that it has nothing other than ioctls. I am, however, having
trouble even opening the device. What puzzles me is that it used to work
(a few days ago) but something changed and now it doesn't.
fd = open("/dev/myiocard0",0);
if (fd) {
printf("error: %s\n",strerror(fd));
return -1;
}
This fragment should open the device up and return a file descriptor.
Instead it does the following:
error: No such process
There is nothing in the device driver code that would suggest a reason
for this. I had it working previously without anything like an open
routine (in the file ops struct), although adding one for superstition's
sake didn't help this problem either.
Thank you,
Brian
------------------------------
From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: device driver problems
Date: Sun, 27 Aug 2000 05:15:02 GMT
> fd = open("/dev/myiocard0",0);
What good is an open without any flags? I am not sure it'd even
succeed for /dev/null (for all versions of kernel).
--Pete
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: device driver problems
Reply-To: [EMAIL PROTECTED]
Date: Sun, 27 Aug 2000 05:20:01 GMT
On Sun, 27 Aug 2000 00:55:04 -0400, Brian J Luczkiewicz
<[EMAIL PROTECTED]> wrote:
>I am writing a _very_ simple device driver for an I/O card (in house).
>So simple that it has nothing other than ioctls. I am, however, having
>trouble even opening the device. What puzzles me is that it used to work
>(a few days ago) but something changed and now it doesn't.
>
>fd = open("/dev/myiocard0",0);
>if (fd) {
> printf("error: %s\n",strerror(fd));
> return -1;
>}
Hmm. Worked a few days ago but now doesn't? Maybe /dev/myiocard0 has the
the wrong major number?
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: device driver problems
Reply-To: [EMAIL PROTECTED]
Date: Sun, 27 Aug 2000 05:25:52 GMT
On Sun, 27 Aug 2000 05:15:02 GMT, Pete Zaitcev <[EMAIL PROTECTED]> wrote:
>> fd = open("/dev/myiocard0",0);
>
>What good is an open without any flags? I am not sure it'd even
>succeed for /dev/null (for all versions of kernel).
The glibc header <bits/fcntl.h> defines O_RDONLY as 0. Of course, one should
use O_RDONLY rather than 0, but it doesn't explain the problem.
------------------------------
From: xavian anderson macpherson <[EMAIL PROTECTED]>
Subject: kernel compiles root device as (3,65); boots for (3,41)
Date: Sun, 27 Aug 2000 07:29:15 GMT
i have compiled my kernel-2.4test7 in what was originally a suse 6.4
environment. when compiled, it sets the device as (3,65), but when the
system boots, it looks for (3,41) as the root device. this may resulted
due to the fact that i have installed several linux-mandrake components
into my original suse system. i did this because i wanted a system that
was more compliant with industry standards. i have found out the hard way
that linux is not a truly cohesive environment. if it was, there wouldn't
be multiple distributions each with their own pecularities in their kernels
and directories.
one of the things that i've found out is that suse uses a different file
directory structure than some of the other distributions, and for this
reason, i nolonger recommend it to anyone interested in moving to linux
from windows. it is basically like moving from an overtly proprietary
system, to one that is subvertly proprietary. for this rewason, i am
fairly certain that i will migrate to the WALNUTCREEK FreeBSD-4.0 powerpak
come september 1rst.
anyway, back to the main subject. how do i set the root device correctly,
so that when my system boots, it will find everything where it is supposed
to be. also, i am using the reiserfs system on all of my partitions except
my /boot partition. what exactly does this root device refer to, and where
do i find it's description.
being that i mentioned the FreeBSD migration; is there anyway to change my
existing filesystem over to UFS without having to lose my data. it occurs
to me that if you can defragment a hard disk without losing data, you
should be able to use the same type of procedure to change your filesystem.
if however FreeBSD can use reiserfs, then i don't need to do anything to my
system at all!
the only other option that i can see, is if there is some way to compile
FreeBSD kernel components into a linux kernel; or vice-versa. i mean, is
it possible to combine the sources of the two systems into one kernel.
adding only those portions which are not supported in linux that are
required by FreeBSD? certainly, if BSD and linux are truly open as they
claim to be, there is no intellectual basis for the segregation of the two
systems; especially since they are both supposed to related.
if there is some kind of repository of kernel modules for both linux and
BSD, with somekind of an index of what the individual modules do, then
someone somewhere should be able to aggregate them into a cohesive library
system, so that you could then use a program like make xconifg to select
which components you want from this collective library to create your
kernel.
i mean after all, with linux you can compile all or most of the system as
modules; which can then be removed at a later time if you don't want that
particular feature. what i don't know, is whether or not you have to
notify the kernel (within it's source code) that a particular feature is
present, for a module to be useable? or is it simply a matter of adding a
module to /lib/modules in order for that feature to become available to the
system. does the module initiate notification to the kernel of it's
presence, or does the kernel have to know beforehand from it's creation, of
the modules function? why can't there be an open socket to the kernel,
allowing any module to be added later at anytime, if that feature does not
already exist.
if modules only have to be added to /lib/modules for the system to able to
use it, what would prohibit you from putting BSD modules into linux. after
all, that how linux is able to understand the partitions and filesystems of
other operating systems; so why stop there?
i also want to know if there is a way to use bzip2 to make my kernel image;
bzImage > bz2Image. i just installed bzip2-1.0.1, so i am not familiar
with compressing an image with bzip2. what is the syntax for doing so?
what would i do? is it simply a matter of `make -is dep bzip2 -z bzImage',
or do i drop the `bz' before Image? will whatever is responsble for
determining that the size of the kernel is under 1024KB's, recognize that
that you have compressed the `Image' with bzip2? so what's the deal?
what can i say, i don't like the simple life! ;)
please advise. thank you.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
From: xavian anderson macpherson <[EMAIL PROTECTED]>
Subject: Re: Kernel panic: VFS:
Date: Sun, 27 Aug 2000 07:29:26 GMT
i am having a similar problem.
i have compiled my kernel-2.4test7 in what was originally a suse 6.4
environment. when compiled, it sets the device as (3,65), but when the
system boots, it looks for (3,41) as the root device. this may have
resulted due to the fact that i have installed several linux-mandrake
components into my original suse system. i did this because i wanted a
system that was more compliant with industry standards. i have found out
the hard way that linux is not a truly cohesive environment. if it was,
there wouldn't be multiple distributions each with their own pecularities
in their kernels and directories.
one of the things that i've found out is that suse uses a different file
directory structure than some of the other distributions, and for this
reason, i nolonger recommend it to anyone interested in moving to linux
from windows. it is basically like moving from an overtly proprietary
system, to one that is subvertly proprietary. for this rewason, i am
fairly certain that i will migrate to the WALNUTCREEK FreeBSD-4.0 powerpak
come september 1rst.
anyway, back to the main subject. how do i set the root device correctly,
so that when my system boots, it will find everything where it is supposed
to be. also, i am using the reiserfs system on all of my partitions except
my /boot partition. what exactly does this root device refer to, and where
do i find it's description.
being that i mentioned the FreeBSD migration; is there anyway to change my
existing filesystem over to UFS without having to lose my data. it occurs
to me that if you can defragment a hard disk without losing data, you
should be able to use the same type of procedure to change your filesystem.
if however FreeBSD can use reiserfs, then i don't need to do anything to my
system at all!
the only other option that i can see, is if there is some way to compile
FreeBSD kernel components into a linux kernel; or vice-versa. i mean, is
it possible to combine the sources of the two systems into one kernel.
adding only those portions which are not supported in linux that are
required by FreeBSD? certainly, if BSD and linux are truly open as they
claim to be, there is no intellectual basis for the segregation of the two
systems; especially since they are both supposed to related.
if there is some kind of repository of kernel modules for both linux and
BSD, with somekind of an index of what the individual modules do, then
someone somewhere should be able to aggregate them into a cohesive library
system, so that you could then use a program like make xconifg to select
which components you want from this collective library to create your
kernel.
i mean after all, with linux you can compile all or most of the system as
modules; which can then be removed at a later time if you don't want that
particular feature. what i don't know, is whether or not you have to
notify the kernel (within it's source code) that a particular feature is
present, for a module to be useable? or is it simply a matter of adding a
module to /lib/modules in order for that feature to become available to the
system. does the module initiate notification to the kernel of it's
presence, or does the kernel have to know beforehand from it's creation, of
the modules function? why can't there be an open socket to the kernel,
allowing any module to be added later at anytime, if that feature does not
already exist.
if modules only have to be added to /lib/modules for the system to able to
use it, what would prohibit you from putting BSD modules into linux. after
all, that how linux is able to understand the partitions and filesystems of
other operating systems; so why stop there?
i also want to know if there is a way to use bzip2 to make my kernel image;
bzImage > bz2Image. i just installed bzip2-1.0.1, so i am not familiar
with compressing an image with bzip2. what is the syntax for doing so?
what would i do? is it simply a matter of `make -is dep bzip2 -z bzImage',
or do i drop the `bz' before Image? will whatever is responsble for
determining that the size of the kernel is under 1024KB's, recognize that
that you have compressed the `Image' with bzip2? so what's the deal?
what can i say, i don't like the simple life! ;)
please advise. thank you.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
From: Yusuf Motiwala <[EMAIL PROTECTED]>
Subject: Time critical code
Date: Sun, 27 Aug 2000 08:29:49 GMT
I have some time critical code which I would like to get executed
without any task switching or interrupt (should be locked). The code
is very small and hardly made of 10 CPU instruction. Can somebody
suggest how can I do it in Linux.
Thanks
Ysuuf
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: "Christos Karayiannis" <[EMAIL PROTECTED]>
Subject: Re: where is "make" in linux
Date: Sun, 27 Aug 2000 15:32:11 +0300
You should change to /udr/src/linux first.
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> When I try "make menuconfig", I got error message "hash: make: command not
> found". I also use `find / -name "make"' to search for it, but it returns
> nothing. Could someone please tell me where I can get the "make" command?
> Thanks a lot.
> -jesse
>
> --
> Posted via CNET Help.com
> http://www.help.com/
------------------------------
From: Bill Waddington <[EMAIL PROTECTED]>
Subject: Re: device driver problems
Date: Sun, 27 Aug 2000 14:39:45 GMT
In article <[EMAIL PROTECTED]>,
Brian J Luczkiewicz <[EMAIL PROTECTED]> wrote:
> I am writing a _very_ simple device driver for an I/O card (in house).
> So simple that it has nothing other than ioctls. I am, however, having
> trouble even opening the device. What puzzles me is that it used to
work
> (a few days ago) but something changed and now it doesn't.
>
> fd = open("/dev/myiocard0",0);
> if (fd) {
> printf("error: %s\n",strerror(fd));
> return -1;
> }
>
> This fragment should open the device up and return a file descriptor.
> Instead it does the following:
>
> error: No such process
>
> There is nothing in the device driver code that would suggest a reason
> for this. I had it working previously without anything like an open
> routine (in the file ops struct), although adding one for
superstition's
> sake didn't help this problem either.
>
> Thank you,
> Brian
>
>
Hello Brian,
How about something like:
fd = open("/dev/myiocard0",O_RDONLY);
if (fd == -1) {
printf("error: %s\n",strerror(errno));
return -1;
}
Your open is succeeding, and returning an fd of 3 (no such process
in include/asm/errno.h.
Bill
--
Bill Waddington
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: "Peter Huang" <[EMAIL PROTECTED]>
Subject: wait queue and cli()
Date: Sun, 27 Aug 2000 10:12:23 -0700
Hi all
currently, in my read driver routine, I have
read(...)
{
.
.
.
save_flags(flags);
cli();
interruptible_sleeps_on(&wq);
restore_flags(flags);
.
.
}
The interruptible_sleeps_on(&wq) is awaken by the bottom half of a interrupt
handling function.
Since I called cli to disable the interrupt, does the interruptible_sleep_on
function
enables the interrupt so I can service this wait queue?
Or does the scheduler just put this process to sleep and than turn on the
interrupt?
thanks
Peter
------------------------------
From: Andi Kleen <[EMAIL PROTECTED]>
Subject: Re: wait queue and cli()
Date: 27 Aug 2000 19:38:26 +0200
"Peter Huang" <[EMAIL PROTECTED]> writes:
> Hi all
>
> currently, in my read driver routine, I have
>
> read(...)
> {
> .
> .
> .
> save_flags(flags);
> cli();
> interruptible_sleeps_on(&wq);
> restore_flags(flags);
> .
> .
> }
>
> The interruptible_sleeps_on(&wq) is awaken by the bottom half of a interrupt
> handling function.
> Since I called cli to disable the interrupt, does the interruptible_sleep_on
> function
> enables the interrupt so I can service this wait queue?
> Or does the scheduler just put this process to sleep and than turn on the
> interrupt?
The later.
interruptible_sleep_on is very dangerous, because it can easily give
you races,like in your case. The event could occur before you added
your wait queue and then you would never be woken up again. See e.g.
net/ipv4/tcp.c:wait_for_tcp_memory as an example on how to do it
raceless (basically you need to make sure to add the wait queue before
you test the condition)
You should also not use global cli() in 2.2+, because it is very costly
on SMP machines. Better use a spinlock in your interrupt and
spin_lock_irqsave() in the user context (on UP it will just reduce to a simple
cli)
-Andi
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: wait queue and cli()
Reply-To: [EMAIL PROTECTED]
Date: Sun, 27 Aug 2000 18:11:31 GMT
On Sun, 27 Aug 2000 10:12:23 -0700, Peter Huang <[EMAIL PROTECTED]> wrote:
>Hi all
>
>currently, in my read driver routine, I have
>
>read(...)
>{
>.
>.
>.
>save_flags(flags);
>cli();
cli() is an obsolete, legacy function which dates back to a time when Linux
didn't support SMP (kernel 1.2 and older). Disabling interrupts only guarantees
exclusion if you have a single processor; thus cli() has to be emulated under
SMP in a gross way.
Use spinlocks instead.
>interruptible_sleeps_on(&wq);
>restore_flags(flags);
>.
>.
>}
>
>The interruptible_sleeps_on(&wq) is awaken by the bottom half of a interrupt
>handling function.
>Since I called cli to disable the interrupt, does the interruptible_sleep_on
>function
>enables the interrupt so I can service this wait queue?
The interruptible_sleep_on function puts the calling process to sleep, and runs
another one. The context switch to another process will change the flags, so
you don't have to worry about it.
With spinlocks, you have to do more work because you must release the lock
yourself before rescheduling the process. This means that you must ``manually''
enqueue the task into the wait queue, set its state to TASK_INTERRUPTIBLE and
then test for your wait conditions; if they are false, give up the lock and
call the scheduler.
--
Any hyperlinks appearing in this article were inserted by the unscrupulous
operators of a Usenet-to-web gateway, without obtaining the proper permission
of the author, who does not endorse any of the linked-to products or services.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Time critical code
Reply-To: [EMAIL PROTECTED]
Date: Sun, 27 Aug 2000 18:13:12 GMT
On Sun, 27 Aug 2000 08:29:49 GMT, Yusuf Motiwala <[EMAIL PROTECTED]> wrote:
>
>
>I have some time critical code which I would like to get executed
>without any task switching or interrupt (should be locked). The code
>is very small and hardly made of 10 CPU instruction. Can somebody
>suggest how can I do it in Linux.
You can disable interrupts on the local processor with __cli() and reenable
them with __sti(). Note the underscores.
--
Any hyperlinks appearing in this article were inserted by the unscrupulous
operators of a Usenet-to-web gateway, without obtaining the proper permission
of the author, who does not endorse any of the linked-to products or services.
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list (and comp.os.linux.development.system) via:
Internet: [EMAIL PROTECTED]
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Development-System Digest
******************************