* [PATCH] powerpc/vas: do not set uses_vas for kernel windows
@ 2018-02-08 9:18 Nicholas Piggin
2018-02-10 4:57 ` Sukadev Bhattiprolu
2018-02-14 5:43 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Piggin @ 2018-02-08 9:18 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nicholas Piggin, Sukadev Bhattiprolu
cp_abort is only required or user windows, because kernel context
must not be preempted between a copy/paste pair.
Without this patch, the init task gets used_vas set when it runs
the nx842_powernv_init initcall, which opens windows for kernel
usage.
used_vas is then never cleared anywhere, so it gets propagated
into all other tasks. It's a property of the address space, so it
should really be cleared when a new mm is created (or in dup_mmap
if the mmaps are marked as VM_DONTCOPY). For now we seem to have
no such driver, so leave that for another patch.
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/platforms/powernv/vas-window.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c
index 2b3eb01ab110..b7c53a51c31b 100644
--- a/arch/powerpc/platforms/powernv/vas-window.c
+++ b/arch/powerpc/platforms/powernv/vas-window.c
@@ -1063,16 +1063,16 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop,
rc = PTR_ERR(txwin->paste_kaddr);
goto free_window;
}
+ } else {
+ /*
+ * A user mapping must ensure that context switch issues
+ * CP_ABORT for this thread.
+ */
+ rc = set_thread_uses_vas();
+ if (rc)
+ goto free_window;
}
- /*
- * Now that we have a send window, ensure context switch issues
- * CP_ABORT for this thread.
- */
- rc = -EINVAL;
- if (set_thread_uses_vas() < 0)
- goto free_window;
-
set_vinst_win(vinst, txwin);
return txwin;
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/vas: do not set uses_vas for kernel windows
2018-02-08 9:18 [PATCH] powerpc/vas: do not set uses_vas for kernel windows Nicholas Piggin
@ 2018-02-10 4:57 ` Sukadev Bhattiprolu
2018-02-14 5:43 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Sukadev Bhattiprolu @ 2018-02-10 4:57 UTC (permalink / raw)
To: Nicholas Piggin; +Cc: linuxppc-dev
Nicholas Piggin [npiggin@gmail.com] wrote:
> cp_abort is only required or user windows, because kernel context
> must not be preempted between a copy/paste pair.
Yes, that is a good optimization.
>
> Without this patch, the init task gets used_vas set when it runs
> the nx842_powernv_init initcall, which opens windows for kernel
> usage.
>
> used_vas is then never cleared anywhere, so it gets propagated
> into all other tasks. It's a property of the address space, so it
> should really be cleared when a new mm is created (or in dup_mmap
> if the mmaps are marked as VM_DONTCOPY). For now we seem to have
> no such driver, so leave that for another patch.
If the parent process has the paste address mapped, the child inherits
those mappings - so we can't clear the ->used_vas in a process until
it has unmapped all the send windows right?
If VM_DONCOPY is set, then we can clear it.
>
> Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: powerpc/vas: do not set uses_vas for kernel windows
2018-02-08 9:18 [PATCH] powerpc/vas: do not set uses_vas for kernel windows Nicholas Piggin
2018-02-10 4:57 ` Sukadev Bhattiprolu
@ 2018-02-14 5:43 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2018-02-14 5:43 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev; +Cc: Sukadev Bhattiprolu, Nicholas Piggin
On Thu, 2018-02-08 at 09:18:38 UTC, Nicholas Piggin wrote:
> cp_abort is only required or user windows, because kernel context
> must not be preempted between a copy/paste pair.
>
> Without this patch, the init task gets used_vas set when it runs
> the nx842_powernv_init initcall, which opens windows for kernel
> usage.
>
> used_vas is then never cleared anywhere, so it gets propagated
> into all other tasks. It's a property of the address space, so it
> should really be cleared when a new mm is created (or in dup_mmap
> if the mmaps are marked as VM_DONTCOPY). For now we seem to have
> no such driver, so leave that for another patch.
>
> Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> Reviewed-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/b00b62898631b756c3e123542bbb04
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-14 5:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 9:18 [PATCH] powerpc/vas: do not set uses_vas for kernel windows Nicholas Piggin
2018-02-10 4:57 ` Sukadev Bhattiprolu
2018-02-14 5:43 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.