Linux-Development-Sys Digest #164, Volume #8 Thu, 21 Sep 00 18:13:14 EDT
Contents:
Re: user space insterrupt handler (Kaz Kylheku)
Re: Installing Win98, Win2000 and Linux on one PC?! (Rootman)
MPatrol ( Was: Memprof -- lack of behavior.) (Thaddeus L Olczyk)
Re: MPatrol ( Was: Memprof -- lack of behavior.) (Art Haas)
Wait queues and a race condition on 2.2.x (Lee Cremeans)
how to read >4 gig files ("Mark Andrews")
terminfo ("Tom")
Re: Wait queues and a race condition on 2.2.x (Pete Zaitcev)
Re: /proc/*/stat: parsing the file name (WATM)
Re: Dose floppy conflict with my PCI driver module? (WATM)
Re: Help: Kernel hang/coredump analysis (WATM)
----------------------------------------------------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: user space insterrupt handler
Reply-To: [EMAIL PROTECTED]
Date: Thu, 21 Sep 2000 19:05:52 GMT
On Thu, 21 Sep 2000 14:24:14 -0400, Sukru Cinar <[EMAIL PROTECTED]>
wrote:
>hello,
>
>I wonder if it's possible to handle an interrupt in user space without
>switching to kernel in linux-i386.
No. When an interrupt occurs, the system executes a kernel mode routine to
handle it. Consider that an interrupt can occur in the context of any process.
So any user space handler would be run in the context of some arbitrary
process, violating the security model of the system at a very basic level.
Moreover, the code to be executed by the handler, and any data to be handled by
it, would have to be present and mapped at the same address in each process,
and would have to be non-swappable. (What are you going to do, ignore the
interrupt if the right process isn't currently running?)
POSIX signal handling is supposed to be a an abstraction of signal handling in
users space. In reponse to an interrupt, a kernel module can generate a signal
signal in some registered process, ensuring that the handling is done in an
appropriate context the next time that process is runnable (and does not have
that signal blocked).
--
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: Rootman <[EMAIL PROTECTED]>
Crossposted-To: alt.os.linux,comp.os.linux.setup,microsoft.public.win2000.applications
Subject: Re: Installing Win98, Win2000 and Linux on one PC?!
Date: Thu, 21 Sep 2000 19:08:27 GMT
I've been ignoring this thread but thought I'd chime in. I have almost
what you want setup on my PC, I have WIn 95, Win2k, Win ME and Linux
all running on the same box and able to multiboot. I also have Windows
98 running under the Linux box using Win4Lin. Before you ask I am an
IT professional and need to support all these platforms - thats why I
need them all.
Some hints:
You should make 2 primary partitions, one for Win 98 and one for Win
2k. This is not possible using DOS fdisk, you can do it using the
most recent Freedos version of Fdisk ( FREE http://www.freedos.org/ ),
Partition Magic ( COMMERCIAL http://www.powerquest.com/ )or Ranish
Partition Manager ( FREE http://www.users.intercom.com/~ranish/part/ )
Don't worry if anything complains about this just make 2 NON hidden
PRIMARY FAT32 partitions, activate the first one. I suggest make them 2
or 3 gigs. Format them both as FAT32.
Install Windows 98 on the first partition.
Get this application XOSL ( FREE http://www.xosl.org/ ) , it is one of
the best multiboot loaders out there. I've been having problems getting
to this site but keep trying - it is EXCELLANT.
Use fdisk or Partition Magic to make the 2nd primary partition active,
this will swap the drive letter, the first primary becomes D: and the
second C:. Reboot with the WIN 2K install disk. Be sure to install it
on the C: drive which the second primary partition has now become.
Use FDISk or Pmagic and make the FIRST primary partition active again.
Boot to a COMMAND PROMPT ONLY is Windows 98 by stabbing the F8 key to
bring the menu up when the PC first boots. Now install XOSL and reboot.
When it comes up go to SETUP and ADD your 2 OS's. It is fairly easy to
figure out so I won't go in to it here.
After you get XOSL working reboot to the Linux CD or Install disk and
install Linux to a portion of the remaining HD. Make the partition the
size you want. When it comes time to set up LILO tell it to put it in
the FIRST SECTOR of the PARTITION and NOT the MBR. Reboot and add
Linux to the XOSL menu. You are in effect passing the boot from XOSL
to LILO to make Linux boot.
Now for the rest of the disk. I would go ahead and make it all one big
partition, Linux can easily read FAT32 and so can 98 and 2k, so why
chop it up any more than you have to? Use FDISK, PMAGIC or Linux to
make it so.
Good luck :)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shicheng <[EMAIL PROTECTED]> wrote:
> Hello there,
> We would like to install Win98, Win2000 and linux (redhat 6.0)
> three OSs onto our PC. The PC has a 30 GB hard disk, 128 MB memory
> and a 700 MHz CPU.
>
> We would like to have the above three OSs installed; after the
> installation, we could select one of the three OSs during the boot
time,
> otherwise, the PC will be booted automatically to the default
> OS (Win 2000 is the default one). Each OS would use one partition,
> so the three OSs would need three partitions.
> Apart from these three OS partitions, we may also need to create
> two more partitions using the remaining space of the disk:
> one such a partition would be for the storage of linux's data and the
> other one would be for the data storage for both the Win98 and
Win2000
> OSs; so the last data partition needs to be seen by both the 98 and
the
> 2000 OSs.
>
> We would be grateful you could give us some advice on the above.
>
> Thanks,
>
> Shicheng
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: [EMAIL PROTECTED] (Thaddeus L Olczyk)
Subject: MPatrol ( Was: Memprof -- lack of behavior.)
Date: Thu, 21 Sep 2000 19:54:10 GMT
Reply-To: [EMAIL PROTECTED]
On Thu, 21 Sep 2000 09:47:22 +0100, Graeme Roy <[EMAIL PROTECTED]>
wrote:
>On Wed, 20 Sep 2000, Thaddeus L Olczyk wrote:
>
>> >There are quite a lot of tools, a quick search should give you back tons
>> >of them. My favourits are yamd and mpatrol (both are free), of course
>> >they caught both leaks.
>> >
>> > ...
>> >
>> I hate to be picky, but is there one that can read the symbol tables,
>> since I'm not very good at doing that myself :(
>
>I don't know about YAMD, but mpatrol certainly can. It can also make use
>of the BFD library to read the line number table in the executable if it
>was compiled -g, so that you can have file/line information even if you
>didn't include the header file and instead linked directly with the
>library. It also has a memory profiler which will summarise the memory
>allocations made and the leaks found at the end of execution - quite
>similar to mprof by Ben Zorn which is not available on Linux.
>
>Graeme.
My apologies.
I've been evaluating a lot of memory tools in the last few days, and
sometimes I confuse the problems I had with each tool.
I haven't been able to get file/line information, yet.
But the main problem I had with mpatrol ( which may be mine. not
mpatrol ) is that I can't seem to find a way for it to print just
leaks. Instead It prints allocations and deallocations, but matching
up these to find leaks is almost impossible for my app ( not to
mention the fact that a bloxk of memory can be allocated then
deallocetd then later reallocated and not freed, and I presume the
first call caused the leak ).
------------------------------
From: Art Haas <[EMAIL PROTECTED]>
Subject: Re: MPatrol ( Was: Memprof -- lack of behavior.)
Date: 21 Sep 2000 15:01:44 -0500
[EMAIL PROTECTED] (Thaddeus L Olczyk) writes:
> > [ ... snip ... ]
> >
> >Graeme.
> My apologies.
> I've been evaluating a lot of memory tools in the last few days, and
> sometimes I confuse the problems I had with each tool.
> I haven't been able to get file/line information, yet.
> But the main problem I had with mpatrol ( which may be mine. not
> mpatrol ) is that I can't seem to find a way for it to print just
> leaks. Instead It prints allocations and deallocations, but matching
> up these to find leaks is almost impossible for my app ( not to
> mention the fact that a bloxk of memory can be allocated then
> deallocetd then later reallocated and not freed, and I presume the
> first call caused the leak ).
You'll want to use mleak to do this. mleak is one of the programs
built from mpatrol. Check out the documentation that comes with
mpatrol regarding mleak and it seems to do just what you want.
--
###############################
# Art Haas
# (713) 689-2417
###############################
------------------------------
From: Lee Cremeans <[EMAIL PROTECTED]>
Subject: Wait queues and a race condition on 2.2.x
Date: Thu, 21 Sep 2000 20:24:01 GMT
Reply-To: [EMAIL PROTECTED]
I'm working on a driver for the Hi/fn 7751 encryption chip, and I've
run into a weird problem and I'm not entirely sure how to fix it. The
driver was originally written for NT, but has been broken out into OS-
specific and OS-independent parts, and the Linux-specific part calls
code in the OS-independent part of the driver to process requests. It's
a bit strange because it doesn't move data with read() or write(), due
to the nature of the card (it moves buffer addresses through ioctls).
The code I'm working with, which is in the ioctl handler, is currently
doing something like this:
.
.
.
/* send a encrypt/decrypt request to the other part of the driver here
*/
save_flags(flags);
cli();
interruptible_sleep_on_timeout(&waitq, HZ) /* 1 second timeout */
restore_flags(flags);
if(timeout == 0) {
/* We timed out. Abort the request */
/* cleanup stuff goes here */
return -EIO;
}
.
.
.
The waitq is checked again in a callback routine that wakes up when the
Linux code gets a response from the other side of the driver.
Now, the problem I'm having is that when I run with about 8 processes
using the driver at once, this part of the code appears to spill over,
causing all the sessions to act like the timeout expired...but I can
use a single session at this point, and get a request through with no
problems. I noticed that in the FreeBSD version of the code, the
original developer set splhigh() (pretty much the equivalent of cli())
and tsleep()/wakeup(), which allow you to give a context along with the
request so that the wrong queue entry doesn't get pulled; in FreeBSD,
the problem doesn't happen. My theory is that, with many processes
hitting the card at once, the queue is getting overwhelmed somehow. I
also notice that, in another part of the code, I'm getting "MDL
corrupted" errors (the code reimplements some NT-ish scatter-gather DMA
handling methods, including MDL emulation). Am I handling this
correctly, and more importantly, is there a better way to do what I'm
doing?
-lee
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: "Mark Andrews" <[EMAIL PROTECTED]>
Subject: how to read >4 gig files
Date: Thu, 21 Sep 2000 20:53:32 GMT
Neewbie question: how do I position the file pointer and read from files
whose size is > 32 bits? I would like the equivalent of the Microsoft low
level I/O functions _lseeki64() and _telli64()
------------------------------
From: "Tom" <[EMAIL PROTECTED]>
Subject: terminfo
Date: Thu, 21 Sep 2000 21:22:06 GMT
I need to know how to place a line on the
screen using term.h, terminfo etc.
I cant use ncurses because I need to do threading
and as far as I know ncurses is not thread safe.
Thanks.
------------------------------
From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: Wait queues and a race condition on 2.2.x
Date: Thu, 21 Sep 2000 21:32:02 GMT
> .
> .
> /* send a encrypt/decrypt request to the other part of the driver here
> */
> save_flags(flags);
> cli();
> interruptible_sleep_on_timeout(&waitq, HZ) /* 1 second timeout */
> restore_flags(flags);
> if(timeout == 0) {
> /* We timed out. Abort the request */
> /* cleanup stuff goes here */
> return -EIO;
> }
> .
> .
What is ``timeout''? I guess it races right there.
BTW, sleep_on is quite tricky to get right,
you would be safer using schedule(), add_to_wait_queue(),
remove_from_wait_queue().
> [...] My theory is that, with many processes
> hitting the card at once, the queue is getting overwhelmed somehow.
That's a pretty weak argument, but it's impossible for me to tell
for sure.
> [...] and more importantly, is there a better way to do what I'm doing?
>
> -lee
Look at the following log... Ben la Harse (bcrl) and Andi Klein (f) convert
me from UNIX school of thought to Linux school of thought in regards to
sleep/wakeup API:
<gbWrk> is there a good way to do this atomically: if (!thing) sleep_until(thing); ?
<gbWrk> erm..
<gbWrk> thing may become asserted by an interrupt
<gbWrk> hrm.
* gbWrk thinks
<zaitcev> spin_lock_and_cli()
<zaitcev> That's the only way I know
<gbWrk> zait: well, there's a test, followed by a sleep
<gbWrk> but what if the wakeup happens inbetween the test and the sleep
<f> gb: check and add to wait queue have to be in the lock
<gbWrk> f: ok
* gbWrk fiddles
<f> gb: that is why you should near never use sleep_on, it is usually racy
<gbWrk> yeah
<gbWrk> is there a better way to block a syscall like this?
<f> you can always use a bigger hammer
<gbWrk> i'm doing a write() which will block if a buffer is full
<gbWrk> and i want to do: if (full) block..; and an interrupt will deassert full
<f> gb: just steal the logic from tcp.c or datagram.c @)
<f> it is ok, but you should be careful that full has a big enough threshold to avoid
too many unnecessary wakeups
<f> (otherwise you get silly window syndrome in kernel)
<gbWrk> f: which function?
<gbWrk> (i'm not familar with the net subsystem)
<bcrl> gb: add_wait_queue(...); while (doing work) { blah blah;
set_task_state(TASK_INTERRUPTIBLE); if (full) schedule(); ... } remove_wait_queue(...);
<bcrl> and if (signals_pending(...)) break; after the schedule too
<zaitcev> Awesome
<-- sshack has quit (Wojteken dies)
<zaitcev> And no cli, heh
<bcrl> zaitcev: cli is for wusses
<zaitcev> why, thank you
* bcrl giggles
<dan`b> real men use toggle switches
<f> it makes no difference, the lock is just hidden in the add_wait_queue
<bcrl> and lots of blinky lights
<f> better use a slightly bigger lock and do it in one go
<bcrl> f: add_wait_queue could be made lockless you know (there are ways)
<f> i doubt that the ways are practical
<gbWrk> bcrl: while(doing work) ?
--Pete
------------------------------
From: WATM <[EMAIL PROTECTED]>
Subject: Re: /proc/*/stat: parsing the file name
Date: Thu, 21 Sep 2000 22:47:55 +0100
First, let me tell you that you probably found the reason why the second
argument is enclosed in ()'s.
/proc/self/stat is intended to be parsed with
scanf("%d (%s) %c ...", ...);
Notice the () around the second argument.
You should probably study scanf a little better :-)
--Bruno
Alan J Rosenthal wrote:
>
> Greetings. It seems to me that the /proc/*/stat file in linux is unparseable.
> I created an executable which just cats /proc/self/stat, and I called it
> 'a) b' (hm, I just realized I could have simply renamed a copy of 'cat'),
> and its output was then (line wrapped)
>
> 6592 (a) b) R 4579 6592 4579 34821 6592 0 20 0 79 0 0 1 0 0 17 0 0 0 890837136
> 1110016 81 2147483647 134512640 134513938 3221223936 3221223704 1074532452 0 0
> 0 0 0 0 0 17 0
>
> Is there a way to parse this (re field #2)? I'm interested in a later field,
> but I do have to skip the earlier stuff to get it. Unless I want to parse
> from the end, blech.
>
> 'ps' seems to get it right... does it get its information from somewhere
> else? It *does* refer to the /proc/<pid>/stat file in the source code,
> and it has a big scanf (in accordance with the man page proc(4)) which I'm
> sure has to fail in the case of spaces in the file name... or am I wrong?
> I didn't spend the time to determine what it uses the result of that scanf
> for but it does seem to get everything right about the process named with
> parentheses and spaces in the file name, e.g. it gets its start time right
> (which is what I'm looking for).
>
> This is running with redhat's kernel 2.2.16-3, if it makes a difference,
> which I assume it doesn't.
>
> thanks,
> ajr
------------------------------
From: WATM <[EMAIL PROTECTED]>
Subject: Re: Dose floppy conflict with my PCI driver module?
Date: Thu, 21 Sep 2000 22:59:37 +0100
Hi,
It could be that in you system IRQ 9 is assigned to the floppy driver.
Check /proc/interrupts.
Anyway, Linux allows you to share interrupts differentiating them by the
dev_id (which _must_ be unique).
Check Alessandro Rubini to find how.
--Bruno
[EMAIL PROTECTED] wrote:
>
> Hi,
>
> I can mount the floppy by using 'mount /dev/fd0 /mnt' after the system
> just reboot. But, after I load my PCI driver module, then I mount
> floppy again, it will fail and appear the following messages:
> Is my PCI driver module conflicted with floppy driver?
> I tried to disable all interrupts in my driver, or don't allocate any
> virtual memory for my driver, but all fail.
> Even after I unload my driver module, it could not mount floppy neither.
> I use IRQ 9, and the Linux kernel is 2.2.14 (RedHat 6.2)
>
> Does anyone know what's wrong with my driver?
>
> Anyway, thanks for your kindly help!
>
> dumped kernel messages ====>
>
> floppy driver state
> -------------------
> now=13367 last interrupt=429 diff=12938 last called handler=c0197de8
> timeout_message=lock fdc
> last output bytes:
> 0 0 0
> 0 0 0
> 8 80 429
> last message repeated 4 times
> e 80 429
> 13 80 429
> 0 90 429
> 1a 90 429
> 0 90 429
> 12 90 429
> 0 90 429
> 14 90 429
> 18 80 429
> 8 80 429
> last message repeated 3 times
> last result at 429
> last redo_fd_request at 430
>
> status=80
> fdc_busy=1
> floppy_tq.routine=c019a0d4
> cont=c0243fa0
> CURRENT=c02690ec
> command_status=-1
>
> floppy0: floppy timeout called
> end_request: I/O error, dev 02:00 (floppy), sector 0
>
> floppy driver state
> -------------------
> now=13667 last interrupt=429 diff=13238 last called handler=c0197de8
> timeout_message=lock fdc
> last output bytes:
> 0 0 0
> 0 0 0
> 8 80 429
> last message repeated 4 times
> e 80 429
> 13 80 429
> 0 90 429
> 1a 90 429
> 0 90 429
> 12 90 429
> 0 90 429
> 14 90 429
> 18 80 429
> 8 80 429
> last message repeated 3 times
> last result at 429
> last redo_fd_request at 13367
>
> status=80
> fdc_busy=1
> floppy_tq.routine=c019a0d4
> cont=c0243fa0
> CURRENT=c02690ec
> command_status=-1
>
> floppy0: floppy timeout called
> end_request: I/O error, dev 02:00 (floppy), sector 0
>
> floppy driver state
> -------------------
> now=15667 last interrupt=429 diff=15238 last called handler=c0197de8
> timeout_message=lock fdc
> last output bytes:
> 0 0 0
> 0 0 0
> 8 80 429
> last message repeated 4 times
> e 80 429
> 13 80 429
> 0 90 429
> 1a 90 429
> 0 90 429
> 12 90 429
> 0 90 429
> 14 90 429
> 18 80 429
> 8 80 429
> last message repeated 3 times
> last result at 429
> last redo_fd_request at 13667
>
> status=80
> fdc_busy=1
> floppy_tq.routine=c019a0d4
> cont=c0243fa0
> CURRENT=c02690ec
> command_status=-1
>
> floppy0: floppy timeout called
> end_request: I/O error, dev 02:00 (floppy), sector 2
> task queue still active
>
> floppy driver state
> -------------------
> now=15967 last interrupt=429 diff=15538 last called handler=c0197de8
> timeout_message=lock fdc
> last output bytes:
> 0 0 0
> 0 0 0
> 8 80 429
> last message repeated 4 times
> e 80 429
> 13 80 429
> 0 90 429
> 1a 90 429
> 0 90 429
> 12 90 429
> 0 90 429
> 14 90 429
> 18 80 429
> 8 80 429
> last message repeated 3 times
> last result at 429
> last redo_fd_request at 15667
>
> status=80
> fdc_busy=1
> floppy_tq.routine=c019a0d4
> cont=c0243fa0
> CURRENT=c02690ec
> command_status=-1
>
> floppy0: floppy timeout called
> end_request: I/O error, dev 02:00 (floppy), sector 0
> task queue still active
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
From: WATM <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.misc,comp.os.linux.development.apps
Subject: Re: Help: Kernel hang/coredump analysis
Date: Thu, 21 Sep 2000 23:04:03 +0100
Liaw Yong Shyang wrote:
>
> Hi,
>
> I have midified and recompiled the Linux kernel for my project. I can
> reboot from my new kernel image successfully, and it works happily.
> However, the system will hang from time to time. How can I debug, as I
> could not repeat the bug at my will?? Is it any tool that I can use to
> analyse coredump? Any book or article I can read more about coredump
> analysis?
>
> I really appreciate if you can help. Thank in advance.
If it is an Oops, it can be analyzed with ksymoops.
The oops data is sent to the kernel ring buffer (read with dmesg).
--Bruno
------------------------------
** 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
******************************