From owner-freebsd-current@FreeBSD.ORG Mon May 1 05:13:14 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E36E16C085 for ; Mon, 1 May 2006 05:12:46 +0000 (UTC) (envelope-from cperciva@freebsd.org) Received: from hexahedron.daemonology.net (s64-180-110-239.bc.hsia.telus.net [64.180.110.239]) by mx1.FreeBSD.org (Postfix) with SMTP id 47DF143D45 for ; Mon, 1 May 2006 05:12:38 +0000 (GMT) (envelope-from cperciva@freebsd.org) Received: (qmail 24816 invoked from network); 1 May 2006 05:12:34 -0000 Received: from unknown (HELO ?127.0.0.1?) (127.0.0.1) by localhost with SMTP; 1 May 2006 05:12:34 -0000 Message-ID: <44554601.5090105@freebsd.org> Date: Sun, 30 Apr 2006 16:19:29 -0700 From: Colin Percival User-Agent: Thunderbird 1.5 (X11/20060416) MIME-Version: 1.0 To: Rostislav Krasny References: <20060430142408.fcd60069.rosti.bsd@gmail.com> In-Reply-To: <20060430142408.fcd60069.rosti.bsd@gmail.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Igor Sysoev , David Xu , freebsd-current@freebsd.org Subject: Re: FreeBSD-SA-06:14.fpu X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2006 05:13:14 -0000 > David Xu wrote: >> Probably it should only be applied to AMD CPU but not Intel and others, >> it is easy to check cpu vendor and put a >> if (bug_fxsave) >> fpu_clean_state(); >> in file npx.c. The problem with doing something like this is that the branch will almost never be in the processor's branch prediction tables, so you will get a branch mis-prediction on the unaffected processors -- which is likely to be more expensive than simply running the state cleaning code. Rostislav Krasny wrote: > Other possible solution is making the fpu_clean_state() optional by > something like following: > > #ifdef BUG_FXSAVE > #define fpu_clean_state() __fpu_clean_state() > #else > #define fpu_clean_state() ; > #endif > > ... and including "options BUG_FXSAVE" to GENERIC. Yes, this is probably the right solution. My priority was to fix the bug; optimizing performance comes second. Colin Percival