Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp119407pxb; Wed, 20 Jan 2021 02:46:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTvulXvBhLdx1YTRkNQbXM6hGwH0t+3kXhGrOuzqzh/M29D8OCefP7PYNFJ2XyR+gExY3l X-Received: by 2002:a17:906:f1d6:: with SMTP id gx22mr5755786ejb.348.1611139618806; Wed, 20 Jan 2021 02:46:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611139618; cv=none; d=google.com; s=arc-20160816; b=KOfJsRBB1tCipVYN+6RQhL5riP19YC+oBRz9yj7wEmTXcjc1TTv47hloSS5ogeifR9 2sTvrbVGZZnKdvMECsJTSQAPOdIlIG8QXyKSxIW61qoEWGhKDDuHvLsf0rZhikI2X08I K8w8xxGhWNjHy1gi1zQdtMQMlqAtun/onUPYifhYil2SPLBtcVAS9XLTQn7Mjm7K8PwI 8K+gcXMYa/2yGH55wpdTzvTPkLL4fwIW0dtWh+b8rEn0BoAbcEMPBdLJVTs2rEbLdSyP yjRsidpPIsmD6/OioftsXUSIeSYE1tE9Qrfwcw5PiG493YhZQXaeY9RN+7mzaVSqA89P IqWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dWRKnysMoCYVgpiHotWOpoe9PF3rMjzOvG2xl7rGJB4=; b=fFtSQ6KSmTM3awU191n4wdosrlX3fvIqH0ZzJkImDuCLEK/NY8OHPlcqVF5A6P2Iz3 OcSqDlyUZHlc7B85nDSAlWuYvWaDDLORd6ar8NO/drg7bKzZjKkYa/rgJ8pmrvkuEgGP sgLxPa2M4/kN86fYIv36+udFqPKMg81O7nnRt2EWoBn3OUMxo1ASw0ri0pFN9qPG2VYB R7hiRctf5n27WCyVvxjjC/q1oe+mw7WjF+FxfL+liMJtwF4Pa9F84VaR3AAABccj9BWZ GzU+IDuy/T/uq1Jq1LuO60hXRBDGHjIOKnFwqy87ZDR7vkwGO8J5ZG1VzIcOXgH5zz1H p0zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=yLc58B08; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy7si651893edb.462.2021.01.20.02.46.08; Wed, 20 Jan 2021 02:46:58 -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; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=yLc58B08; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732790AbhATKTu (ORCPT + 99 others); Wed, 20 Jan 2021 05:19:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728638AbhATKIL (ORCPT ); Wed, 20 Jan 2021 05:08:11 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6256CC0613C1 for ; Wed, 20 Jan 2021 02:07:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=dWRKnysMoCYVgpiHotWOpoe9PF3rMjzOvG2xl7rGJB4=; b=yLc58B08pClT6QzHO0Z7IA7SAV XYaYC+U+bDEYYrdca+4yw2uImJyiRcqXyiOb/BsHaTEoFH3ns3tLfRFDzwHWz6z4yo38f6iASUvPD C3CYQtn7DnBnKAZCDzhvC4ylJrKOiP2ZNhqCz97f16BGk1DTWXMecpcrdDVWQrCOndUbDujFmZtjm fJjxSDN4l/18y5eXvzX7cKVUdo6DVDOakD0cwaAAeJcFnac+ydAP6YS55mszlVR9vs7rzE8vta/Dp ozNxSv06quRTfa3QRCub81EeIKgPXiYlHT+kss0SBiWs6UteOIE5VbSL+vswTI1TyQP48UcmAQfbT 1riSy+fg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2AOS-0006dN-1M; Wed, 20 Jan 2021 10:07:16 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A12C5301959; Wed, 20 Jan 2021 11:07:11 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4F94F206A9211; Wed, 20 Jan 2021 11:07:11 +0100 (CET) Date: Wed, 20 Jan 2021 11:07:11 +0100 From: Peter Zijlstra To: Andy Lutomirski Cc: x86@kernel.org, LKML , Krzysztof Mazur , Krzysztof =?utf-8?Q?Ol=C4=99dzki?= , Arnd Bergmann , Josh Poimboeuf Subject: Re: [PATCH v2 4/4] x86/fpu/64: Don't FNINIT in kernel_fpu_begin() Message-ID: References: <803d45a172a25314fdaec0a01aada8333d55df4e.1611077835.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <803d45a172a25314fdaec0a01aada8333d55df4e.1611077835.git.luto@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 19, 2021 at 09:39:02AM -0800, Andy Lutomirski wrote: > The remaining callers of kernel_fpu_begin() in 64-bit kernels don't use 387 > instructions, so there's no need to sanitize the FPU state. Skip it to get > most of the performance we lost back. > > Reported-by: Krzysztof Olędzki > Signed-off-by: Andy Lutomirski > --- > arch/x86/include/asm/fpu/api.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/arch/x86/include/asm/fpu/api.h b/arch/x86/include/asm/fpu/api.h > index 38f4936045ab..435bc59d539b 100644 > --- a/arch/x86/include/asm/fpu/api.h > +++ b/arch/x86/include/asm/fpu/api.h > @@ -32,7 +32,19 @@ extern void fpregs_mark_activate(void); > /* Code that is unaware of kernel_fpu_begin_mask() can use this */ > static inline void kernel_fpu_begin(void) > { > +#ifdef CONFIG_X86_64 > + /* > + * Any 64-bit code that uses 387 instructions must explicitly request > + * KFPU_387. > + */ > + kernel_fpu_begin_mask(KFPU_MXCSR); I'm also still sitting on this: git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/fpu what do we do with that?