linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Kernel includefile bug not fixed after a year :-(
@ 2003-09-30 13:26 Joerg Schilling
  0 siblings, 0 replies; 37+ messages in thread
From: Joerg Schilling @ 2003-09-30 13:26 UTC (permalink / raw)
  To: axboe, davem; +Cc: linux-kernel, schilling

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1427 bytes --]

>From davem@redhat.com  Tue Sep 30 14:28:23 2003

>On Tue, 30 Sep 2003 14:06:29 +0200
>Jens Axboe <axboe@suse.de> wrote:

>> I asked you one simple question: when did the kernel/user interface
>> break, and how?

>I'll answer for him, about 20 or 30 times during IPSEC development.
>It's still possible this could change even some more before 2.6.0
>final is released if a large enough bug in the IPSEC socket APIs are
>found in time.

There is a simple rule of thumb:

If the kernel code is not even ready for testing: don't inlcude it
in external releases.

If it makes sense to test the code and it uses new interfaces then you
need to make the interfaces available to potential users of the interface.
If the interface is going to change then the user should be informed about the
fact, but you yould need the kernel interface include files.

glibc exports own interaces and for this reason needs to supply own include 
files. I see no reason however that glibc should deal with include files that
do not even affect glibc code. This is true for most ioctl()s,
it is definitely true for the SCSI related ioctl()s.



Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
       schilling@fokus.fraunhofer.de	(work) chars I am J"org Schilling
 URL:  http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily

^ permalink raw reply	[flat|nested] 37+ messages in thread
* Re: Kernel includefile bug not fixed after a year :-(
@ 2003-10-01  1:05 Albert Cahalan
  0 siblings, 0 replies; 37+ messages in thread
From: Albert Cahalan @ 2003-10-01  1:05 UTC (permalink / raw)
  To: linux-kernel mailing list, schilling

Joerg Schilling writes:

>> Also Joerg, now that I have your attention: There is a bug
>> somewhere so that if I set the kernel HZ to 400, recompile
>> everything including `cdrecord`, I can no longer record a CD.
>> I think that somewhere, somebody is using a raw jiffie-count
>> instead of multiplying by HZ in the time-out code. I've check
>> through all the SCSI stuff, and I use SCSI disks exclusively.
>> I think something in your code needs fixing. This is for kernel
>> version 2.4.22
>
> Cdrecord and pther programs too includes <sys/param.h>

If that's a kernel header, you have a bug.

> If you change HZ in the kernel include files and recompile
> your problems suffer from the same sort of inconsistencies
> that have been the reason for my initial mail.
>
> If Linux likes to support changes to HZ, then it needs to
> support POSIX interfaces. On Solaris, sys/param.h looks this way:
>
> #define        HZ              ((clock_t)_sysconf(_SC_CLK_TCK))

On a Linux 2.4.xx system and above, you do this:

/////////////////////////////////////////////////////
#ifndef AT_CLKTCK
#define AT_CLKTCK       17    // frequency of times()
#endif

#define NOTE_NOT_FOUND 42

//extern char** environ;  // if _GNU_SOURCE not defined

// for ELF executables, notes are pushed before environment and args
// (Portable too! This even works on PA_RISC for some reason.)
static unsigned long find_elf_note(unsigned long findme){
  unsigned long *ep = (unsigned long *)environ;
  while(*ep++);
  while(*ep){
    if(ep[0]==findme) return ep[1];
    ep+=2;
  }
  return NOTE_NOT_FOUND;
}

// ...

Hertz = find_elf_note(AT_CLKTCK);

/////////////////////////////////////////////////////

Don't trust any _sysconf() junk. It's broken.

> You may even change HZ on a running Solaris system.... the
> only programs that are affected may be the ones that have
> timeouts while the change has been done.

Cute. It's bloat though, because it turns constant
expressions into variable ones.

> The problem is that the timeouts in the SCSI interface are
> based on HZ rather than being abstract from kernel internals.

That's a bug. They should be in terms of USER_HZ,
milliseconds, centiseconds, microseconds, or nanoseconds.
Pick something good and make a patch.



^ permalink raw reply	[flat|nested] 37+ messages in thread
* Re: Kernel includefile bug not fixed after a year :-(
@ 2003-09-30 12:52 Joerg Schilling
  0 siblings, 0 replies; 37+ messages in thread
From: Joerg Schilling @ 2003-09-30 12:52 UTC (permalink / raw)
  To: axboe, linux-kernel, root; +Cc: schilling

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1626 bytes --]

>From root@chaos.analogic.com  Tue Sep 30 14:21:07 2003

>Reply is not on the list.

I added the list because this is another problem that need fixiong inside the 
kernel.

>Also Joerg, now that I have your attention: There is a bug
>somewhere so that if I set the kernel HZ to 400, recompile
>everything including `cdrecord`, I can no longer record a CD.
>I think that somewhere, somebody is using a raw jiffie-count
>instead of multiplying by HZ in the time-out code. I've check
>through all the SCSI stuff, and I use SCSI disks exclusively.
>I think something in your code needs fixing. This is for kernel
>version 2.4.22


Cdrecord and pther programs too includes <sys/param.h>

If you change HZ in the kernel include files and recompile your problems
suffer from the same sort of inconsistencies that have been the reason for
my initial mail.

If Linux likes to support changes to HZ, then it needs to support POSIX
interfaces. On Solaris, sys/param.h looks this way:

#define        HZ              ((clock_t)_sysconf(_SC_CLK_TCK))

You may even change HZ on a running Solaris system.... the only programs that
are affected may be the ones that have timeouts while the change has been done.

The problem is that the timeouts in the SCSI interface are based on HZ rather
than being abstract from kernel internals.

Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
       schilling@fokus.fraunhofer.de	(work) chars I am J"org Schilling
 URL:  http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily

^ permalink raw reply	[flat|nested] 37+ messages in thread
* Re: Kernel includefile bug not fixed after a year :-(
@ 2003-09-30 12:37 Joerg Schilling
  2003-09-30 13:21 ` Tomas Szepe
  0 siblings, 1 reply; 37+ messages in thread
From: Joerg Schilling @ 2003-09-30 12:37 UTC (permalink / raw)
  To: axboe, schilling; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3688 bytes --]

>From axboe@suse.de  Tue Sep 30 14:06:29 2003

>> >> >/usr/include/scsi/scsi.h looks fine on my system, probably also on
>> >> >yours. You should not include kernel headers in your user space program.
>> >> 
>> >> Looks like you did not understand the background :-(
>> 
>> >I think I do.
>> 
>> Sorry, but you just verified that you don't :-(

>No, you continue to show you don't understand why you should not include
>kernel headers in user space.

You continue to verify that you don't understand how kernel <-> user level
interfaces are used by user level programs. 

The Linux kernel constantly adds new interfaces or changes old ones.
A user program that is going to use these interfaces _needs_ to include
up-to-date kernel include interface definitions.

If the kernel is not integral part of the whole system (which is definitely true
for a Linux based system) user level programs _need_ to include the kernel 
include files from the same snapshot as the kernel.

The basic concept of hiding kernel (only) data structures from user level 
programs is to put them between #ifdef __KERNEL__ #endif.
It is definitely typically not done by editing kernel level files later and by 
creating a different set (and thus potentially out of sync) of include files.

If you don't understand this bacic concept, then it makes not sense to continue
this discussion :-(

>> >> In order to use kernel interfaces you _need_ to include kernel include
>> >> files.
>> 
>> >False. You need to include the glibc kernel headers.
>> 
>> 
>> False: as glibc kernel headers are not part of the kernel distribution.

>How is that an argument? By your logic, you need one huge package with
>basically everything in it, how else do you know your application works
>with that given kernel?

Did you ever do a 'du' on /usr/include/sys and compare with 'du' on
/usr/src/linux? It seems that not :-(

A kernel source that uses internal include files that deviate (how ever) 
from the ones that are present in /usr/include/sys/ needs to include include
files that are consistent for user level use. The _way_ how you do this does 
not matter!

If you decide to have a different set of hand edited files, create them
but _always_ include them with the Linux kernel sources....

However, it is easily to understand that it makes more sense to just keep
the internal include files from the Linux kernel constsistent.
The current include files inside the Linux kernel definitely are not
consistent.


>I asked you one simple question: when did the kernel/user interface
>break, and how? You happily chose to ignore that. A pity, since that
>would be the core of your argument.

Well, this has been discussed several times and it would make sense if you
try to e.g. search the Linux kernel mailing lists or the cdrecording mailing 
lists.....

Search for failing cdrecord compilations and runs that are caused from Linux
kernel changes ....

I don't like that an important discussion about Linux include files to be
converted into rants....so let us stay with the topic.

I also told you that the addition of a single feature to an interface
does not make sense as long as user level programs cannot use them. If you like
to use them you need up to date include files for the kernel interfaces.

...please don't try to tell me that Linux never adds new features that
result at least in extended interfaces...

Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
       schilling@fokus.fraunhofer.de	(work) chars I am J"org Schilling
 URL:  http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily

^ permalink raw reply	[flat|nested] 37+ messages in thread
* Re: Kernel includefile bug not fixed after a year :-(
@ 2003-09-30 11:57 Joerg Schilling
  2003-09-30 12:06 ` Jens Axboe
  0 siblings, 1 reply; 37+ messages in thread
From: Joerg Schilling @ 2003-09-30 11:57 UTC (permalink / raw)
  To: axboe, schilling; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2221 bytes --]


>From axboe@suse.de  Tue Sep 30 13:54:12 2003

>> >> Is there no interest in user applications for kernel features or is there just
>> >> no kernel maintainer left over who makes the needed work?
>> 
>> >/usr/include/scsi/scsi.h looks fine on my system, probably also on
>> >yours. You should not include kernel headers in your user space program.
>> 
>> Looks like you did not understand the background :-(

>I think I do.

Sorry, but you just verified that you don't :-(

>> In order to use kernel interfaces you _need_ to include kernel include
>> files.

>False. You need to include the glibc kernel headers.


False: as glibc kernel headers are not part of the kernel distribution.

>> This is in particular true as long as we are talking about
>> beta/testing kernels.
>> 
>> 
>> Background: on homogeneous platforms like e.g. Solaris or FreeBSD
>> which are maintained and distributed as whole, an _enduser_ should
>> include files from /usr/include only. 
>> 
>> 	This is not even true for people who do Solaris or FreeBSD
>> 	kernel development and like to test new features with user level
>> 	programs.  It is definitely not true for compilations against
>> 	Linux kernel interfaces.
>> 
>> Linux is not a homogeneous system. There is a separately developed
>> kernel and a separate base user level system. People often install a
>> newer kernel and need to recompile software because the kernel/user
>> interfaces are not stable between different Linux releases.

>That's a pretty bold claim, when did the kernel/user interface break? A
>lot of care is usually taken to ensure that this does not happen.

>This subject has been debated to death lots of times before, I'm sure
>the archives are more detailed and enlightening that I am.

If these debates have not been done in a serious way, or people without
the needed kernel development background knowledge did decide, these
debates are just void.

Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
       schilling@fokus.fraunhofer.de	(work) chars I am J"org Schilling
 URL:  http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily

^ permalink raw reply	[flat|nested] 37+ messages in thread
* Re: Kernel includefile bug not fixed after a year :-(
@ 2003-09-30 11:44 Joerg Schilling
  2003-09-30 11:54 ` Jens Axboe
  0 siblings, 1 reply; 37+ messages in thread
From: Joerg Schilling @ 2003-09-30 11:44 UTC (permalink / raw)
  To: axboe, schilling; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2407 bytes --]

>From axboe@suse.de  Tue Sep 30 13:05:18 2003

>On Tue, Sep 30 2003, Joerg Schilling wrote:
>> A year after I did report this inconsistency, it is still not fixed
>> 
>> If include/scsi/scsi.h is included without __KERNEL__ #defined, then this
>> error message apears.
>> 
>> /usr/src/linux/include/scsi/scsi.h:172: parse error before "u8"
>> /usr/src/linux/include/scsi/scsi.h:172: warning: no semicolon at end of struct 
>> or union
>> /usr/src/linux/include/scsi/scsi.h:173: warning: data definition has no type or 
>> storage class
>> 
>> Is there no interest in user applications for kernel features or is there just
>> no kernel maintainer left over who makes the needed work?

>/usr/include/scsi/scsi.h looks fine on my system, probably also on
>yours. You should not include kernel headers in your user space program.

Looks like you did not understand the background :-(

In order to use kernel interfaces you _need_ to include kernel include files.

This is in particular true as long as we are talking about beta/testing kernels.


Background: on homogeneous platforms like e.g. Solaris or FreeBSD which are
	maintained and distributed as whole, an _enduser_ should include
	files from /usr/include only. 

	This is not even true for people who do Solaris or FreeBSD kernel 
	development and like to test new features with user level programs.
	It is definitely not true for compilations against Linux kernel
	interfaces.

Linux is not a homogeneous system. There is a separately developed kernel and 
a separate base user level system. People often install a newer kernel and need 
to recompile software because the kernel/user interfaces are not stable between
different Linux releases.

These people need to compile against the recent Linux kernel include files if
they use Linux kernel <-> user level interfaces.

-	... why do you believe that #ifdef __KERNEL__ kernel do exist inside 
	Linux kernel include files if they are not intended for user level 
	programs?

-	How should user level program that depend on kernel interfaces be 
	compiled if not by using kernel include files?


Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
       schilling@fokus.fraunhofer.de	(work) chars I am J"org Schilling
 URL:  http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily

^ permalink raw reply	[flat|nested] 37+ messages in thread
* Kernel includefile bug not fixed after a year :-(
@ 2003-09-30 10:28 Joerg Schilling
  2003-09-30 11:05 ` Jens Axboe
  0 siblings, 1 reply; 37+ messages in thread
From: Joerg Schilling @ 2003-09-30 10:28 UTC (permalink / raw)
  To: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]

A year after I did report this inconsistency, it is still not fixed

If include/scsi/scsi.h is included without __KERNEL__ #defined, then this
error message apears.

/usr/src/linux/include/scsi/scsi.h:172: parse error before "u8"
/usr/src/linux/include/scsi/scsi.h:172: warning: no semicolon at end of struct 
or union
/usr/src/linux/include/scsi/scsi.h:173: warning: data definition has no type or 
storage class

Is there no interest in user applications for kernel features or is there just
no kernel maintainer left over who makes the needed work?


Hints:

-	A type named "u8" is superfluous (even with __KERNEL__ #defined)
	because we have a standard type uint8_t

-	Kernel include files should be checked for use compliance with level 
	compilations on a regular base. It is the duty of the persons who
	make changes to make sure that their changes don't break things.

Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
       schilling@fokus.fraunhofer.de	(work) chars I am J"org Schilling
 URL:  http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2003-10-10  6:33 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-30 13:26 Kernel includefile bug not fixed after a year :-( Joerg Schilling
  -- strict thread matches above, loose matches on Subject: below --
2003-10-01  1:05 Albert Cahalan
2003-09-30 12:52 Joerg Schilling
2003-09-30 12:37 Joerg Schilling
2003-09-30 13:21 ` Tomas Szepe
2003-09-30 11:57 Joerg Schilling
2003-09-30 12:06 ` Jens Axboe
2003-09-30 12:28   ` David S. Miller
2003-09-30 12:38     ` Jens Axboe
2003-09-30 14:41       ` Krzysztof Halasa
2003-10-10  6:36     ` Sandy Harris
2003-09-30 11:44 Joerg Schilling
2003-09-30 11:54 ` Jens Axboe
2003-09-30 12:12   ` Andreas Steinmetz
2003-09-30 12:21     ` Jens Axboe
2003-09-30 12:26       ` Andreas Steinmetz
2003-09-30 12:30         ` Jens Axboe
2003-09-30 12:32       ` David S. Miller
2003-09-30 12:40         ` Jens Axboe
2003-09-30 12:39           ` David S. Miller
2003-09-30 12:23     ` David S. Miller
2003-09-30 12:28       ` Jens Axboe
2003-09-30 12:34         ` David S. Miller
2003-09-30 12:42           ` Jens Axboe
2003-09-30 19:09         ` Erik Andersen
2003-10-01  8:48           ` Paul Rolland
2003-10-01  8:55             ` Arjan van de Ven
2003-10-01 17:49             ` Erik Andersen
2003-09-30 16:10       ` Sam Ravnborg
2003-10-01  6:39         ` David S. Miller
2003-10-02  6:42         ` Eric W. Biederman
2003-09-30 19:04       ` Erik Andersen
2003-09-30 12:25     ` Nick Piggin
2003-09-30 19:00     ` Erik Andersen
2003-10-01  8:47       ` Paul Rolland
2003-09-30 10:28 Joerg Schilling
2003-09-30 11:05 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).