[lkml]   [2021]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v4 14/22] x86/fpu/xstate: Expand the xstate buffer on the first use of dynamic user state
On Mar 26, 2021, at 09:34, Jann Horn <> wrote:
> On Sun, Feb 21, 2021 at 7:56 PM Chang S. Bae <> wrote:
>> + if (handle_xfirstuse_event(&current->thread.fpu))
>> + return;
> What happens if handle_xfirstuse_event() fails because vmalloc()
> failed in alloc_xstate_buffer()? I think that should probably kill the
> task with something like force_sig() - but as far as I can tell, at
> the moment, it will instead end up at die(), which should only be used
> for kernel bugs.

This question was raised on v1 before [1].

In the end, people suggested to handle the failure, e.g., with tracepoints or
stats. So, proposed this on the allocation site:

+ state_ptr = vmalloc(newsz);
+ if (!state_ptr) {
+ trace_x86_fpu_xstate_alloc_failed(fpu);
+ return -ENOMEM;
+ }

Also, I tried to justify this to Boris [2]:

>> Maybe it is possible to backtrack this allocation failure out of #NM
>> handling. But the tracepoint can provide a clear context, although limited
>> to those using it.

> Yes, add it when it is really needed. Not slapping it proactively and
> hoping for any potential usage.

Let me know if you have a better way.



 \ /
  Last update: 2021-03-29 20:16    [W:0.235 / U:4.920 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site