Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8190576imu; Tue, 4 Dec 2018 04:35:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/U6bSdx3R6cBC540Akyu/LdR5rQDZqzapJEZnxGSfNTqOkTDpkfEe0cjO/fdT3WCnea4Eme X-Received: by 2002:a17:902:7848:: with SMTP id e8mr20328063pln.100.1543926900230; Tue, 04 Dec 2018 04:35:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543926900; cv=none; d=google.com; s=arc-20160816; b=X3Lte+uEYmhwp6GOJ0Iw0NyHzI7M4WExHKI7fJs+CwWN8QoJmOVJQXptYwCGztuPJw Q8SEqaaizGRmR3mC/9VnE2dmQVGH5aNXdZMxZdqToWAZJVhMqjOcjh1P2R6yewIY4bBg SdqnPmcY/H3Ew47lsOThznpuUgRGqIB/EzeuX4tJRxMZie9yWxxnKLdD2JxjV71r/0HB k7V5HDZSrD5Gm1x7hd6tDdd8vwj7uFkGLclAirghPJ0j0YqaN4wSsJR6AaIyugYUbLW2 uRIdSnEUNt+Qk2S4iQm0bljlKXrhB5i90chzkRfBrRfYQBaCHOo4NK83Pyu7dTwrZUXx ZWzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UmkhXGx1Qd+uWuUU2htaSuaLRSm1dRqdfZXg6G1UUYE=; b=AgEEDlMhZBEumaU7q3a3S3Hw6G2GwoKplzy6BhvG0EWZ7jUdqEQxSpByq2go1mwU5P VtheWBkf9GO1aroCBVJxLgU0mLTQzJVqNTsPonK08wLzWwJ3DnnGVBd9t/L23HM+XtEn BFINmmURbneyb20lu20R5JFHMlH5gDdNMo/DVRejgX3trXfCK8CR4eRYKGCRMPPkSg6S beEIOuToDsW5nljfOlMdUiDA/kZiDZxA3LVD6aavmn1Gau11aEfa++YfV/ChMT1Ic9YL eUq8gptEjzfSoy4OFy8wV4HMnUnZLzCMR0LHWSBeOhths7KGuFJ5VktfTgpDLTRlWaRg krVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=IZVBs8q9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u34si14791737pgk.24.2018.12.04.04.34.43; Tue, 04 Dec 2018 04:35:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=IZVBs8q9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726283AbeLDMeF (ORCPT + 99 others); Tue, 4 Dec 2018 07:34:05 -0500 Received: from mail.skyhub.de ([5.9.137.197]:46094 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbeLDMeE (ORCPT ); Tue, 4 Dec 2018 07:34:04 -0500 Received: from zn.tnic (p200300EC2BC7BF0029609E2C84DD7E59.dip0.t-ipconnect.de [IPv6:2003:ec:2bc7:bf00:2960:9e2c:84dd:7e59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id DC6C91EC0B90; Tue, 4 Dec 2018 13:34:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1543926843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=UmkhXGx1Qd+uWuUU2htaSuaLRSm1dRqdfZXg6G1UUYE=; b=IZVBs8q9OsH+0niWFicuGOqhGPy7gAZ7QfKlSuYtCEw0/1vYW4cIf94XbbCilmH0n8Z8i9 Q8BfQDOZ/74gnS6fP43yVfi4EEcvi6xqXyPNcvkF1hjsO23Qetmnlsqwx0O5FOmrIgK1+/ arzqPwDJI/s371uT/o0anJIHMozMchk= Date: Tue, 4 Dec 2018 13:33:55 +0100 From: Borislav Petkov To: Sebastian Andrzej Siewior Cc: Ard Biesheuvel , Dave Hansen , Ingo Molnar , the arch/x86 maintainers , nstange@suse.de, Rik van Riel , KVM devel mailing list , "Jason A. Donenfeld" , Linux Kernel Mailing List , Ingo Molnar , Radim =?utf-8?B?S3LEjW3DocWZ?= , "H. Peter Anvin" , Thomas Gleixner , Andy Lutomirski , Borislav Petkov , linux-efi , Paolo Bonzini , linux-tip-commits@vger.kernel.org Subject: Re: [tip:x86/fpu] x86/fpu: Don't export __kernel_fpu_{begin,end}() Message-ID: <20181204123355.GD11803@zn.tnic> References: <20181129150210.2k4mawt37ow6c2vq@linutronix.de> <20181203220841.GB4794@zn.tnic> <20181204121510.ebw4vb265lcepa2m@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181204121510.ebw4vb265lcepa2m@linutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 04, 2018 at 01:15:10PM +0100, Sebastian Andrzej Siewior wrote: > Do you refer to > | * - by IRQ context code to potentially use the FPU > | * if it's unused. > > ? It is possible to use the FPU in IRQ context. I mean interrupted_user_mode() where we apparently can use the FPU when handling an IRQ from user mode. > The FPU could be used in user-context surrounded by kernel_fpu_begin(). Right, that. > This only disables preemption so an IRQ could interrupt it. This IRQ > could then use the FPU or raise a SoftIRQ which would use it. > Therefore on x86 it is required to check with irq_fpu_usable() if the Yes, and the check that thing does is: return !in_interrupt() || interrupted_user_mode() || ... so you're either *not* in interrupt, or you've gotten the IRQ while in user mode. > FPU can be used. If the FPU can not be used, you have to implement > fallback code. > > With the "restore FPU on return to userland" series we need to modify > the FPU in a few places. The softirq and preemption is disabled. I > didn't find any in-IRQ users. > Going forward I would like to remove the in-IRQ part and > irq_fpu_usable() and disable softirq as part of kernel_fpu_begin(). Right, and we should document all those new conditions prominently so that people are aware. Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.