Linux-Development-Sys Digest #474, Volume #8      Thu, 8 Feb 01 03:13:09 EST

Contents:
  insmod command line argument (Huy Ton)
  kernel panic (Jwbat)
  Re: CPU Time of a process (Kyle)
  Re: New-bee questions about Display driver (Tim Roberts)
  Re: can Linux be secure? ([EMAIL PROTECTED])
  Re: can Linux be secure? ([EMAIL PROTECTED])
  Re: 2.4.1 ppp breaks (works in 2.4.0) ([EMAIL PROTECTED])
  Re: insmod command line argument (Yamazaki Kasparov)
  Re: O_SYNC in 2.4 ([EMAIL PROTECTED])
  Re: insmod command line argument (Michael Mueller)
  Re: timeout irq programming ("Eduardo Ferro")
  Device Driver development (Yamazaki Kasparov)
  structure of /proc/<pid>/stat (Shai Kedem)
  structure of /proc/<pid>/stat (Shai Kedem)
  structure of /proc/<pid>/stat (Shai Kedem)
  structure of /proc/<pid>/stat (Shai Kedem)
  Re: Device Driver development (Josef Moellers)
  Re: structure of /proc/<pid>/stat (Josef Moellers)
  Re: Problem adding a system call to the kernel... (Michael Mueller)

----------------------------------------------------------------------------

From: Huy Ton <[EMAIL PROTECTED]>
Subject: insmod command line argument
Date: Wed, 07 Feb 2001 18:30:36 -0800

Hi,

I'm trying to use command line argument to set the variable value in the
driver.  According to the book "Linux Device Drivers" by Rubini, I
should be able to do:
insmod my_variable=1

Seems like with my kernel (version 2.2.14), I need to also do something
else to make it work.  Can someone give me some advice?

Thanks

------------------------------

From: [EMAIL PROTECTED] (Jwbat)
Date: 08 Feb 2001 02:47:51 GMT
Subject: kernel panic


hello,

My Linux machine has KERNEL PANICed more than once with the error message:
In interrup handler: not synching

Anyone know what causes this??

system:
Linux 2.4.1
intel Pentium II @ 266Mhz
64KB ram
ibm Ultrastar18GB SCSI disks using Mylex 170 Raid controller
cyclades cyclom Ye serial card

Thanx,
JWB



------------------------------

From: Kyle <[EMAIL PROTECTED]>
Subject: Re: CPU Time of a process
Date: 8 Feb 2001 04:58:34 GMT

"Bjorn Brencher" <[EMAIL PROTECTED]> wrote:
> Hello,

> i try to control a portscanner process. How can i get the exact cpu time the
> process is using?
> I tried w, top and ps but after a short time the portscanner doesn't
> increase his cpu-time any more?!

time /whatever/portscanner

This will give you real time and cpu time when the process exits.

-Kyle

------------------------------

From: Tim Roberts <[EMAIL PROTECTED]>
Subject: Re: New-bee questions about Display driver
Date: Wed, 07 Feb 2001 21:04:38 -0800

A. Neshmonin <[EMAIL PROTECTED]> wrote:
>
>I am about to start a new ground-level project to develop fully HW-
>accelerated display driver for latest-n-greatest Matrox graphics chip.

Display driver for what?  XFree86?

>I have strong experience with Win32 development of that drivers, but
>merely exposed to Unix or Linux. I'd appreciate if someone helped me
>with the advises:
>- where to start from?:-)
>- what the books/web-sites to read?
>- what the newsgroup to register with?
>- what the people from freelance open-source community to contact?

If you are embarking on an XFree86 driver, then there is no question you
need to begin with the XFree86 source code.  XFree86 already has drivers
for almost everything Matrox makes, and typically generation N+1 of a
manufacturer's chip is nearly compatible with generation N.  The easiest
way to get an XFree86 driver going is to make small tweaks to an existing
driver.

You should also sign on to be an XFree86 developer.  This gets you access
to the developer's mailing list, and to various other resources.  Start at
www.xfree86.org.
--
- Tim Roberts, [EMAIL PROTECTED]
  Providenza & Boekelheide, Inc.

------------------------------

From: [EMAIL PROTECTED]
Subject: Re: can Linux be secure?
Date: Thu, 08 Feb 2001 05:56:42 -0000

On Tue, 6 Feb 2001 22:47:18 +0100 Peter T. Breuer <[EMAIL PROTECTED]> wrote:
| [EMAIL PROTECTED] wrote:
|> Well, from the sounds of it, it seems I can trust the Linux kernel,
|> though I would have to also continue to watch for any exploits.  But
|
| You can do no such thing. Anyone who gets root can do an insmod
| of init_module() { do arbitrary thing to kernel; }. So the kernel
| is exactly as secure as userspace.

There are two separate mechanisms.  One way in is via the user
processes letting someone in, especially bad as root.  But this
is not the issue I'm asking about.  The other is the kernel letting
them in DIRECTLY.

See what I mean about people not reading my question literally.
I guess maybe I do have to repeat myself to get it across.

-- 
=================================================================
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
| [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/     |
=================================================================

------------------------------

From: [EMAIL PROTECTED]
Subject: Re: can Linux be secure?
Date: Thu, 08 Feb 2001 05:57:34 -0000

On Wed, 07 Feb 2001 09:46:51 +0100 Kasper Dupont <[EMAIL PROTECTED]> wrote:

| Even if the kernel is secure, the system as a hole
| can be insecure, but that is not what this discussion
| is about.

Thank you.

-- 
=================================================================
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
| [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/     |
=================================================================

------------------------------

From: [EMAIL PROTECTED]
Subject: Re: 2.4.1 ppp breaks (works in 2.4.0)
Date: Thu, 08 Feb 2001 05:59:23 -0000

On Wed, 07 Feb 2001 14:17:33 +0100 Zoran V. Petrovic <[EMAIL PROTECTED]> wrote:
| Clifford Kite wrote:

| Just download new ppp-2.4.0-2.src.rpm ( in RedHat 7.1 beta ),
|
| rebuild, and 2.4.1 and ppp work.
|
| I use this combination.

Did you try it with TWO different serial ports concurrently?

While looking at code and documents, it seems PPP now uses a
special device /dev/ppp for PPP protocol.  But I need two of
them.

-- 
=================================================================
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
| [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/     |
=================================================================

------------------------------

From: Yamazaki Kasparov <[EMAIL PROTECTED]>
Subject: Re: insmod command line argument
Date: Thu, 08 Feb 2001 14:58:44 +0800
Reply-To: [EMAIL PROTECTED]

Huy Ton wrote:

> Hi,
>
> I'm trying to use command line argument to set the variable value in the
> driver.  According to the book "Linux Device Drivers" by Rubini, I
> should be able to do:
> insmod my_variable=1
>
> Seems like with my kernel (version 2.2.14), I need to also do something
> else to make it work.  Can someone give me some advice?
>
> Thanks

Try to use MODULE_PARM and it will work.

TQ


------------------------------

From: [EMAIL PROTECTED]
Subject: Re: O_SYNC in 2.4
Date: Thu, 08 Feb 2001 07:00:20 -0000

On Wed, 07 Feb 2001 22:09:32 GMT Kaz Kylheku <[EMAIL PROTECTED]> wrote:
| On Wed, 07 Feb 2001 21:20:38 -0000, [EMAIL PROTECTED]
| <[EMAIL PROTECTED]> wrote:
|>If I write without O_SYNC at all, the write() calls will flood the
|>buffer cache as fast as the CPU allows until the cache is full,
|>and then proceed to start swapping out other stuff.  There could
|>be 192meg written via write() and the device has only written
|>maybe 32meg so far.  In this case it is even worse because any
|>other program needing memory has to wait for dirty cache to be
|>written to the device.
|
| That doesn't make a whole lot of sense if you are writing out a large
| file, does it? The most likely access that will take place to the file
| is that it will be read sequentially from the beginning again. In that
| case, having the last N megabytes of the file cached, where N is your
| RAM size, is completely useless.  This caching business definitely
| needs to be more intelligent. You shouldn't have to use O_SYNC to get
| reasonable behavior.

Agreed.  I should only need O_SYNC to know when a given write has actually
completed.


| The problem is predicting how often, or whether at all, a page will be
| accessed in the future. The simplest predictor is to say that if a page
| is accessed, it will be accessed again soon, and so push out something
| else when a frame is needed.  This is the basis for LRU; the page which
| was just written appears to be the most recently used one and so is
| retained, with the hope that it will be used again soon. This
| assumption obviously fails in the case of a sequential write to a large
| file, or in the case of similar operations, like writing out  many
| object files during compilation which are only read once again for
| linking, or unpacking a huge tarball, etc.

Obvious the whole concept of caching the data falls on its face if the
volume of data exceeds available RAM.  One thought I have is that if
the number of pages newly cached in a certain period exceeds a certain
limit, like maybe 50% of buffer capacity, then the assumption of the
page being needed again soon would be dismissed.  Obviously this happens
at 100% since pages are taken for newly written (or read) pages once
the barrier is reached.

A way to limit it PER OPEN FILE would be great.  And if it only happened
for non-mmap()'d files, that would be fine.  This would work for bulk
writing to one file.  It would have to be on a per process or per process
group basis to deal with bulk untarring a million files.


| Perhaps a weighted predictor would work better; a page should be given
| more weight based on how often it has been accessed in within some
| period of time. Pages with big weight should be more resistant to being
| swapped out, because it's more likely that they will be accessed again.
| When a frame needs to be allocated for a newly loaded page, the least
| recently used page in the smallest weight category is kicked out to
| make room, not the least recently used page in the entire system. The
| newly loaded page is then assigned the smallest possible non-zero
| weight, so that even though it's the most recently accessed
| page, it is given preference for being kicked out when another frame is
| needed.  To stay in memory, that page has to ``prove itself'' by
| acquiring weight.  As time goes on, pages that are not accessed lose
| weight.  Pages that are accessed gain weight.
|
| It sounds like this could lead to instabilities; like some process
| thrashing away, unable to bring up the weight of its working set while
| some heavy-weight hogs RAM---because you have more weight, you get to
| access your pages without thrashing, hence maintaining weight.  Only
| one access per sweep is needed to bring up weight; however, if a
| process is stalled due to thrashing and not accessing its pages, they
| lose weight, so are kicked out. Maintaining the page weight across
| swap-outs might help: a page need not lose all its weight just because
| it was swapped out and then back in.

Once the demand on the system exceeds the resources, as in the case of a
bulk write, the resources need to be partitioned in some fair way.  And
I don't think that the weight factor is fair.  It might seem at first
that it is efficient to keep a rapidly used page in memory.  For some
short term that would be true.  But ultimately work needs to get done
even if it doesn't involve accessing the same page over and over.  The
big problem I see, though, is still the situation where one process can
swamp the resources.  CPU is easy to prevent abuse as one CPU heavy
process won't steal it all from others.  Run 2 such processes and they
do get an average of 50%.  Memory is more difficult because it is, as
you know, more an issue of predicting what is needed in the future.

I'm thinking of 2 weights.  One rises linearly with usage and the other
declines by some polynomial higher than linear with time.  What this
would do is put a time cap on the period where the weight keeps the
page in.

But even this is not so great.  One would want to keep certain pages
in quite a lot, even non-dirty ones.  I would not want my bulk write
to ever cause libraries or executeables to be swapped out.  Well not
unless they take up way too much RAM.  So it might be necessary to
intelligently classify each page in some way and make decisions based
on that, including resource caps.  Guarantee each class of page a
certain percentage (not necessarily all the same) of resource if it
is demanding it.

-- 
=================================================================
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
| [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/     |
=================================================================

------------------------------

From: Michael Mueller <[EMAIL PROTECTED]>
Subject: Re: insmod command line argument
Date: Thu, 08 Feb 2001 07:35:13 +0100

Hi Huy,

you wrote:
> I'm trying to use command line argument to set the variable value in the
> driver.  According to the book "Linux Device Drivers" by Rubini, I
> should be able to do:
> insmod my_variable=1
> 
> Seems like with my kernel (version 2.2.14), I need to also do something
> else to make it work.  Can someone give me some advice?

You should use the MODULE_PARM macro:

    #include <linux/module.h>
    #include <linux/kernel.h>

    int avalue = -1;

    #ifdef MODULE
 
    int init_module(void)
    {
            printk(KERN_INFO "avalue = %d\n", avalue);
            return 0;
    }

    void cleanup_module(void)
    {
    }

    MODULE_PARM(avalue, "1i");

    #endif


For Linux 2.4:

    #include <linux/module.h>
    #include <linux/kernel.h>
    #include <linux/init.h>

    int avalue = -1;

    static int __init mydevice_init(void)
    {
        printk(KERN_INFO "avalue = %d\n", avalue);
        return 0;
    }

    static void __exit mydevice_cleanup(void)
    {
    }

    MODULE_PARM(avalue, "1i");

    module_init(mydevice_init);
    module_exit(mydevice_cleanup);


Malware

------------------------------

From: "Eduardo Ferro" <[EMAIL PROTECTED]>
Subject: Re: timeout irq programming
Date: Thu, 08 Feb 2001 08:00:57 +0100

En el artículo <95s1t7$4m$[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
escribió:

> Eduardo Ferro ([EMAIL PROTECTED]) wrote:
> : Hi!
> 
> : I am developig a driver at my job, but i have a great problem to
> control
> : the timeout and the irq of the device at the same time...
> : I have to wait for a irq for a time, and return an error if the there
> : wasn`t any interrupt, but i don`t know how to implement this, because,
> i
> : don't know if wait sleeping in a wait queue or how.
> : I think that a posibiliti is to programar other task that sleep for a
> : while and wake_up the process when the timeout expires seting some
> flag
> : or something similar, but i don't know how can do this.
> 
> : i am reading other drivers code but i can`t see how to do this...
> 
> : Any suggestion would be apreciated
> 
> Have you looked at the 'interruptible_sleep_on_timeout'.  My interrupt
> handler, actually a 'bottom half', performs the 'wake_up_interruptible'.
> If the interrupt doesn't happen or is late, the sleep will time out.

Yes, i found this function yesterdai and i am trying to use it but i
don't know very well how to do it.
Can you send me how you use this function at your driver??? please

Thanks in advance

------------------------------

From: Yamazaki Kasparov <[EMAIL PROTECTED]>
Subject: Device Driver development
Date: Thu, 08 Feb 2001 15:06:26 +0800
Reply-To: [EMAIL PROTECTED]

Hi,

What do u guys think about this ?

We want to use a lot of computer devices such as video camera, modem ,
network card, smard card reader in our project . But the problem is
that  the Linux device drivers are always not available. So we plan to
build a group of software engineers who will develop device drivers for
Linux. Is it possible for a non-hardware manufacturer company to develop
a device driver ? Do we need to know the hardware specification in order
to develop the device driver ? In our case , do we have to negotiate to
with the hardware/chip vendor in order to get some information to
develop the device driver ?.


OK TQ.



------------------------------

From: Shai Kedem <[EMAIL PROTECTED]>
Subject: structure of /proc/<pid>/stat
Date: Thu, 08 Feb 2001 07:30:02 -0000

Hi,

Does anyone knows where to find the description of the fields in this file.
It is a text file (vs. Sun Unix binary format), but is there a C structure 
in Linux which describes what the fields are and their order in the file.

Any help whould be appricated,



--
Posted via CNET Help.com
http://www.help.com/

------------------------------

From: Shai Kedem <[EMAIL PROTECTED]>
Subject: structure of /proc/<pid>/stat
Date: Thu, 08 Feb 2001 07:30:03 -0000

Hi,

any one knows where to find the description of the fields in the stat file 
of a process. Is there a C structure in a system header file that 
describes this file.

any help would be appricated ,

thanks


--
Posted via CNET Help.com
http://www.help.com/

------------------------------

From: Shai Kedem <[EMAIL PROTECTED]>
Subject: structure of /proc/<pid>/stat
Date: Thu, 08 Feb 2001 07:30:02 -0000

Hi,

Does anyone know what is the structure of the kernel stat files 
(/proc/<pid>/stat)  or is there a C structure in one of Linux H files.

any help would be appriciated



--
Posted via CNET Help.com
http://www.help.com/

------------------------------

From: Shai Kedem <[EMAIL PROTECTED]>
Subject: structure of /proc/<pid>/stat
Date: Thu, 08 Feb 2001 07:30:03 -0000

Hi,

Does any one knows where to find the fields descriptions in the process 
stat file. These are text fields, rather then binary file used in Sun 
Unix. Is there a C structure in one of the system header files that 
describes that info ?

Any help will be appricated,

Shai


--
Posted via CNET Help.com
http://www.help.com/

------------------------------

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: Device Driver development
Date: Thu, 08 Feb 2001 08:31:43 +0100

Yamazaki Kasparov wrote:
> =

> Hi,
> =

> What do u guys think about this ?
> =

> We want to use a lot of computer devices such as video camera, modem ,
> network card, smard card reader in our project . But the problem is
> that  the Linux device drivers are always not available. So we plan to
> build a group of software engineers who will develop device drivers for=

> Linux. Is it possible for a non-hardware manufacturer company to develo=
p
> a device driver ?

Yes, it is. Most Linux device drivers were written by "non-hardware
manufacturers", i.e. private persons.

> Do we need to know the hardware specification in order
> to develop the device driver ?

Yes, definitely. A device driver (ignoring pseude-device drivers) is,
per definition, the layer between a generic kernel interface and the
device hardware. So you defeinitely need to know the hardware you want
to control.

> In our case , do we have to negotiate to
> with the hardware/chip vendor in order to get some information to
> develop the device driver ?.

Generally speaking: yes. The hardware/chip vendor is the only one who
can give you the exact specification of the device you want to control.
Sometimes these specs are available on the manufacturer's web site,
sometimes they'll send them at no cost, sometimes they'll charge you,
sometimes you'll have to sign a non-disclosure agreement (how this will
impact the development of an open-source driver is left as an exercise),
sometimes they'll just tell you that they make enough money selling
binary-only drivers to flag-wielding mouse-pushers. A prominent example
of the last are the developers of so-called WinModems.

Citizens of certain countries have the liberty to take binary drivers
from other OSes and disassemble them in order to reverse-engeneer them
and write open-source drivers. Other countries will chop your head off
and send it to the northwest of the USA.

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize
                                                -- T.  Pratchett

------------------------------

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: structure of /proc/<pid>/stat
Date: Thu, 08 Feb 2001 08:42:07 +0100

Shai Kedem wrote:
> =

> Hi,
> =

> Does any one knows where to find the fields descriptions in the process=

> stat file. These are text fields, rather then binary file used in Sun
> Unix. Is there a C structure in one of the system header files that
> describes that info ?
> =

> Any help will be appricated,

UTSL

fs/proc/array.c the function name is get_stat.

But you need to reference it only once, not four times (SCNR)

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize
                                                -- T.  Pratchett

------------------------------

From: Michael Mueller <[EMAIL PROTECTED]>
Subject: Re: Problem adding a system call to the kernel...
Date: Thu, 08 Feb 2001 08:51:34 +0100

Hi Geoff,

you wrote:
> The problem is that when I boot, it seems to be calling my new system
> call.  During boot (as well as shutdown) I get the message output many
> different times saying "Kernel: in sys_mycall...".  Its as if it may be
> mistakenly calling my new system call function.  No where in the code
> did I make any changes to invoke this new function.  All the code
> changes I made are listed above.

The linux 2.2.16 source does not listen the complete list of system
calls. There might be binaries arround that probe for functions added
later by just calling them. So the number 191 you have choosen is used
for getrlimit() within Linux 2.4. Probably it would be best to add your
own syscall at the end of the table. Notice that there is really no
space preserved for experimental syscall functions. So it could happen
to you again that the number you have choosen will be used for something
else.


Malware

------------------------------


** 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 by posting to the
comp.os.linux.development.system newsgroup.

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

Reply via email to