public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: hpa@zytor.com (H. Peter Anvin)
Cc: linux-kernel@vger.kernel.org
Subject: Re: AES assembler optimizations
Date: Tue, 10 Aug 2004 13:36:09 -0700	[thread overview]
Message-ID: <20040810133609.4f1ca352.davem@redhat.com> (raw)
In-Reply-To: <cfb901$ctg$1@terminus.zytor.com>

On Tue, 10 Aug 2004 19:51:29 +0000 (UTC)
hpa@zytor.com (H. Peter Anvin) wrote:

> It's not really that hard, you just have to have enough work to
> amortize it over.  The two metrics are: how much work do you get per
> call, and how much work do you get before the next schedule().

Someone might want to investigate using sparc64's FPU saving
scheme on x86, if possible.  It might make the cut-off point
smaller.

On sparc64, we:

1) Always save the full FPU state at context switch time if it
   is active.

2) On entry to a FPU-using kernel routine, we save the FPU if
   it is active.

3) On exit from a FPU-using kernel routine, we do nothing
   except mark the FPU as inactive.

4) FPU-disabled traps by the user restore the state saved
   by #1 or #2

Not that this means FPU state can be recursively saved.
For example, if a FPU memcpy take an interrupt, and the interrupt
handler invokes a FPU memcpy, it works just fine.

This works extremely well for cases such as:

   The user made the FPU active, but it is not going to
   use the FPU for quite some time.  The kernel can use
   the FPU multiple times, and only need to save state once.

It's worked extremely well in practice.  We store the stack
of FPU states at the end of the thread_struct area.  This
provides better cache behavior than storing it on the local
kernel stack each time the kernel wants to use the FPU (Solaris
on UltraSPARC chooses this method BTW).

  reply	other threads:[~2004-08-10 20:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2riR3-7U5-3@gated-at.bofh.it>
2004-08-09 14:28 ` AES assembler optimizations Andi Kleen
2004-08-09 16:02   ` Bob Deblier
2004-08-09 17:12     ` Matti Aarnio
2004-08-10 19:51       ` H. Peter Anvin
2004-08-10 20:36         ` David S. Miller [this message]
2004-08-11  1:02           ` Paul Mackerras
2004-08-11  1:25             ` David S. Miller
2004-08-12 20:18           ` Bill Davidsen
2004-08-09 18:16     ` Andi Kleen
2004-08-09 20:20     ` dean gaudet
2004-08-09 13:47 Bob Deblier
2004-08-09 14:32 ` Patrick McFarland

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=20040810133609.4f1ca352.davem@redhat.com \
    --to=davem@redhat.com \
    --cc=hpa@zytor.com \
    --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