From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7FFDC61D85 for ; Fri, 24 Nov 2023 00:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=waGFqEIXMj2V/O6zQNr/jMdKBmSamQdTlUoDCIv7uj0=; b=KxvdZE92aa+oZt 8t04Dophif+NvtF1uwG7tMXg4BF854m/ohYrs9Us6rx81IS7xeXkzxGCZUTmjQVxlOoTj7qnAVzEQ goL684oc+zH8jzSWv912KL1zkAGcqRPJlz8+BWKK1GJtj3v5gybW4ZXudjkwMyrjlLvo3pjtb8Rj/ eTuqPLKkf2PaSSofwbnevPPRaZAzPKqOMPumZlqnjlTkUQtiTaoCvLL14vqFUovwoumLzx1OORMqh mVnySQrROGH/Qgfr9K/yU5icNsrUyXXPWQmSLjYvBtyj2swBcOBPolXtbs+eK0lUnishPQMC/qwRb MbJhoelPHwpxr+BNV1AA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r6JqA-005rgn-0a; Fri, 24 Nov 2023 00:14:38 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r6Jq7-005rgO-1L for linux-arm-kernel@lists.infradead.org; Fri, 24 Nov 2023 00:14:36 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 212FACE27F3; Fri, 24 Nov 2023 00:14:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08D19C433C9; Fri, 24 Nov 2023 00:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700784872; bh=0rq1xg3T8RGTIXALRSiKJ8X2FsNuFQDjh4keG8sAQWA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Eqhz2bcVCLjTC9hVZCc1FECwdL2H37LDMP/oDzPS/Znaf1Xa/h+XT3w69LFRfVtMf YkoysqwOdmw4NS7iJnfVlrpqvYJhhHWsEiMrATPiAfGB8j9/ARzFw6kWS6M1R5rH4j Ecuss1j98M6dQXLqFFDCoJ1I/BAsbCnoZFyEh/NGC8Zi2PO/+OKOHp6fcmTZqaNtf2 CEStRfrDgwolVcyNxgVWcoLhyNWFw8HrC3u3N4H/8X9oFpkaMniEIgwdGRdIqkcvAD 18FXS4gMCU/sJUpAFZ4VJRPVT0/5V7RmQeyam5cPNpEWZ/K1ggfySTaikxeVJRPnd/ M26fT5RduUs4w== Date: Thu, 23 Nov 2023 16:14:30 -0800 From: Eric Biggers To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Marc Zyngier , Will Deacon , Mark Rutland , Kees Cook , Catalin Marinas , Mark Brown Subject: Re: [PATCH v2 2/4] arm64: fpsimd: Preserve/restore kernel mode NEON at context switch Message-ID: <20231124001430.GB13943@sol.localdomain> References: <20231123174433.737171-6-ardb@google.com> <20231123174433.737171-8-ardb@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231123174433.737171-8-ardb@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231123_161435_693531_A5C26FF5 X-CRM114-Status: GOOD ( 11.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Nov 23, 2023 at 06:44:36PM +0100, Ard Biesheuvel wrote: > - /* > - * Fix up TIF_FOREIGN_FPSTATE to correctly describe next's > - * state. For kernel threads, FPSIMD registers are never loaded > - * and wrong_task and wrong_cpu will always be true. > - */ > - wrong_task = __this_cpu_read(fpsimd_last_state.st) != > - &next->thread.uw.fpsimd_state; > - wrong_cpu = next->thread.fpsimd_cpu != smp_processor_id(); > + if (test_tsk_thread_flag(next, TIF_USING_KMODE_FPSIMD)) { > + fpsimd_load_kernel_state(next); > + set_tsk_thread_flag(next, TIF_FOREIGN_FPSTATE); > + } else { > + /* > + * Fix up TIF_FOREIGN_FPSTATE to correctly describe next's > + * state. For kernel threads, FPSIMD registers are never > + * loaded and wrong_task and wrong_cpu will always be true. > + */ > + wrong_task = __this_cpu_read(fpsimd_last_state.st) != > + &next->thread.uw.fpsimd_state; > + wrong_cpu = next->thread.fpsimd_cpu != smp_processor_id(); The "For kernel threads, FPSIMD registers are never loaded" part is outdated now, right? - Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel