public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Agner Fog <agner@agner.org>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: ABI change for device drivers using future AVX instruction set
Date: Wed, 25 Jun 2008 21:54:04 +0200	[thread overview]
Message-ID: <4862A25C.2060703@agner.org> (raw)
In-Reply-To: <20080625092224.736c2541@infradead.org>

Arjan van de Ven wrote:
 >Let me repeat this loud and clear:
 >It is not allowed to use floating point, SSE of AVX in device drivers.

Thank you for a clear answer. Re-reading the ABI:
 >A.2.4 Miscellaneous Remarks
 >Linux Kernel code is not allowed to change the x87 and SSE units. If 
those are
 >changed by kernel code, they have to be restored properly before 
sleeping or leaving
 >the kernel. On preemptive kernels also more precautions may be needed.

This states your point, but certainly not "loud and clear" :-)

This ABI statement has to be amended, however, because it is allowed to 
use any register as long it is "restored properly". A programmer can 
save a single XMM register, use it, and restore it. A programmer might 
think that it is possible to do the same with a YMM register, but this 
will not work on future systems that extend the 256-bit YMM registers to 
512-bit ZMM or whatever. This has to be said "loud and clear" because 
nobody would discover the error until a distant future when we have ZMM.

Let me explain the background for this as I understand it:
Intel have decided to make two versions of every existing XMM 
instruction in the new AVX: A legacy version that leaves the upper half 
of the YMM register unchanged, and a new AVX version that clears the 
upper part of the YMM register in order to avoid false dependencies. 
This very expensive decision was necessary for only one reason: To 
prevent existing device drivers from destroying the upper part of the 
YMM registers. Learning from past mistakes, they are saying already now 
that they will not use the same fix next time the registers are made 
bigger. When ZMM and still bigger registers are introduced, the YMM 
instructions will clear bit number 256 and up of the ZMM or whatever 
registers.

Note: Please Cc: me of any replies. I am not on the mailing list.


  reply	other threads:[~2008-06-25 19:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-25 15:32 ABI change for device drivers using future AVX instruction set Agner Fog
2008-06-25 16:22 ` Arjan van de Ven
2008-06-25 19:54   ` Agner Fog [this message]
2008-06-25 20:09     ` Arjan van de Ven
2008-06-26  1:11   ` H. Peter Anvin
2008-06-27 11:31     ` Agner Fog
2008-06-27 14:22       ` Arjan van de Ven
2008-06-28  8:05         ` Agner Fog
2008-06-28  8:10           ` David Miller
2008-06-28 11:47           ` Andi Kleen
2008-06-28 15:09             ` Agner Fog
2008-06-28 15:44               ` Helge Hafting
2008-06-28 20:02               ` Andi Kleen
2008-06-29 11:33                 ` Avi Kivity
2008-06-29 12:21                   ` Andi Kleen
2008-06-29 12:31                     ` Avi Kivity
2008-06-29 13:07                       ` Andi Kleen
2008-06-29 13:18                         ` Avi Kivity
2008-06-29 13:23                           ` Andi Kleen
2008-06-29 13:29                             ` Avi Kivity
2008-06-29 22:08                             ` H. Peter Anvin
2008-06-29 12:29           ` Alan Cox
2008-07-01 15:30           ` Arjan van de Ven
2008-06-25 20:14 ` Alan Cox
2008-06-26 14:01 ` 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=4862A25C.2060703@agner.org \
    --to=agner@agner.org \
    --cc=arjan@infradead.org \
    --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