public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kasper Dupont <kasperd@daimi.au.dk>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: It hurts when I shoot myself in the foot
Date: Fri, 24 May 2002 18:39:56 +0200	[thread overview]
Message-ID: <3CEE6CDC.D5D7FF9E@daimi.au.dk> (raw)
In-Reply-To: <E17BHdL-0006lF-00@the-village.bc.nu>

Alan Cox wrote:
> 
> > Couldn't that be solved in one of the following ways?
> >
> > 1) Disable pre-emption while reading TSC and CPU nr.
> > 2) Use affinity for processes pre-empted in kernel mode.
> > 3) Disable pre-emption for SMP systems.
> 
> You can solve it by disabling pre-emption (and given its questionable
> value doing so permanently might not be a bad idea).

Questionable value of what? TSC or preemption?

> However if you simply
> disable pre-emption during udelay() calls then you've just screwed yourself
> by removing 99% of the use pre-emption had.

I wouldn't want to disable preemption during udelays.
Either I would disable and enable preemption on every
pass through the loop. Or I would just manually check
for every pass if I should give up the CPU. This
obviously requires more computation for every pass,
but being a busy waiting loop I don't see a problem.

Otherwise I would lock the process to a fixed CPU for
the duration of udelay.

> 
> Given all the pain its probably better to not use the TSC

Do we have better alternatives for high resolution
time meassurements?

-- 
Kasper Dupont -- der bruger for meget tid på usenet.
For sending spam use mailto:razor-report@daimi.au.dk

  reply	other threads:[~2002-05-24 16:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-22 16:15 It hurts when I shoot myself in the foot Chris
2002-05-22 23:39 ` H. Peter Anvin
2002-05-23  3:48   ` Andreas Dilger
2002-05-23  4:49     ` Mike Fedyk
2002-05-23  5:42       ` Andreas Dilger
2002-05-23 17:33         ` Mike Fedyk
2002-05-23 22:28           ` Vojtech Pavlik
2002-05-24  7:32             ` Mike Fedyk
2002-05-24  7:36               ` Vojtech Pavlik
2002-05-24 15:28         ` Alan Cox
2002-05-24 15:20           ` Kasper Dupont
2002-05-24 15:50             ` Alan Cox
2002-05-24 15:36               ` Kasper Dupont
2002-05-24 16:09                 ` Alan Cox
2002-05-24 16:39                   ` Kasper Dupont [this message]
2002-05-24 18:44                     ` Alan Cox
2002-05-24 16:36                 ` Austin Gonyou

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=3CEE6CDC.D5D7FF9E@daimi.au.dk \
    --to=kasperd@daimi.au.dk \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox