[PATCH v2] x86/efi: drop task_lock() from efi_switch_mm()

2018-07-24 Thread Sebastian Andrzej Siewior
efi_switch_mm() is a wrapper around switch_mm() which saves current's ->active_mm, sets the requests mm as ->active_mm and invokes switch_mm(). I don't think that task_lock() is required during that procedure. It protects ->mm which isn't changed here. It needs to be mentioned that during the

RE: [RFC PATCH] x86/efi: drop task_lock() from efi_switch_mm()

2018-07-24 Thread Prakhya, Sai Praneeth
> > Because local_save_flags() does not disable interrupts?? > > now that you say so, it does make sense… > > > > Anyway, I would still like to get rid of task_lock() in efi_switch_mm(). > > > Any objections to that? > > > > No, not at all. > okay. I don’t have any either and thanks for the

Re: [RFC PATCH] x86/efi: drop task_lock() from efi_switch_mm()

2018-07-24 Thread Sebastian Andrzej Siewior
On 2018-07-24 18:19:15 [+0200], Ard Biesheuvel wrote: > > Regarding the workqueue in commit 3eb420e70d87 ("efi: Use a work queue > > to invoke EFI Runtime Services"). The efi_call_virt_pointer() function > > uses local_save_flags() while invoking the EFI function. Why does commit > > message say

Re: [RFC PATCH] x86/efi: drop task_lock() from efi_switch_mm()

2018-07-24 Thread Ard Biesheuvel
On 24 July 2018 at 18:02, Sebastian Andrzej Siewior wrote: > On 2018-07-24 17:32:14 [+0200], Ard Biesheuvel wrote: >> Please refer to what has been queued up in tip:efi/core. Sai has >> implemented a work queue for EFI calls so they occur from a kernel >> thread, and the mixed mode locking has

Re: [RFC PATCH] x86/efi: drop task_lock() from efi_switch_mm()

2018-07-24 Thread Sebastian Andrzej Siewior
On 2018-07-24 17:32:14 [+0200], Ard Biesheuvel wrote: > Please refer to what has been queued up in tip:efi/core. Sai has > implemented a work queue for EFI calls so they occur from a kernel > thread, and the mixed mode locking has been fixed as well. I see commit 83a0a2ea0b99 ("efi/x86: Prevent

Re: [RFC PATCH] x86/efi: drop task_lock() from efi_switch_mm()

2018-07-24 Thread Ard Biesheuvel
On 24 July 2018 at 17:29, Sebastian Andrzej Siewior wrote: > On 2018-07-24 17:00:09 [+0200], Peter Zijlstra wrote: >> On Tue, Jul 24, 2018 at 04:35:09PM +0200, Sebastian Andrzej Siewior wrote: >> > I doubt that there any need to set ->active_mm. It is used by the >> > scheduler to keep track of

Re: [RFC PATCH] x86/efi: drop task_lock() from efi_switch_mm()

2018-07-24 Thread Peter Zijlstra
On Tue, Jul 24, 2018 at 04:35:09PM +0200, Sebastian Andrzej Siewior wrote: > I doubt that there any need to set ->active_mm. It is used by the > scheduler to keep track of the "currently used mm" so it can reuse one > for the kernel thread which does not own one and take a reference on it > so it

[RFC PATCH] x86/efi: drop task_lock() from efi_switch_mm()

2018-07-24 Thread Sebastian Andrzej Siewior
During invocations of EFI functions efi_switch_mm() is used to set the active mm to borrow a different MM for a while. This used for instance by efi_call_virt_pointer(): efi_call_virt_pointer() - arch_efi_call_virt_setup() - preempt_disable() -