From owner-freebsd-amd64@freebsd.org Tue Aug 15 10:44:53 2017 Return-Path: Delivered-To: freebsd-amd64@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5009DCB191 for ; Tue, 15 Aug 2017 10:44:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [176.36.249.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42F0169D35 for ; Tue, 15 Aug 2017 10:44:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v7FAifto064883 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 15 Aug 2017 13:44:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v7FAifto064883 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v7FAifIY064882; Tue, 15 Aug 2017 13:44:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 15 Aug 2017 13:44:41 +0300 From: Konstantin Belousov To: "Rang, Anton" Cc: "freebsd-amd64@freebsd.org" Subject: Re: XSAVE vs. XSAVEOPT in fpusave / fpu_kern_enter? Message-ID: <20170815104441.GG1700@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 10:44:53 -0000 On Mon, Aug 14, 2017 at 08:42:35PM +0000, Rang, Anton wrote: > Hi, > > While glancing at fpu_kern_enter, I noticed that fpusave() uses the > XSAVE instruction, but not XSAVEOPT. The instance in cpu_switch.S is > patched if XSAVEOPT is available, but should we also be able to use > XSAVEOPT in fpusave as well? I can't see any reason why not, but I'm > not 100% sure that the save area is set up properly in all cases. Yes, XSAVEOPT should be safe there. I have a WIP changes (for a long time) which emulate ifuncs in kernel. Then fpusave() becomes a function call through a pointer indirection, and avoids conditional, which makes adding XSAVEOPT variant free. But I postponed committing this change, and may postpone even more. If our system linker/external toolchain support gain a new linker that support ifunc, then it might be better to use real ifunc.