From owner-freebsd-hackers@FreeBSD.ORG Thu May 20 17:41:25 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 80A4F1065688 for ; Thu, 20 May 2010 17:41:25 +0000 (UTC) (envelope-from bf1783@googlemail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1AFC18FC1D for ; Thu, 20 May 2010 17:41:24 +0000 (UTC) Received: by wye20 with SMTP id 20so66073wye.13 for ; Thu, 20 May 2010 10:41:24 -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:date :message-id:subject:from:to:content-type; bh=quh8fi/lyQuGoBw/njOSg+/bncg+EvP4EGyUbZzoV5c=; b=qrfPh42imc1E3pNVWejhA2QMn46PS6eya1NklAiPKdqGk3a96dxvcnP9ZLZvQ/V3xe KuY1rqLy0I+MTIX7QS1Pe/arqZr/vAoldKLRI1cRkjWdxOIt/NvdOM5BoPXRVYsPAAIj KtiVW4K3+EX/5jIEp+FQb6b1EOGobEkZM9eII= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:date:message-id:subject:from:to:content-type; b=dfel3PlPEZLZ9hP19C5u1HWMlFW+dj4r7mjMhHmAP2mGGw5BkP86Lme3eg5u95+BnD u617jENepX+dbMMuj03RGX3U4uz+9Alpmka3EUfYnSquMlI6nEIgCKKpPDepTzb3VtZM HiK24bcdL30B41x5Q446XB0PbVB+cyIzYy0Io= MIME-Version: 1.0 Received: by 10.216.188.130 with SMTP id a2mr126986wen.54.1274377282618; Thu, 20 May 2010 10:41:22 -0700 (PDT) Received: by 10.216.64.68 with HTTP; Thu, 20 May 2010 10:41:22 -0700 (PDT) Date: Thu, 20 May 2010 13:41:22 -0400 Message-ID: From: "b. f." To: freebsd-hackers@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: 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 17:41:25 -0000 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 ). 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.