Thread (107 messages) 107 messages, 6 authors, 2023-01-05

Re: [PATCH v4 06/39] x86/fpu: Add helper for modifying xstate

From: Borislav Petkov <bp@alien8.de>
Date: 2022-12-20 12:04:50
Also in: linux-arch, linux-doc, linux-mm, lkml

On Fri, Dec 02, 2022 at 04:35:33PM -0800, Rick Edgecombe wrote:
+void fpregs_lock_and_load(void)
Fun naming :)
+{
+	/*
+	 * fpregs_lock() only disables preemption (mostly). So modifing state
Unknown word [modifing] in comment.
Suggestions: ['modifying',...
+	 * in an interrupt could screw up some in progress fpregs operation,
+	 * but appear to work. Warn about it.
+	 */
+	WARN_ON_ONCE(!irq_fpu_usable());
+	WARN_ON_ONCE(current->flags & PF_KTHREAD);
+
+	fpregs_lock();
So it locks them here...

/me goes further into the patchset

aha, and the counterpart of this function is fpregs_unlock() so
everything gets sandwitched between the two.

Ok, I guess.
+EXPORT_SYMBOL_GPL(fpregs_lock_and_load);
Exported for KVM?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help