Re: [Xen-devel] [PATCH v5 1/6] arm/arm64/xen: hypercall.h add includes guards

2020-01-08 Thread Pavel Tatashin
On Mon, Jan 6, 2020 at 12:19 PM Stefano Stabellini wrote: > > On Thu, 2 Jan 2020, Pavel Tatashin wrote: > > The arm and arm64 versions of hypercall.h are missing the include > > guards. This is needed because C inlines for privcmd_call are going to > > be added to the f

[Xen-devel] [PATCH v5 6/6] arm64: remove the rest of asm-uaccess.h

2020-01-02 Thread Pavel Tatashin
counterparts, it is a good idea to check that PAN is in correct state on every enable/disable calls. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/asm-uaccess.h | 39 arch/arm64/kernel/entry.S| 27 ++- arch/arm64/lib

[Xen-devel] [PATCH v5 5/6] arm64: move ARM64_HAS_CACHE_DIC/_IDC from asm to C

2020-01-02 Thread Pavel Tatashin
. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/cacheflush.h | 19 +++ arch/arm64/mm/cache.S | 27 +-- arch/arm64/mm/flush.c | 1 + 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/arch/arm64/include/asm

[Xen-devel] [PATCH v5 4/6] arm64: remove __asm_flush_icache_range

2020-01-02 Thread Pavel Tatashin
__flush_icache_range(). Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/cacheflush.h | 5 + arch/arm64/mm/cache.S | 14 -- arch/arm64/mm/flush.c | 2 +- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h

[Xen-devel] [PATCH v5 1/6] arm/arm64/xen: hypercall.h add includes guards

2020-01-02 Thread Pavel Tatashin
The arm and arm64 versions of hypercall.h are missing the include guards. This is needed because C inlines for privcmd_call are going to be added to the files. Signed-off-by: Pavel Tatashin Reviewed-by: Julien Grall --- arch/arm/include/asm/xen/hypercall.h | 4 arch/arm64/include/asm

[Xen-devel] [PATCH v5 3/6] arm64: remove uaccess_ttbr0 asm macros from cache functions

2020-01-02 Thread Pavel Tatashin
to have a C wrapper. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/asm-uaccess.h | 22 arch/arm64/include/asm/cacheflush.h | 39 +--- arch/arm64/mm/cache.S| 36 ++--- arch/arm64/mm/flush.c

[Xen-devel] [PATCH v5 0/6] Use C inlines for uaccess

2020-01-02 Thread Pavel Tatashin
: https://lore.kernel.org/lkml/20191127184453.229321-1-pasha.tatas...@soleen.com v2: https://lore.kernel.org/lkml/20191122022406.590141-1-pasha.tatas...@soleen.com v1: https://lore.kernel.org/lkml/20191121184805.414758-1-pasha.tatas...@soleen.com Pavel Tatashin (6): arm/arm64/xen: hypercall.h add

[Xen-devel] [PATCH v5 2/6] arm/arm64/xen: use C inlines for privcmd_call

2020-01-02 Thread Pavel Tatashin
privcmd_call requires to enable access to userspace for the duration of the hypercall. Currently, this is done via assembly macros. Change it to C inlines instead. Signed-off-by: Pavel Tatashin Acked-by: Stefano Stabellini Reviewed-by: Julien Grall --- arch/arm/include/asm/xen/hypercall.h

Re: [Xen-devel] [PATCH v4 1/6] arm/arm64/xen: hypercall.h add includes guards

2019-12-18 Thread Pavel Tatashin
> > /* > > - * Whenever we re-enter userspace, the domains should always be > > + * Whenever we re-enter kernel, the domains should always be > > This feels unrelated from the rest of the patch and probably want an > explanation. So I think this want to be in a separate patch. I

Re: [Xen-devel] [PATCH v4 2/6] arm/arm64/xen: use C inlines for privcmd_call

2019-12-18 Thread Pavel Tatashin
On Mon, Dec 16, 2019 at 3:41 PM Julien Grall wrote: > > Hello, > > On 04/12/2019 23:20, Pavel Tatashin wrote: > > privcmd_call requires to enable access to userspace for the > > duration of the hypercall. > > > > Currently, this is done via assembly macros

[Xen-devel] [PATCH v4 1/6] arm/arm64/xen: hypercall.h add includes guards

2019-12-04 Thread Pavel Tatashin
The arm and arm64 versions of hypercall.h are missing the include guards. This is needed because C inlines for privcmd_call are going to be added to the files. Also fix a comment. Signed-off-by: Pavel Tatashin --- arch/arm/include/asm/assembler.h | 2 +- arch/arm/include/asm/xen

[Xen-devel] [PATCH v4 0/6] Use C inlines for uaccess

2019-12-04 Thread Pavel Tatashin
discussions: v3: https://lore.kernel.org/lkml/20191127184453.229321-1-pasha.tatas...@soleen.com v2: https://lore.kernel.org/lkml/20191122022406.590141-1-pasha.tatas...@soleen.com v1: https://lore.kernel.org/lkml/20191121184805.414758-1-pasha.tatas...@soleen.com Pavel Tatashin (6): arm/arm64/xen

[Xen-devel] [PATCH v4 3/6] arm64: remove uaccess_ttbr0 asm macros from cache functions

2019-12-04 Thread Pavel Tatashin
to have a C wrapper. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/asm-uaccess.h | 22 - arch/arm64/include/asm/cacheflush.h | 35 --- arch/arm64/mm/cache.S| 36 ++-- arch/arm64/mm/flush.c

[Xen-devel] [PATCH v4 4/6] arm64: remove __asm_flush_icache_range

2019-12-04 Thread Pavel Tatashin
__flush_icache_range(). Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/cacheflush.h | 5 + arch/arm64/mm/cache.S | 14 -- arch/arm64/mm/flush.c | 2 +- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h

[Xen-devel] [PATCH v4 6/6] arm64: remove the rest of asm-uaccess.h

2019-12-04 Thread Pavel Tatashin
counterparts, it is a good idea to check that PAN is in correct state on every enable/disable calls. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/asm-uaccess.h | 39 arch/arm64/kernel/entry.S| 27 ++- arch/arm64/lib

[Xen-devel] [PATCH v4 2/6] arm/arm64/xen: use C inlines for privcmd_call

2019-12-04 Thread Pavel Tatashin
privcmd_call requires to enable access to userspace for the duration of the hypercall. Currently, this is done via assembly macros. Change it to C inlines instead. Signed-off-by: Pavel Tatashin Acked-by: Stefano Stabellini --- arch/arm/include/asm/xen/hypercall.h | 6 ++ arch/arm/xen

[Xen-devel] [PATCH v4 5/6] arm64: move ARM64_HAS_CACHE_DIC/_IDC from asm to C

2019-12-04 Thread Pavel Tatashin
. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/cacheflush.h | 19 +++ arch/arm64/mm/cache.S | 27 +-- arch/arm64/mm/flush.c | 1 + 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/arch/arm64/include/asm

Re: [Xen-devel] [PATCH 2/3] arm64: remove uaccess_ttbr0 asm macros from cache functions

2019-12-04 Thread Pavel Tatashin
On Thu, Nov 28, 2019 at 9:51 AM Mark Rutland wrote: > > On Wed, Nov 27, 2019 at 01:44:52PM -0500, Pavel Tatashin wrote: > > We currently duplicate the logic to enable/disable uaccess via TTBR0, > > with C functions and assembly macros. This is a maintenenace burden > &g

Re: [Xen-devel] [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call

2019-12-04 Thread Pavel Tatashin
On Fri, Nov 29, 2019 at 10:05 AM Julien Grall wrote: > > Hi, > > On 27/11/2019 18:44, Pavel Tatashin wrote: > > diff --git a/arch/arm64/include/asm/xen/hypercall.h > > b/arch/arm64/include/asm/xen/hypercall.h > > index 3522cbaed316..1a74fb28607f 100644 > &

Re: [Xen-devel] [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call

2019-12-04 Thread Pavel Tatashin
On Fri, Nov 29, 2019 at 10:10 AM Andrew Cooper wrote: > > On 29/11/2019 15:05, Julien Grall wrote: > > Hi, > > > > On 27/11/2019 18:44, Pavel Tatashin wrote: > >> diff --git a/arch/arm64/include/asm/xen/hypercall.h > >> b/arch/arm64/include/a

Re: [Xen-devel] [PATCH 0/3] Use C inlines for uaccess

2019-11-27 Thread Pavel Tatashin
Sorry, forgot to set the subject prefix correctly. It should be: [PATCH v3 0/3]. On Wed, Nov 27, 2019 at 1:44 PM Pavel Tatashin wrote: > > Changelog > v3: > - Added Acked-by from Stefano Stabellini > - Addressed comments from Mark Rutland > v2: >

[Xen-devel] [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call

2019-11-27 Thread Pavel Tatashin
privcmd_call requires to enable access to userspace for the duration of the hypercall. Currently, this is done via assembly macros. Change it to C inlines instead. Signed-off-by: Pavel Tatashin Acked-by: Stefano Stabellini --- arch/arm/include/asm/assembler.h | 2 +- arch/arm/include

[Xen-devel] [PATCH 3/3] arm64: remove the rest of asm-uaccess.h

2019-11-27 Thread Pavel Tatashin
counterparts, it is a good idea to check that PAN is in correct state on every enable/disable calls. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/asm-uaccess.h | 39 arch/arm64/kernel/entry.S| 27 ++- arch/arm64/lib

[Xen-devel] [PATCH 0/3] Use C inlines for uaccess

2019-11-27 Thread Pavel Tatashin
macros to C inlines. These patches apply against linux-next. I boot tested ARM64, and compile tested ARM change Pavel Tatashin (3): arm/arm64/xen: use C inlines for privcmd_call arm64: remove uaccess_ttbr0 asm macros from cache functions arm64: remove the rest of asm-uaccess.h arch/arm

[Xen-devel] [PATCH 2/3] arm64: remove uaccess_ttbr0 asm macros from cache functions

2019-11-27 Thread Pavel Tatashin
to have a C wrapper. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/asm-uaccess.h | 22 --- arch/arm64/include/asm/cacheflush.h | 39 -- arch/arm64/mm/cache.S| 41 +--- arch/arm64/mm/flush.c

Re: [Xen-devel] [PATCH v2 3/3] arm64: remove the rest of asm-uaccess.h

2019-11-27 Thread Pavel Tatashin
On Wed, Nov 27, 2019 at 12:01 PM Mark Rutland wrote: > > On Wed, Nov 27, 2019 at 11:09:35AM -0500, Pavel Tatashin wrote: > > On Wed, Nov 27, 2019 at 11:03 AM Mark Rutland wrote: > > > > > > On Wed, Nov 27, 2019 at 10:31:54AM -0500, Pavel Tatashin wrote: > >

Re: [Xen-devel] [PATCH v2 3/3] arm64: remove the rest of asm-uaccess.h

2019-11-27 Thread Pavel Tatashin
On Wed, Nov 27, 2019 at 11:03 AM Mark Rutland wrote: > > On Wed, Nov 27, 2019 at 10:31:54AM -0500, Pavel Tatashin wrote: > > On Wed, Nov 27, 2019 at 10:12 AM Mark Rutland wrote: > > > > > > On Thu, Nov 21, 2019 at 09:24:06PM -0500, Pavel Tatashin wrote: >

Re: [Xen-devel] [PATCH v2 3/3] arm64: remove the rest of asm-uaccess.h

2019-11-27 Thread Pavel Tatashin
On Wed, Nov 27, 2019 at 10:12 AM Mark Rutland wrote: > > On Thu, Nov 21, 2019 at 09:24:06PM -0500, Pavel Tatashin wrote: > > The __uaccess_ttbr0_disable and __uaccess_ttbr0_enable, > > are the last two macros defined in asm-uaccess.h. > > > > Replace them with C wrap

Re: [Xen-devel] [PATCH v2 2/3] arm64: remove uaccess_ttbr0 asm macros from cache functions

2019-11-27 Thread Pavel Tatashin
Hi Mark, Thank you for reviewing this work. > A commit message should provide rationale, rather than just a > description of the patch. Something like: > > | We currently duplicate the logic to enable/disable uaccess via TTBR0, > | with C functions and assembly macros. This is a maintenenace

Re: [Xen-devel] [PATCH v2 0/3] Use C inlines for uaccess

2019-11-26 Thread Pavel Tatashin
for this purpose to thread_info. 3. Keep as is, and do not add extra overhead for this hardening. Thank you, Pasha On Thu, Nov 21, 2019 at 9:24 PM Pavel Tatashin wrote: > > Changelog > v2: > - Addressed Russell King's concern by not adding > uaccess_* to ARM. >

Re: [Xen-devel] [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call

2019-11-21 Thread Pavel Tatashin
> > That may be, but be very careful that you only use them in ARMv7-only > > code. Using them elsewhere is unsafe as the domain register is used > > for other purposes, and merely blatting over it (as your > > uaccess_enable and uaccess_disable functions do) is unsafe. > > In fact, I'll turn

[Xen-devel] [PATCH v2 0/3] Use C inlines for uaccess

2019-11-21 Thread Pavel Tatashin
ARM changes. Pavel Tatashin (3): arm/arm64/xen: use C inlines for privcmd_call arm64: remove uaccess_ttbr0 asm macros from cache functions arm64: remove the rest of asm-uaccess.h arch/arm/include/asm/assembler.h | 2 +- arch/arm/include/asm/xen/hypercall.h | 10 + arch/arm/xen

[Xen-devel] [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call

2019-11-21 Thread Pavel Tatashin
privcmd_call requires to enable access to userspace for the duration of the hypercall. Currently, this is done via assembly macros. Change it to C inlines instead. Signed-off-by: Pavel Tatashin --- arch/arm/include/asm/assembler.h | 2 +- arch/arm/include/asm/uaccess.h | 32

[Xen-devel] [PATCH v2 3/3] arm64: remove the rest of asm-uaccess.h

2019-11-21 Thread Pavel Tatashin
The __uaccess_ttbr0_disable and __uaccess_ttbr0_enable, are the last two macros defined in asm-uaccess.h. Replace them with C wrappers and call C functions from kernel_entry and kernel_exit. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/asm-uaccess.h | 38

[Xen-devel] [PATCH v2 1/3] arm/arm64/xen: use C inlines for privcmd_call

2019-11-21 Thread Pavel Tatashin
privcmd_call requires to enable access to userspace for the duration of the hypercall. Currently, this is done via assembly macros. Change it to C inlines instead. Signed-off-by: Pavel Tatashin --- arch/arm/include/asm/assembler.h | 2 +- arch/arm/include/asm/xen/hypercall.h | 10

Re: [Xen-devel] [PATCH 3/3] arm64: remove the rest of asm-uaccess.h

2019-11-21 Thread Pavel Tatashin
> This is not related to arm64 or to the changes in the description, > but the change itself is OK. Whether you keep it in this patch, > or choose to split it out feel free to add > > Acked-by: Max Filippov # for xtensa bits Sorry, this was accidental change. I will remove it from the next

[Xen-devel] [PATCH 0/3] Use C inlines for uaccess

2019-11-21 Thread Pavel Tatashin
Convert the remaining uaccess_* calls from ASM macros to C inlines. These patches apply against linux-next. I boot tested ARM64, and compile tested ARM changes. Pavel Tatashin (3): arm/arm64/xen: use C inlines for privcmd_call arm64: remove uaccess_ttbr0 asm macros from cache functions

Re: [Xen-devel] [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call

2019-11-21 Thread Pavel Tatashin
> > +#ifdef CONFIG_CPU_SW_DOMAIN_PAN > > +static __always_inline void uaccess_enable(void) > > +{ > > + unsigned long val = DACR_UACCESS_ENABLE; > > + > > + asm volatile("mcr p15, 0, %0, c3, c0, 0" : : "r" (val)); > > + isb(); > > +} > > + > > +static __always_inline void

[Xen-devel] [PATCH v2 2/3] arm64: remove uaccess_ttbr0 asm macros from cache functions

2019-11-21 Thread Pavel Tatashin
Replace the uaccess_ttbr0_disable/uaccess_ttbr0_enable via inline variants, and remove asm macros. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/asm-uaccess.h | 22 arch/arm64/include/asm/cacheflush.h | 38 +--- arch/arm64/mm/cache.S

[Xen-devel] [PATCH 3/3] arm64: remove the rest of asm-uaccess.h

2019-11-21 Thread Pavel Tatashin
The __uaccess_ttbr0_disable and __uaccess_ttbr0_enable, are the last two macros defined in asm-uaccess.h. Replace them with C wrappers and call C functions from kernel_entry and kernel_exit. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/asm-uaccess.h | 38

[Xen-devel] [PATCH 2/3] arm64: remove uaccess_ttbr0 asm macros from cache functions

2019-11-21 Thread Pavel Tatashin
Replace the uaccess_ttbr0_disable/uaccess_ttbr0_enable via inline variants, and remove asm macros. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/asm-uaccess.h | 22 arch/arm64/include/asm/cacheflush.h | 38 +--- arch/arm64/mm/cache.S

[Xen-devel] [v2 1/1] xen, mm: Allow deferred page initialization for xen pv domains

2018-02-26 Thread Pavel Tatashin
ialization is enabled, the rest of struct pages are going to be initialized later in boot once page_alloc_init_late() is called. xen_after_bootmem() walks page table's pages and marks them pinned. Signed-off-by: Pavel Tatashin <pasha.tatas...@oracle.com> --- arch/x86/include/asm/x86_init.h |

[Xen-devel] [v2 0/1] Allow deferred page initialization for xen pv domains

2018-02-26 Thread Pavel Tatashin
be all zero. CONFIG_DEBUG_VM_PGFLAGS=y Verifies that we do not access struct pages flags while memory is still poisoned (struct pages are not initialized yet). Pavel Tatashin (1): xen, mm: Allow deferred page initialization for xen pv domains arch/x86/include/asm/x86_init.h | 2 ++ arch/x86

Re: [Xen-devel] [v1 1/1] xen, mm: Allow deferred page initialization for xen pv domains

2018-02-26 Thread Pavel Tatashin
Hi Juergen, Thank you for taking a look at this patch, I will address your comments, and send out an updated patch. >> extern void default_banner(void); >> >> +static inline void paravirt_after_bootmem(void) >> +{ >> + pv_init_ops.after_bootmem(); >> +} >> + > > Putting this in the paravirt

[Xen-devel] [v1 0/1] Allow deferred page initialization for xen pv

2018-02-23 Thread Pavel Tatashin
yet). Pavel Tatashin (1): xen, mm: Allow deferred page initalization for xen pv domains arch/x86/include/asm/paravirt.h | 9 + arch/x86/include/asm/paravirt_types.h | 3 +++ arch/x86/kernel/paravirt.c| 1 + arch/x86/mm/init_32.c | 1 + arch/x86/mm

[Xen-devel] [v1 1/1] xen, mm: Allow deferred page initialization for xen pv domains

2018-02-23 Thread Pavel Tatashin
is enabled, the rest of struct pages are going to be initialized later in boot once page_alloc_init_late() is called. xen_after_bootmem() is xen's implementation of pv_init_ops.after_bootmem(), we walk page table and mark every page as pinned. Signed-off-by: Pavel Tatashin <pasha.tatas.

Re: [Xen-devel] [RESEND v2] mm: don't defer struct page initialization for Xen pv guests

2018-02-17 Thread Pavel Tatashin
Reviewed-by: Pavel Tatashin <pasha.tatas...@oracle.com> This is unique for Xen, so this particular issue won't effect other configurations. I am going to investigate if there is a way to re-enable deferred page initialization on xen guests. Pavel On 02/16/2018 03:40 PM, Andrew Morton

Re: [Xen-devel] [PATCH] mm: don't defer struct page initialization for Xen pv guests

2018-02-16 Thread Pavel Tatashin
On 02/16/2018 09:02 AM, Juergen Gross wrote: On 16/02/18 14:59, Michal Hocko wrote: [CC Pavel] On Fri 16-02-18 14:37:26, Juergen Gross wrote: Commit f7f99100d8d95dbcf09e0216a143211e79418b9f ("mm: stop zeroing memory during allocation in vmemmap") broke Xen pv domains in some configurations,

Re: [Xen-devel] Linux 4.15-rc6 + xen-unstable: BUG: unable to handle kernel NULL pointer dereference at (null), [ 0.000000] IP: zero_resv_unavail+0x8e/0xe1

2018-01-09 Thread Pavel Tatashin
ion result is: a4a3ede2132ae0863e2d43e06f9b5697c51a7a3b is the first bad commit commit a4a3ede2132ae0863e2d43e06f9b5697c51a7a3b Author: Pavel Tatashin <pasha.tatas...@oracle.com> Date: Wed Nov 15 17:36:31 2017 -0800 mm: zero reserved and unavailable struct pages Some memory is reserved