All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Andi Kleen <ak@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Matt Mackall <mpm@selenic.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lguest-fix-divide-error-implement-sched_clock
Date: Tue, 05 Jun 2007 10:02:02 -0700	[thread overview]
Message-ID: <4665970A.6080501@zytor.com> (raw)
In-Reply-To: <200706051837.22847.ak@suse.de>

Andi Kleen wrote:
> 
> I don't think it's a good idea for the TSC. There are various
> setups where it is unreliable and also often simulators don't 
> implement it correctly. And it's always a valuable workaround
> to be able to turn it off.
> 
> Except possibly for the FPU only features used by the gcc output
> should be tested this way. For everything else it is better to 
> test at runtime.
> 
> That is x86-64 makes some more assumptions. But even it
> doesn't assume TSC. 
> 
> I added the mechanism to statically evaluate mostly to share cpufeatures.h
> between 32bit and 64bit at some point -- but didn't quite finish that work 
> before the last merge.
> 

Note that tsc_setup in i386 at least has:


static int __init tsc_setup(char *str)
{
        printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC,"
                                "cannot disable TSC.\n");
        return 1;
}


If TSC isn't actually a compile-time feature then we should allow it to
be disabled on the command line!


This is what I have for i386:

#ifndef CONFIG_MATH_EMULATION
# define NEED_FPU       (1<<(X86_FEATURE_FPU & 31))
#else
# define NEED_FPU       0
#endif

#ifdef CONFIG_X86_TSC
# define NEED_TSC       (1<<(X86_FEATURE_TSC & 31))
#else
# define NEED_TSC       0
#endif

#ifdef CONFIG_X86_PAE
# define NEED_PAE       (1<<(X86_FEATURE_PAE & 31))
#else
# define NEED_PAE       0
#endif

#ifdef CONFIG_X86_CMOV
# define NEED_CMOV      (1<<(X86_FEATURE_CMOV & 31))
#else
# define NEED_CMOV      0
#endif

#ifdef CONFIG_X86_CMPXCHG64
# define NEED_CX8       (1<<(X86_FEATURE_CX8 & 31))
#else
# define NEED_CX8       0
#endif

#define REQUIRED_MASK0  (NEED_FPU|NEED_TSC|NEED_PAE|NEED_CMOV|NEED_CX8)

#ifdef CONFIG_X86_USE_3DNOW
# define NEED_3DNOW     (1<<(X86_FEATURE_3DNOW & 31))
#else
# define NEED_3DNOW     0
#endif

#define REQUIRED_MASK1  (NEED_3DNOW)

And for x86-64:


/* x86-64 baseline features */
#define NEED_FPU        (1<<(X86_FEATURE_FPU & 31))
#define NEED_PSE        (1<<(X86_FEATURE_PSE & 31))
#define NEED_TSC        (1<<(X86_FEATURE_TSC & 31))
#define NEED_MSR        (1<<(X86_FEATURE_MSR & 31))
#define NEED_PAE        (1<<(X86_FEATURE_PAE & 31))
#define NEED_CX8        (1<<(X86_FEATURE_CX8 & 31))
#define NEED_PGE        (1<<(X86_FEATURE_PGE & 31))
#define NEED_FXSR       (1<<(X86_FEATURE_FXSR & 31))
#define NEED_CMOV       (1<<(X86_FEATURE_CMOV & 31))
#define NEED_XMM        (1<<(X86_FEATURE_XMM & 31))
#define NEED_XMM2       (1<<(X86_FEATURE_XMM2 & 31))

#define REQUIRED_MASK0  (NEED_FPU|NEED_PSE|NEED_TSC|NEED_MSR|NEED_PAE|\
                         NEED_CX8|NEED_PGE|NEED_FXSR|NEED_CMOV|\
                         NEED_XMM|NEED_XMM2)
#define SSE_MASK        (NEED_XMM|NEED_XMM2)

/* x86-64 baseline features */
#define NEED_LM         (1<<(X86_FEATURE_LM & 31))

#ifdef CONFIG_X86_USE_3DNOW
# define NEED_3DNOW     (1<<(X86_FEATURE_3DNOW & 31))
#else
# define NEED_3DNOW     0
#endif

#define REQUIRED_MASK1  (NEED_LM|NEED_3DNOW)




  reply	other threads:[~2007-06-05 17:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-22 22:38 lguest broken in 2.6.22-rc1-mm1 Matt Mackall
2007-05-22 23:27 ` Rusty Russell
2007-06-04 17:19   ` lguest rebroken in 2.6.22-rc3-mm1 Matt Mackall
2007-06-04 17:28     ` Andrew Morton
2007-06-04 17:46       ` Matt Mackall
2007-06-04 18:12       ` Andi Kleen
2007-06-05  2:48         ` Rusty Russell
2007-06-05 10:01           ` Andi Kleen
2007-06-05 13:11             ` [PATCH] lguest-fix-divide-error-implement-sched_clock Rusty Russell
2007-06-05 14:24               ` Andi Kleen
2007-06-05 16:07                 ` Andrew Morton
2007-06-05 16:16                   ` H. Peter Anvin
2007-06-05 16:37                     ` Andi Kleen
2007-06-05 17:02                       ` H. Peter Anvin [this message]
2007-06-05 18:43                       ` H. Peter Anvin
2007-06-05 18:51                         ` Andi Kleen
2007-06-05 21:15                       ` H. Peter Anvin
2007-06-05 21:31                         ` Andi Kleen

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=4665970A.6080501@zytor.com \
    --to=hpa@zytor.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=rusty@rustcorp.com.au \
    /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.