From owner-freebsd-hackers@FreeBSD.ORG Thu May 20 21:45:19 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7B26106566C for ; Thu, 20 May 2010 21:45:18 +0000 (UTC) (envelope-from bf1783@googlemail.com) Received: from mail-ww0-f54.google.com (mail-ww0-f54.google.com [74.125.82.54]) by mx1.freebsd.org (Postfix) with ESMTP id 752A58FC14 for ; Thu, 20 May 2010 21:45:18 +0000 (UTC) Received: by wwb18 with SMTP id 18so54328wwb.13 for ; Thu, 20 May 2010 14:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:reply-to :in-reply-to:references:date:message-id:subject:from:to:cc :content-type; bh=3vYWStVyWkBWxut2xyuN9ns1dJbKUKzdpv65N6TGbe4=; b=IN8/10BGzVZAs9RnQjbN7rLgmTCh1zuFOiHnCvqr5aUkczJcz3zxUV8ecTCQEPOr9d AB76fFSMOwI8Rs+eVHnhZ4UlLk2TvbSVncXgBGsIoQiKbs5nSm5sUN/S7V2ftQC4x286 hcJ1cZhhIxGApVa+GRTvn9AF6LE/oNbnkWF+8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=m9Y5PzxFS6v2cMtPm4isxynEp8XCWDVVLZ7wSIIV4w+F93oIWiOLiHmvUSw5JM5Xe1 H8ouLeplFxT3vkiU5QfXxvBcQGM5VjJc9jJS5uLKjZx6Zq0KSHicXmF0gC7mYljlv3Yd EnQ3Pc3uQF5/DNREn0JUWhz75O4WUMn0X60N4= MIME-Version: 1.0 Received: by 10.216.158.12 with SMTP id p12mr275377wek.152.1274391917455; Thu, 20 May 2010 14:45:17 -0700 (PDT) Received: by 10.216.64.68 with HTTP; Thu, 20 May 2010 14:45:17 -0700 (PDT) In-Reply-To: <20100520210631.GI83316@deviant.kiev.zoral.com.ua> References: <20100520210631.GI83316@deviant.kiev.zoral.com.ua> Date: Thu, 20 May 2010 17:45:17 -0400 Message-ID: From: "b. f." To: Kostik Belousov Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-hackers@freebsd.org Subject: Re: kernel usage of fxsave/fxrstor X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bf1783@gmail.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2010 21:45:19 -0000 On 5/20/10, Kostik Belousov wrote: > On Thu, May 20, 2010 at 01:41:22PM -0400, b. f. wrote: >> I'm wondering why we equate cpu_fxsr and hw_instruction_sse in our >> kernel, when several families of Intel and AMD processors have >> fxsave/fxrstor, but not sse, and various documents from both companies >> suggest that fxsave/fxrstor is faster than fsave/fnsave/frstor, even >> when only saving the fpu/mmx state, and ought to be used for context >> switches and calls and returns from interrupt and exception handlers >> (e.g.. Sections 8.1.11, 10.5, and 11.6.5 of the Intel 64 and IA-32 >> Software Developers' Manual, Volume 1: >> >> http://www.intel.com/Assets/PDF/manual/253665.pdf >> >> ). > What are the several families ? I am aware only of Pentium II > that did have FXSAVE implemented, but not SSE. I am not even sure > that all Pentium IIs have it, or only the later models. I think only later models of Pentium II, from Deschutes onward. As for the number of families, I guess it depends upon how you classify them. I was thinking of the several Athlon variants in addition to the Pentium II models. > > It is funny that I disposed my 2CPU Pentium II machine several weeks > ago. I do not consider it worth an effort trying to optimize for > some Pentiums II in 2010. I have two Pentium II laptops that see occasional use, and an Athlon desktop, that fall into this category. I'm sure that I'm not alone. If a few simple changes, using code similar to that we already are using for later models would yield some performance gains for them, I"d be interested in testing patches. Regards, b. >> >> >> As far as I can tell from a cursory check, Linux draws a distinction >> between cpu_has_fxsr, and cpu_has_xmm/xmm2, and uses fxsave/fxrstor on >> all processors that have the feature, regardless of whether they have >> sse. Shouldn't we do the same? Was this overlooked in the initial >> sse commits? Or are the Intel assertions that the newer instructions >> are faster incorrect? Or was the extra handling needed for the >> different semantics of the newer instructions, and/or concerns over >> FreeBSD-SA-06:14.fpu.asc/CVE-2006-1056 responsible for their >> suppression in pre-sse processors, even though safe methods of using >> them was suggested: >> >> http://security.freebsd.org/advisories/FreeBSD-SA-06:14-amd.txt ? >> >> (Note that I'm not asking about setting the CR4.OSFXSR bit when sse >> isn't needed or present, just using the newer fxsave/fxrstor when they >> are present.) >> >> Regards, >> b. >> _______________________________________________ >> freebsd-hackers@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >