Kernel Optimizations for Processors

Damian Gerow damian at sentex.net
Mon Dec 29 12:47:28 PST 2003


Thus spake admin at forkthepenguin.com (admin at forkthepenguin.com) [29/12/03 15:20]:
> > There's been a number of discussions about this over the past few months.
> > Take a quick peak through the archives.
> 
> I looked through the archives using the search on the FreeBSD site, and
> Google (summaries are nice to have) and I didn't see a whole lot on this.
> Perhaps I'm just using the wrong search terms or getting too many false
> positives.

Try looking for my e-mail address.

> > In short: the GCC folk (at least for 2.95.x) assume that a 686-compatible
> > chip understands CMOV.  *Some* of the C3 cores understand it, others do not.
> > I was under the impression that the Samuel2 /did/ understand it.
> > Understanding CMOV is not a requirement for 686.
> 
> OK, that clears things up a bit. I see now that this is listed in the
> "Features" in dmesg on a PentiumIII system. I found the following on the
> via site that discusses CMOV and is also related to the CMPXCHG8B code
> )see NO_F00F_HACK below).
> 
> http://www.viaarena.com/?PageID=377
> 
> > I think you get ever-so-slightly better performance if you set your ARCH to
> > k6-2, though I use mine as i586/mmx.  As for the kernel configuration, I
> > left mine at I686_CPU, as the C3 /is/ a 686-class CPU.
> 
> What kernel option do you use for k6-2? I don't see anything in LINT or
> GENERIC. Also, what do you mean by "I use mine as i586/mmx"? Is this
> another kernel option?

Nope, I set that in /etc/make.conf.  My kernel options I keep as I686_CPU.
The C3 *is* a 686-class CPU.  The problem lies in that GCC assumes that if a
CPU is i686, it understands CMOV.  But CMOV isn't part of the 686 spec.

> It also says "should be included for any non-Pentium CPU that defines it"
> but how do you know if the C# defines this? Is this another item that
> would show up in the "Features" list? I looked at a PI-133 I have and
> don't see it :

Yeah, I read that over.  The wording's a bit weird in that blurb, IMHO.  I
have *never* used the F00F workaround on any system I've used, and I've
never had a problem with it.  But I went from 486 straight to PIII.

> CPU: Pentium/P54C (133.16-MHz 586-class CPU)
>   Origin = "GenuineIntel"  Id = 0x52c  Stepping = 12
>   Features=0x3bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,APIC>
> 
> I have a PII-300 running Fedora, but dmesg doesn't show the features. I
> did find it in proc :

(Welcome to Linux.)

> So it seems like it "should be included for any non-Pentium CPU that
> defines it", but it sounds like it may not be an issue if this feature
> is implemented correctly...

Like I said, I've never used it anywhere.  And I've never had problems with
it, but I've never gone out of my way to test for it, either.

> BTW, do you have problems with your system hanging on a reboot? I reported
> this as a bug (misc/60646) which I see has been reported at least twice
> before but nothing in the knats database shows it as being solved. Do you
> know of a fix for this?

Nope.  I've had nothing but pure glee when dealing with the C3's, once I
figured out the GCC assumption.

I've been running 5.x on my C3s pretty much since the beginning -- which
would mean the CMOV assumption carries over into 3.x for gcc -- and I've
never had any CPU-related issues.


More information about the freebsd-hardware mailing list