Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8173510imu; Tue, 4 Dec 2018 04:17:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/X1pnhAUsc8PRH6abXr+CtxZe0kX6Ty/pg14lB2gKl2cYUaMOmKrFK8c9Olz+UiFBQcXwnK X-Received: by 2002:a17:902:8306:: with SMTP id bd6mr20012625plb.217.1543925868931; Tue, 04 Dec 2018 04:17:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543925868; cv=none; d=google.com; s=arc-20160816; b=Jul2kxoE76Rp6EsBI6kUMrZqxJgGpnHryPCsWDpSgCGOxhMdTEQv6rzD1GF4zPnXQJ Zzx3/2B2U3DAqdRnc/rjIBR+FGm5ceINveVPepvxTmavhV+7LaFm8XoSaxHNXiZid4vf f9Yoa948bbLjMwAjZ/8YboRxIVUV0NmETJEuXtR/jMcXFymMxT54rVTIiGPKkiGwpLci ZwxXvY0fmnuSTgdJFhC7NC0AIO/1TrWrGnwMu2IWcr7eZvH6J8G5GQaWNBqx6iY1ag9F sSly/4pEUjYd/2CualgcBB+h46/i0gkm4JBEpb5kOS00qHT0gpXxbDamAmi2pMLDuZBR dfXQ== 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; bh=fPJw8XKbcDf6cf18ICncTY6hQNt/SXWIt4xXnmS47WM=; b=mu/c/NyvdUk67qVhMOuffT2lekloX323lQgU/o0EGeWWdhS2WpfZ01QCSO61rRQMK+ FU1woJ5CM2lQb5i82ErikFsEUkf8sVG/weQbS/UtQe736QCLgOKZ43vCQI44x0LveYgN swBTofaUX2ak0O8Ws2LhaNj0PeJTg5dbyi3JAOmIi2VGv4VDdvRUDR5zgMEVRmk9bOEX t7QRZXXjDqgRh5eeOYZjVhjdY07H2kyEg878lJu7AUSA+mSjt20sAGcxPzSyUHyad3DU sVhdLt4VKZa2KSypJleQt2w+J0UPCZDaQwuF6FEKmP+YVV5uDGqvpYOZByJYaqR/g2Pp TuwQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si13890161pgl.503.2018.12.04.04.17.33; Tue, 04 Dec 2018 04:17:48 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726222AbeLDMPr (ORCPT + 99 others); Tue, 4 Dec 2018 07:15:47 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:44691 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbeLDMPr (ORCPT ); Tue, 4 Dec 2018 07:15:47 -0500 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1gU9ba-0005AU-If; Tue, 04 Dec 2018 13:15:10 +0100 Date: Tue, 4 Dec 2018 13:15:10 +0100 From: Sebastian Andrzej Siewior To: Borislav Petkov 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: <20181204121510.ebw4vb265lcepa2m@linutronix.de> References: <20181129150210.2k4mawt37ow6c2vq@linutronix.de> <20181203220841.GB4794@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181203220841.GB4794@zn.tnic> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-12-03 23:08:41 [+0100], Borislav Petkov wrote: > On Mon, Dec 03, 2018 at 10:12:19PM +0100, Ard Biesheuvel wrote: > > > + * Using the FPU in hardirq is not allowed. > > > > According to the documentation in x86/kernel/fpu/core.c, this is not > > true. So which one is accurate? > > I think you mean the irq from user mode... Yap, we do allow that. > > Sebastian? 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. The FPU could be used in user-context surrounded by kernel_fpu_begin(). 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 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(). > Thx. Sebastian