Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 May 2014 20:22:31 -0600
From:      Alan Somers <asomers@freebsd.org>
To:        tyler@tysdomain.com
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: no SSE in kernel build?
Message-ID:  <CAOtMX2jt-%2BiAQ0LNoMQLmbvenpdTu-7pe6S39Mg-FKkV8b_PGA@mail.gmail.com>
In-Reply-To: <537FFE81.2080504@tysdomain.com>
References:  <537FFE81.2080504@tysdomain.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, May 23, 2014 at 8:05 PM, Littlefield, Tyler <tyler@tysdomain.com> wrote:
> Hello all:
> I had a quick question I was hoping someone could explain for me. I was
> looking at some of the kernel source, just trying to familiarize myself with
> it. I notice that SSE, MMX and other such instruction sets are explicitly
> disabled during kernel compilation--is there any particular reason why? I'm
> sure it's pretty obvious, but my knowledge of kernel workings is pretty
> limited. I've seen functions like memset/memcpy that make use of SSE and are
> incredibly fast; perhaps this could be useful on architectures that support
> it?

Because the SSE registers would rarely be useful in kernel code, they
are explicitly excluded from he system call ABI.  That is, the kernel
does not save them to the stack on interrupts or system calls.  Hence,
the kernel can't use them at all.  But select parts of the kernel can
use them thanks to the fpu_kern_enter/fpu_kern_leave API.  More
details at this link:

http://lists.freebsd.org/pipermail/freebsd-arch/2010-March/010005.html

>
> Finally, I'm interested in doing some performance work on the
> kernel--perhaps to help out somewhere. Is there anything at the kernel level
> a beginner could help out with? Where else might my help be useful? I know
> -some-, as I've worked a bit on a barebones OS, but I'm no means a kernel
> hacker.
> Thanks,

I think that most of the kernel's performance problems would be hard
stuff for a beginner.  David Xu suggested that devd(8) could be
modified to use kqueue.  Not in the kernel, I know, but it would be
easy.  Another thing you could do would be to apply the counters(9)
API more thoroughly through the kernel.  It's a high performance API
for statistical counters that minimizes lock contention and cache
coherency conflicts.  It's also fairly new, so I bet there are places
that could be using but aren't.

-Alan

>
> --
> Take care,
> Ty
> http://tds-solutions.net
> He that will not reason is a bigot; he that cannot reason is a fool; he that
> dares not reason is a slave.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2jt-%2BiAQ0LNoMQLmbvenpdTu-7pe6S39Mg-FKkV8b_PGA>