lkml.org 
[lkml]   [2022]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2] panic, kexec: Make __crash_kexec() NMI safe
Date
On 24/06/22 09:30, Baoquan He wrote:
> On 06/20/22 at 12:15pm, Valentin Schneider wrote:
>> @@ -94,14 +94,20 @@ static int do_kexec_load(unsigned long entry, unsigned long nr_segments,
>> /*
>> * Because we write directly to the reserved memory region when loading
>> * crash kernels we need a mutex here to prevent multiple crash kernels
>> - * from attempting to load simultaneously, and to prevent a crash kernel
>> - * from loading over the top of a in use crash kernel.
>> - *
>> - * KISS: always take the mutex.
>> + * from attempting to load simultaneously.
>> */
>> if (!mutex_trylock(&kexec_mutex))
>> return -EBUSY;
>
> So kexec_mutex is degenerated to only avoid simultaneous loading,
> should we rename to reflect that?, e.g kexec_load_mutex.
>

It's also serializing crash_get_memory_size() and crash_shrink_memory();
more generally it should still be the preferred serialization mechanism as
it's a "proper" lock visible by instrumentation, the atomic variable is a
side character for the NMI case.

\
 
 \ /
  Last update: 2022-06-24 15:38    [W:1.003 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site