mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mikael Pettersson <mikpe@csd.uu.se>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: tigran@veritas.com (Tigran Aivazian), Andi Kleen <ak@suse.de>,
	ledzep37@home.com (Jordan),
	linux-kernel@vger.kernel.org (Linux Kernel)
Subject: Re: Error in x86 CPU capabilities starting with test5/6
Date: Fri, 17 Nov 2000 14:38:18 +0100 (MET)	[thread overview]
Message-ID: <14869.13514.762275.173328@harpo.it.uu.se> (raw)
In-Reply-To: <E13wkLK-0000bP-00@the-village.bc.nu>
In-Reply-To: <Pine.LNX.4.21.0011171154250.8176-100000@saturn.homenet> <E13wkLK-0000bP-00@the-village.bc.nu>

Hmm, my CPUID vs /proc/cpuinfo comment seemed somewhat controversial.

Tigran Aivazian wrote:
 > Arguably, it is always better to parse /proc/cpuinfo instead of executing
 > CPUID directly (think PCI -- drivers should _NOT_ get their irq/io/etc
 > values from config space directly but only what the kernel puts on a plate
 > for them in the struct pci_dev).

In priciple I would agree, but CPUID is a lot easier to use than to open and
parse /proc/cpuinfo, specially when the format of the latter changes...

 > So, one could imagine the kernel which emulates in software some of the
 > processor features and then CPUID would lie but /proc/cpuinfo would tell
 > the truth.

In this case, I'd REALLY like to know whether the feature is emulated or not.
Imagine a kernel emulating MMX instructions, with a 10x performance loss.
My MPEG viewer has builtin support for MMX and non-MMX capable processors,
with the non-MMX version 2x slower. On a non-MMX processor, we'll still
be a lot better off using the non-MMX rendering libs.

In other cases it may not matter, only the user can tell.

Andi Kleen wrote:
 > The program would be broken if it executed CPUID itself, because it has no way to guarantee
 > that the CPUID is executed on all CPUs the scheduler may later move the task too.
 > ...
 > -Andi (proud owner of an AMP system with one CPU implementing FXSR and one not,
 > which causes lots of interesting problems) 

Yes, this is a problem. There are two alternatives:
- hpa's cpuid driver lets you execute cpuid on a specific processor
  (but it's an optional driver, so you can't count on it)
- Something like Solaris' processor_bind() which lets a user-space application
  "bind" itself to a given processor. AFAIK, Linux doesn't have this :-(

Alan Cox wrote:
 > It is not safe to use cpuid to check the availability of RDTSC in Linux because
 > the CPU itself does not know if the TSC is buggy (Some MediaGX, some WinChip,..)

User-space can also check vendor/family/mode/stepping values and choose not to
trust certain announced feature flags. No big deal.

 > or if the TSC on an SMP box is constant across all processors.

A recurring theme: asymmetric MP boxen :-(
Yeah, you and Andi are right, asymmetric MP boxen require kernel support.
I didn't consider that case...

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2000-11-17 14:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-17  9:50 Jordan
2000-11-17 11:39 ` Mikael Pettersson
2000-11-17 11:58   ` Tigran Aivazian
2000-11-17 12:10     ` Alan Cox
2000-11-17 12:51       ` Christoph Rohland
2000-11-17 13:08         ` Jeff Garzik
2000-11-17 13:21           ` Christoph Rohland
2000-11-17 13:31             ` Andi Kleen
2000-11-17 13:40               ` Jeff Garzik
2000-11-17 13:54                 ` Andi Kleen
2000-11-17 14:02                   ` Tigran Aivazian
2000-11-17 14:30                     ` Christoph Rohland
2000-11-17 14:50                       ` Alan Cox
2000-11-17 14:00                 ` Arjan van de Ven
2000-11-17 15:18         ` Andrea Arcangeli
2000-11-17 16:06           ` Christoph Rohland
2000-11-17 18:28             ` Andrea Arcangeli
2000-11-18  9:57               ` Christoph Rohland
2000-11-19 10:31               ` Albert D. Cahalan
2000-11-17 13:38     ` Mikael Pettersson [this message]
2000-11-17 12:04   ` Andi Kleen
2000-11-17 12:14     ` Jan Niehusmann
2000-11-17 12:22       ` Andi Kleen
2000-11-17 13:26 ` Mohammad A. Haque

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=14869.13514.762275.173328@harpo.it.uu.se \
    --to=mikpe@csd.uu.se \
    --cc=ak@suse.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ledzep37@home.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tigran@veritas.com \
    /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

all inboxes | Powered by JetHome®