All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert Cahalan <albert@users.sf.net>
To: linux-kernel mailing list <linux-kernel@vger.kernel.org>,
	schilling@fokus.fraunhofer.de
Subject: Re: Kernel includefile bug not fixed after a year :-(
Date: 30 Sep 2003 21:05:50 -0400	[thread overview]
Message-ID: <1064970349.736.14.camel@cube> (raw)

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.



             reply	other threads:[~2003-10-01  1:19 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-01  1:05 Albert Cahalan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-09-30 13:26 Kernel includefile bug not fixed after a year :-( Joerg Schilling
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1064970349.736.14.camel@cube \
    --to=albert@users.sf.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schilling@fokus.fraunhofer.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.