Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2475294pxb; Mon, 18 Jan 2021 20:28:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxPnKEDGfJpB/H0tGerZplICVrokVPvOie6BKESm6GMlznlJ+x1HII8DOEG5Ql7RiLg/yJ X-Received: by 2002:a17:906:2315:: with SMTP id l21mr1875231eja.183.1611030489148; Mon, 18 Jan 2021 20:28:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611030489; cv=none; d=google.com; s=arc-20160816; b=RKLwmIksUvRwobx9IqyD/u5mZ4iwocUm0UoUA8wUa6NUynvh5B3EO2v9lGxyLl5OZb yZXsnjHEF/eZCh7VqdNwty8jGD6XjFg8Af6xoVSEV+/OOo5ARQKoUFeTZ9CBvSsPfLmx od/laalDzOrPVSvNlZSc0d8K6frFkWhF0n04n4/v9jjl8oPTT/GwW74Wa1y1rUhuOL+D gUCpN5jEuLNCprXirATl9dE+B/wcXs449NcwGGNdEXryKsWSAVmZsIHnwPc+DryYkS1i TLh+VS65xvZeVxVOgUTmDPnlg1lXFIMoOuIyV9jmEN5IHgoeXvWdyPoesHWuWMYxDr5U V4gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=4WVGNDi4iXRhHd4hyC2Zadr0T4KpWHYlZcRvonijG7I=; b=G8+54GrmA53T/87EGgdbpRSYI+DACIx84Vdbe8XQYDM9EBxIDCwUZMZ8E05UKGTaFd bjcY0s7iavLNpduIQ04UQkbyABzh5eNj/K/0hi8jXq98zCu3L9oo135zRAJvio+AkEw0 6qnT4Itwt1+fhzblUKOtMzsw4ET72sGZ/DIIEaGSozSHW/cW+EM+Q658knfQWFhfxF9i TJkWGMs131r1oxcuw4l3tD3fzzLiM8qe97r3fuMRf6PGwpzoiMWxu0VptQhUylsO8Tp9 a8Iuar5T95Eot0p06hAjrpbBzmEjtr8DASot/HkKeaUUTf9U4nCjrW7LRp7DVpZ5W9s8 mBIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si1922218edy.517.2021.01.18.20.27.46; Mon, 18 Jan 2021 20:28:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392618AbhAROFP convert rfc822-to-8bit (ORCPT + 99 others); Mon, 18 Jan 2021 09:05:15 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:52645 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392622AbhAROE4 (ORCPT ); Mon, 18 Jan 2021 09:04:56 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-175-xOhOvC86NguXJNtyDtvyUg-1; Mon, 18 Jan 2021 14:03:08 +0000 X-MC-Unique: xOhOvC86NguXJNtyDtvyUg-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 18 Jan 2021 14:03:07 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Mon, 18 Jan 2021 14:03:07 +0000 From: David Laight To: 'Andy Lutomirski' , "x86@kernel.org" CC: LKML , Krzysztof Mazur , =?iso-8859-2?Q?Krzysztof_Ol=EAdzki?= , Arnd Bergmann Subject: RE: [PATCH 1/4] x86/fpu: Add kernel_fpu_begin_mask() to selectively initialize state Thread-Topic: [PATCH 1/4] x86/fpu: Add kernel_fpu_begin_mask() to selectively initialize state Thread-Index: AQHW7WJaj1C/G8lQukGQKbQ/ZO1Lg6otaOUA Date: Mon, 18 Jan 2021 14:03:07 +0000 Message-ID: <71144eab31a34dc7add39655a289f8a8@AcuMS.aculab.com> References: In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Lutomirski > Sent: 18 January 2021 06:21 > > Currently, requesting kernel FPU access doesn't distinguish which parts of > the extended ("FPU") state are needed. This is nice for simplicity, but > there are a few cases in which it's suboptimal: > > - The vast majority of in-kernel FPU users want XMM/YMM/ZMM state but do > not use legacy 387 state. These users want MXCSR initialized but don't > care about the FPU control word. Skipping FNINIT would save time. > (Empirically, FNINIT is several times slower than LDMXCSR.) > > - Code that wants MMX doesn't want need MXCSR or FCW initialized. > _mmx_memcpy(), for example, can run before CR4.OSFXSR gets set, and > initializing MXCSR will fail. > > - Any future in-kernel users of XFD (eXtended Feature Disable)-capable > dynamic states will need special handling. > > This patch adds a more specific API that allows callers specify exactly > what they want. Is it worth returning whether the required fpu feature is available? Or, maybe optionally, available cheaply? There are also code fragments that really just want one or two [xyx]mm registers to speed something up. For instance PCIe reads can be a lot faster if a wide register can be used. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)