Re: [PATCH 12/14] x86: remove address space overrides using set_fs()

2020-09-04 Thread Christoph Hellwig
On Fri, Sep 04, 2020 at 08:38:13AM +0200, Christoph Hellwig wrote: > > Wait a sec... how is that supposed to build with X86_5LEVEL? Do you mean > > > > #define LOAD_TASK_SIZE_MINUS_N(n) \ > > ALTERNATIVE __stringify(mov $((1 << 47) - 4096 - (n)),%rdx), \ >

Re: [PATCH 12/14] x86: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
On Fri, Sep 04, 2020 at 03:55:10AM +0100, Al Viro wrote: > On Thu, Sep 03, 2020 at 04:22:40PM +0200, Christoph Hellwig wrote: > > > diff --git a/arch/x86/lib/getuser.S b/arch/x86/lib/getuser.S > > index c8a85b512796e1..94f7be4971ed04 100644 > > --- a/arch/x86/lib/getuser.

Re: [PATCH 0/2] dma-mapping: update default segment_boundary_mask

2020-09-03 Thread Christoph Hellwig
Applied with the recommendation from Michael folded in.

Re: [PATCH 1/2] dma-mapping: introduce dma_get_seg_boundary_nr_pages()

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 01:57:39PM +0300, Andy Shevchenko wrote: > > +{ > > + if (!dev) > > + return (U32_MAX >> page_shift) + 1; > > + return (dma_get_seg_boundary(dev) >> page_shift) + 1; > > Can it be better to do something like > unsigned long boundary = dev ? dma_g

Re: [PATCH 14/14] powerpc: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 05:49:09PM +0200, Christoph Hellwig wrote: > On Thu, Sep 03, 2020 at 05:43:25PM +0200, Christophe Leroy wrote: > > > > > > Le 03/09/2020 à 16:22, Christoph Hellwig a écrit : > >> Stop providing the possibility to override the address space usin

Re: [PATCH 14/14] powerpc: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 05:43:25PM +0200, Christophe Leroy wrote: > > > Le 03/09/2020 à 16:22, Christoph Hellwig a écrit : >> Stop providing the possibility to override the address space using >> set_fs() now that there is no need for that any more. >> >>

Re: remove the last set_fs() in common code, and remove it for x86 and powerpc v3

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 03:36:29PM +0100, Al Viro wrote: > FWIW, vfs.git#for-next is always a merge of independent branches; I don't > put stuff directly into #for-next - too easy to lose that way. > > IOW, that would be something like #base.set_fs, included into #for-next > merge set. And I've n

Re: remove the last set_fs() in common code, and remove it for x86 and powerpc v3

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 03:28:03PM +0100, Al Viro wrote: > On Thu, Sep 03, 2020 at 04:22:28PM +0200, Christoph Hellwig wrote: > > > Besides x86 and powerpc I plan to eventually convert all other > > architectures, although this will be a slow process, starting with the > &

[PATCH 14/14] powerpc: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
Stop providing the possibility to override the address space using set_fs() now that there is no need for that any more. Signed-off-by: Christoph Hellwig --- arch/powerpc/Kconfig | 1 - arch/powerpc/include/asm/processor.h | 7 arch/powerpc/include/asm/thread_info.h

[PATCH 13/14] powerpc: use non-set_fs based maccess routines

2020-09-03 Thread Christoph Hellwig
Provide __get_kernel_nofault and __put_kernel_nofault routines to implement the maccess routines without messing with set_fs and without opening up access to user space. Signed-off-by: Christoph Hellwig --- arch/powerpc/include/asm/uaccess.h | 16 1 file changed, 16 insertions

[PATCH 07/14] uaccess: add infrastructure for kernel builds with set_fs()

2020-09-03 Thread Christoph Hellwig
: Christoph Hellwig Reviewed-by: Kees Cook --- arch/Kconfig| 3 +++ arch/alpha/Kconfig | 1 + arch/arc/Kconfig| 1 + arch/arm/Kconfig| 1 + arch/arm64/Kconfig | 1 + arch/c6x/Kconfig| 1 + arch/csky/Kconfig | 1 + arch/h8300/Kconfig | 1

[PATCH 12/14] x86: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
hardcoded virtual address bits to escape the fact that TASK_SIZE_MAX isn't actually a constant when 5-level page tables are enabled. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/Kconfig | 1 - arch/x86/ia32/ia32_aout.c | 1 - arch/x86/includ

[PATCH 11/14] x86: make TASK_SIZE_MAX usable from assembly code

2020-09-03 Thread Christoph Hellwig
. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/include/asm/page_32_types.h | 4 ++-- arch/x86/include/asm/page_64_types.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h

[PATCH 10/14] x86: move PAGE_OFFSET, TASK_SIZE & friends to page_{32, 64}_types.h

2020-09-03 Thread Christoph Hellwig
At least for 64-bit this moves them closer to some of the defines they are based on, and it prepares for using the TASK_SIZE_MAX definition from assembly. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/include/asm/page_32_types.h | 11 +++ arch/x86/include/asm

[PATCH 09/14] lkdtm: remove set_fs-based tests

2020-09-03 Thread Christoph Hellwig
Once we can't manipulate the address limit, we also can't test what happens when the manipulation is abused. Signed-off-by: Christoph Hellwig --- drivers/misc/lkdtm/bugs.c | 10 -- drivers/misc/lkdtm/core.c | 2 -- drivers/misc/lkd

[PATCH 08/14] test_bitmap: remove user bitmap tests

2020-09-03 Thread Christoph Hellwig
We can't run the tests for userspace bitmap parsing if set_fs() doesn't exist, and it is about to go away for x86, powerpc with other major architectures to follow. Signed-off-by: Christoph Hellwig --- lib/test_bitmap.c | 91 +++ 1 file c

[PATCH 06/14] fs: don't allow splice read/write without explicit ops

2020-09-03 Thread Christoph Hellwig
bandwidth instances all provide a ->splice_read, so this just removes support for various device drivers and procfs/debugfs files. If splice support for any of those turns out to be important it can be added back by switching them to the iter ops and using generic_file_splice_read. Signed-off-

[PATCH 05/14] fs: don't allow kernel reads and writes without iter ops

2020-09-03 Thread Christoph Hellwig
ent semantics for messed up enough drivers. Also fails the kernel access to them in that case. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- fs/read_write.c | 67 +++-- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/fs/

[PATCH 03/14] proc: add a read_iter method to proc proc_ops

2020-09-03 Thread Christoph Hellwig
This will allow proc files to implement iter read semantics. Signed-off-by: Christoph Hellwig --- fs/proc/inode.c | 53 ++--- include/linux/proc_fs.h | 1 + 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/fs/proc/inode.c b/fs/proc

remove the last set_fs() in common code, and remove it for x86 and powerpc v3

2020-09-03 Thread Christoph Hellwig
Hi all, this series removes the last set_fs() used to force a kernel address space for the uaccess code in the kernel read/write/splice code, and then stops implementing the address space overrides entirely for x86 and powerpc. [Note to Linus: I'd like to get this into linux-next rather earlier t

[PATCH 04/14] sysctl: Convert to iter interfaces

2020-09-03 Thread Christoph Hellwig
From: "Matthew Wilcox (Oracle)" Using the read_iter/write_iter interfaces allows for in-kernel users to set sysctls without using set_fs(). Also, the buffer is a string, so give it the real type of 'char *', not void *. Signed-off-by: Matthew Wilcox (Oracle) Signed-off-b

[PATCH 01/14] proc: remove a level of indentation in proc_get_inode

2020-09-03 Thread Christoph Hellwig
Just return early on inode allocation failure. Signed-off-by: Christoph Hellwig --- fs/proc/inode.c | 72 + 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 28d6105e908e4c..016b1302cbabc0

[PATCH 02/14] proc: cleanup the compat vs no compat file ops

2020-09-03 Thread Christoph Hellwig
Instead of providing a special no-compat version provide a special compat version for operations with ->compat_ioctl. Signed-off-by: Christoph Hellwig --- fs/proc/inode.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/proc/inode.c b/fs/proc/inode.c in

Re: [PATCH 10/10] powerpc: remove address space overrides using set_fs()

2020-09-03 Thread Christoph Hellwig
On Wed, Sep 02, 2020 at 11:02:22AM -0700, Linus Torvalds wrote: > I don't see why this change would make any difference. Me neither, but while looking at a different project I did spot places that actually do an access_ok with len 0, that's why I wanted him to try. That being said: Christophe are

Re: [PATCH 10/10] powerpc: remove address space overrides using set_fs()

2020-09-02 Thread Christoph Hellwig
On Wed, Sep 02, 2020 at 08:15:12AM +0200, Christophe Leroy wrote: >> -return 0; >> -return (size == 0 || size - 1 <= seg.seg - addr); >> +if (addr >= TASK_SIZE_MAX) >> +return false; >> +if (size == 0) >> +return false; > > __access_ok() was returning

Re: remove the last set_fs() in common code, and remove it for x86 and powerpc v2

2020-09-02 Thread Christoph Hellwig
On Tue, Sep 01, 2020 at 06:25:12PM +0100, Al Viro wrote: > On Tue, Sep 01, 2020 at 07:13:00PM +0200, Christophe Leroy wrote: > > > 10.92% dd [kernel.kallsyms] [k] iov_iter_zero > > Interesting... Could you get an instruction-level profile inside > iov_iter_zero(), > along with the d

Re: [PATCH 05/10] lkdtm: disable set_fs-based tests for !CONFIG_SET_FS

2020-09-02 Thread Christoph Hellwig
On Tue, Sep 01, 2020 at 11:57:37AM -0700, Kees Cook wrote: > On Sat, Aug 29, 2020 at 11:24:06AM +0200, Christoph Hellwig wrote: > > On Thu, Aug 27, 2020 at 11:06:28AM -0700, Linus Torvalds wrote: > > > On Thu, Aug 27, 2020 at 8:00 AM Christoph Hellwig wrote: > > &

Re: [RESEND][PATCH 0/7] Avoid overflow at boundary_size

2020-09-01 Thread Christoph Hellwig
On Tue, Sep 01, 2020 at 12:54:01AM -0700, Nicolin Chen wrote: > Hi Christoph, > > On Tue, Sep 01, 2020 at 09:36:23AM +0200, Christoph Hellwig wrote: > > I really don't like all the open coded smarts in the various drivers. > > What do you think about a helper like the

Re: [RESEND][PATCH 0/7] Avoid overflow at boundary_size

2020-09-01 Thread Christoph Hellwig
I really don't like all the open coded smarts in the various drivers. What do you think about a helper like the one in the untested patch below (on top of your series). Also please include the original segment boundary patch with the next resend so that the series has the full context. diff --git

Re: [fs] ef30fb3c60: kernel write not supported for file /sys/kernel/softlockup_panic

2020-09-01 Thread Christoph Hellwig
Looks like since the start of this series we've grown new code to use kernel_write on sysctl files based on boot parameters. The good news is that this just means I need to resurrect the sysctl series as all that work was done already.

Re: [PATCH 5/5] powerpc: use the generic dma_ops_bypass mode

2020-08-30 Thread Christoph Hellwig
On Sun, Aug 30, 2020 at 11:04:21AM +0200, Cédric Le Goater wrote: > Hello, > > On 7/8/20 5:24 PM, Christoph Hellwig wrote: > > Use the DMA API bypass mechanism for direct window mappings. This uses > > common code and speed up the direct mapping case by avoiding indirect &g

Re: [PATCH 08/10] x86: remove address space overrides using set_fs()

2020-08-29 Thread Christoph Hellwig
On Thu, Aug 27, 2020 at 11:15:12AM -0700, Linus Torvalds wrote: > > SYM_FUNC_START(__put_user_2) > > - ENTER > > - mov TASK_addr_limit(%_ASM_BX),%_ASM_BX > > + LOAD_TASK_SIZE_MAX > > sub $1,%_ASM_BX > > It's even more obvious here. We load a constant and then immediately

Re: [PATCH 05/10] lkdtm: disable set_fs-based tests for !CONFIG_SET_FS

2020-08-29 Thread Christoph Hellwig
On Thu, Aug 27, 2020 at 11:06:28AM -0700, Linus Torvalds wrote: > On Thu, Aug 27, 2020 at 8:00 AM Christoph Hellwig wrote: > > > > Once we can't manipulate the address limit, we also can't test what > > happens when the manipulation is abused. > > Just r

Re: [PATCH 01/10] fs: don't allow kernel reads and writes without iter ops

2020-08-29 Thread &#x27;Christoph Hellwig'
On Thu, Aug 27, 2020 at 03:58:02PM +, David Laight wrote: > Is there a real justification for that? > For system calls supplying both methods makes sense to avoid > the extra code paths for a simple read/write. Al asked for it as two of our four in-tree instances do have weird semantics, and w

Re: remove the last set_fs() in common code, and remove it for x86 and powerpc v2

2020-08-27 Thread Christoph Hellwig
> Diffstat: Actually no diffstat here as David Howells pointed out. Here we go: arch/Kconfig |3 arch/alpha/Kconfig |1 arch/arc/Kconfig |1 arch/arm/Kconfig |1 arch/arm64/Kconfig

[PATCH 10/10] powerpc: remove address space overrides using set_fs()

2020-08-27 Thread Christoph Hellwig
Stop providing the possibility to override the address space using set_fs() now that there is no need for that any more. Signed-off-by: Christoph Hellwig --- arch/powerpc/Kconfig | 1 - arch/powerpc/include/asm/processor.h | 7 --- arch/powerpc/include/asm/thread_info.h

[PATCH 08/10] x86: remove address space overrides using set_fs()

2020-08-27 Thread Christoph Hellwig
hardcoded virtual address bits to escape the fact that TASK_SIZE_MAX isn't actually a constant when 5-level page tables are enabled. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/Kconfig | 1 - arch/x86/ia32/ia32_aout.c | 1 - arch/x86/includ

[PATCH 09/10] powerpc: use non-set_fs based maccess routines

2020-08-27 Thread Christoph Hellwig
Provide __get_kernel_nofault and __put_kernel_nofault routines to implement the maccess routines without messing with set_fs and without opening up access to user space. Signed-off-by: Christoph Hellwig --- arch/powerpc/include/asm/uaccess.h | 16 1 file changed, 16 insertions

[PATCH 07/10] x86: make TASK_SIZE_MAX usable from assembly code

2020-08-27 Thread Christoph Hellwig
. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/include/asm/page_32_types.h | 4 ++-- arch/x86/include/asm/page_64_types.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h

[PATCH 06/10] x86: move PAGE_OFFSET, TASK_SIZE & friends to page_{32, 64}_types.h

2020-08-27 Thread Christoph Hellwig
At least for 64-bit this moves them closer to some of the defines they are based on, and it prepares for using the TASK_SIZE_MAX definition from assembly. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- arch/x86/include/asm/page_32_types.h | 11 +++ arch/x86/include/asm

[PATCH 04/10] test_bitmap: skip user bitmap tests for !CONFIG_SET_FS

2020-08-27 Thread Christoph Hellwig
We can't run the tests for userspace bitmap parsing if set_fs() doesn't exist. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- lib/test_bitmap.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index df90

[PATCH 02/10] fs: don't allow splice read/write without explicit ops

2020-08-27 Thread Christoph Hellwig
h bandwith instances all provide a ->splice_read, so this just removes support for various device drivers and procfs/debugfs files. If splice support for any of those turns out to be important it can be added back by switching them to the iter ops and using generic_file_splice_read. Signed-off-

[PATCH 05/10] lkdtm: disable set_fs-based tests for !CONFIG_SET_FS

2020-08-27 Thread Christoph Hellwig
Once we can't manipulate the address limit, we also can't test what happens when the manipulation is abused. Signed-off-by: Christoph Hellwig --- drivers/misc/lkdtm/bugs.c | 4 drivers/misc/lkdtm/usercopy.c | 4 2 files changed, 8 insertions(+) diff --git a/drivers/

[PATCH 03/10] uaccess: add infrastructure for kernel builds with set_fs()

2020-08-27 Thread Christoph Hellwig
: Christoph Hellwig Reviewed-by: Kees Cook --- arch/Kconfig| 3 +++ arch/alpha/Kconfig | 1 + arch/arc/Kconfig| 1 + arch/arm/Kconfig| 1 + arch/arm64/Kconfig | 1 + arch/c6x/Kconfig| 1 + arch/csky/Kconfig | 1 + arch/h8300/Kconfig | 1

remove the last set_fs() in common code, and remove it for x86 and powerpc v2

2020-08-27 Thread Christoph Hellwig
Hi all, this series removes the last set_fs() used to force a kernel address space for the uaccess code in the kernel read/write/splice code, and then stops implementing the address space overrides entirely for x86 and powerpc. The file system part has been posted a few times, and the read/write

[PATCH 01/10] fs: don't allow kernel reads and writes without iter ops

2020-08-27 Thread Christoph Hellwig
ent semantics for messed up enough drivers. Also fails the kernel access to them in that case. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- fs/read_write.c | 67 +++-- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/fs/

Re: [PATCH 09/11] x86: remove address space overrides using set_fs()

2020-08-27 Thread &#x27;Christoph Hellwig'
On Mon, Aug 17, 2020 at 08:23:11AM +, David Laight wrote: > From: Christoph Hellwig > > Sent: 17 August 2020 08:32 > > > > Stop providing the possibility to override the address space using > > set_fs() now that there is no need for that any more. To properly &

Re: [PATCH v5 6/8] mm: Move vmap_range from lib/ioremap.c to mm/vmalloc.c

2020-08-20 Thread Christoph Hellwig
On Fri, Aug 21, 2020 at 02:44:25PM +1000, Nicholas Piggin wrote: > This is a generic kernel virtual memory mapper, not specific to ioremap. lib/ioremap doesn't exist any more. > > Signed-off-by: Nicholas Piggin > --- > include/linux/vmalloc.h | 2 + > mm/ioremap.c| 192 --

Re: [PATCH v5 5/8] mm: HUGE_VMAP arch support cleanup

2020-08-20 Thread Christoph Hellwig
> static int vmap_try_huge_pmd(pmd_t *pmd, unsigned long addr, unsigned long > end, > - phys_addr_t phys_addr, pgprot_t prot) > + phys_addr_t phys_addr, pgprot_t prot, unsigned int > max_page_shift) > { ... and here.

Re: [PATCH v5 4/8] lib/ioremap: rename ioremap_*_range to vmap_*_range

2020-08-20 Thread Christoph Hellwig
On Fri, Aug 21, 2020 at 02:44:23PM +1000, Nicholas Piggin wrote: > This will be moved to mm/ and used as a generic kernel virtual mapping > function, so re-name it in preparation. > > Signed-off-by: Nicholas Piggin > --- > mm/ioremap.c | 55 ++-- >

Re: [PATCH v5 3/8] mm/vmalloc: rename vmap_*_range vmap_pages_*_range

2020-08-20 Thread Christoph Hellwig
On Fri, Aug 21, 2020 at 02:44:22PM +1000, Nicholas Piggin wrote: > The vmalloc mapper operates on a struct page * array rather than a > linear physical address, re-name it to make this distinction clear. > > Signed-off-by: Nicholas Piggin > --- > mm/vmalloc.c | 28 >

iter and normal ops on /dev/zero & co, was Re: remove the last set_fs() in common code, and remove it for x86 and powerpc

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 09:16:59AM +0200, Christophe Leroy wrote: > I made a test with only the first patch of your series: That's definitely > the culprit. With only that patch applies, the duration is 6.64 seconds, > that's a 25% degradation. For the record: the first patch is: mem: remo

Re: [PATCH v3] powerpc/pseries/svm: Allocate SWIOTLB buffer anywhere in memory

2020-08-18 Thread Christoph Hellwig
On Tue, Aug 18, 2020 at 07:11:26PM -0300, Thiago Jung Bauermann wrote: > POWER secure guests (i.e., guests which use the Protection Execution > Facility) need to use SWIOTLB to be able to do I/O with the hypervisor, but > they don't need the SWIOTLB memory to be in low addresses since the > hypervi

Re: [PATCH 03/11] fs: don't allow splice read/write without explicit ops

2020-08-18 Thread Christoph Hellwig
On Tue, Aug 18, 2020 at 12:58:07PM -0700, Kees Cook wrote: > On Tue, Aug 18, 2020 at 09:54:46PM +0200, Christoph Hellwig wrote: > > On Tue, Aug 18, 2020 at 12:39:34PM -0700, Kees Cook wrote: > > > On Mon, Aug 17, 2020 at 09:32:04AM +0200, Christoph Hellwig wrote: > > >

Re: [PATCH 08/11] x86: make TASK_SIZE_MAX usable from assembly code

2020-08-18 Thread Christoph Hellwig
On Tue, Aug 18, 2020 at 12:59:05PM -0700, Kees Cook wrote: > > I didn't see a problem bisecting, do you have something particular in > > mind? > > Oh, I misunderstood this patch to be a fix for compilation. Is this just > a correctness fix? It prepares for using the definition from assembly, whic

Re: [PATCH 08/11] x86: make TASK_SIZE_MAX usable from assembly code

2020-08-18 Thread Christoph Hellwig
On Tue, Aug 18, 2020 at 12:44:49PM -0700, Kees Cook wrote: > On Mon, Aug 17, 2020 at 09:32:09AM +0200, Christoph Hellwig wrote: > > For 64-bit the only hing missing was a strategic _AC, and for 32-bit we > > typo: thing > > > need to use __PAGE_OFFSET instead of PAGE

Re: [PATCH 03/11] fs: don't allow splice read/write without explicit ops

2020-08-18 Thread Christoph Hellwig
On Tue, Aug 18, 2020 at 12:39:34PM -0700, Kees Cook wrote: > On Mon, Aug 17, 2020 at 09:32:04AM +0200, Christoph Hellwig wrote: > > default_file_splice_write is the last piece of generic code that uses > > set_fs to make the uaccess routines operate on kernel pointers. It &

Re: remove the last set_fs() in common code, and remove it for x86 and powerpc

2020-08-18 Thread Christoph Hellwig
On Tue, Aug 18, 2020 at 07:46:22PM +0200, Christophe Leroy wrote: > I gave it a go on my powerpc mpc832x. I tested it on top of my newest > series that reworks the 32 bits signal handlers (see > https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=196278) with > the microbenchmark test

Re: [PATCH v2] powerpc/pseries/svm: Allocate SWIOTLB buffer anywhere in memory

2020-08-17 Thread Christoph Hellwig
On Mon, Aug 17, 2020 at 06:46:58PM -0300, Thiago Jung Bauermann wrote: > POWER secure guests (i.e., guests which use the Protection Execution > Facility) need to use SWIOTLB to be able to do I/O with the hypervisor, but > they don't need the SWIOTLB memory to be in low addresses since the > hypervi

Re: [PATCH] swiotlb: Allow allocating buffer anywhere in memory

2020-08-17 Thread Christoph Hellwig
On Sat, Aug 15, 2020 at 05:45:36PM -0300, Thiago Jung Bauermann wrote: > POWER secure guests (i.e., guests which use the Protection Execution > Facility) need to use SWIOTLB to be able to do I/O with the hypervisor, but > they don't need the SWIOTLB memory to be in low addresses since the > hypervi

Re: [PATCH 05/11] test_bitmap: skip user bitmap tests for !CONFIG_SET_FS

2020-08-17 Thread Christoph Hellwig
On Mon, Aug 17, 2020 at 09:50:05AM +0200, Christophe Leroy wrote: > > > Le 17/08/2020 à 09:32, Christoph Hellwig a écrit : >> We can't run the tests for userspace bitmap parsing if set_fs() doesn't >> exist. >> >> Signed-off-by: Christoph

Re: remove the last set_fs() in common code, and remove it for x86 and powerpc

2020-08-17 Thread Christoph Hellwig
Adding Linus as I forgot to add him to the patch bomb, sorry.. On Mon, Aug 17, 2020 at 09:32:01AM +0200, Christoph Hellwig wrote: > Hi all, > > this series removes the last set_fs() used to force a kernel address > space for the uaccess code in the kernel read/write/splice code, and

[PATCH 11/11] powerpc: remove address space overrides using set_fs()

2020-08-17 Thread Christoph Hellwig
Stop providing the possibility to override the address space using set_fs() now that there is no need for that any more. Signed-off-by: Christoph Hellwig --- arch/powerpc/Kconfig | 1 - arch/powerpc/include/asm/processor.h | 7 --- arch/powerpc/include/asm/thread_info.h

[PATCH 10/11] powerpc: use non-set_fs based maccess routines

2020-08-17 Thread Christoph Hellwig
Provide __get_kernel_nofault and __put_kernel_nofault routines to implement the maccess routines without messing with set_fs and without opening up access to user space. Signed-off-by: Christoph Hellwig --- arch/powerpc/include/asm/uaccess.h | 16 1 file changed, 16 insertions

[PATCH 09/11] x86: remove address space overrides using set_fs()

2020-08-17 Thread Christoph Hellwig
hardcoded virtual address bits to escape the fact that TASK_SIZE_MAX isn't actually a constant when 5-level page tables are enabled. Signed-off-by: Christoph Hellwig --- arch/x86/Kconfig | 1 - arch/x86/ia32/ia32_aout.c | 1 - arch/x86/include/asm/processor.h

[PATCH 08/11] x86: make TASK_SIZE_MAX usable from assembly code

2020-08-17 Thread Christoph Hellwig
. Signed-off-by: Christoph Hellwig --- arch/x86/include/asm/page_32_types.h | 4 ++-- arch/x86/include/asm/page_64_types.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h index 26236925fb2c36

remove the last set_fs() in common code, and remove it for x86 and powerpc

2020-08-17 Thread Christoph Hellwig
Hi all, this series removes the last set_fs() used to force a kernel address space for the uaccess code in the kernel read/write/splice code, and then stops implementing the address space overrides entirely for x86 and powerpc. The file system part has been posted a few times, and the read/write

[PATCH 07/11] x86: move PAGE_OFFSET, TASK_SIZE & friends to page_{32, 64}_types.h

2020-08-17 Thread Christoph Hellwig
At least for 64-bit this moves them closer to some of the defines they are based on, and it prepares for using the TASK_SIZE_MAX definition from assembly. Signed-off-by: Christoph Hellwig --- arch/x86/include/asm/page_32_types.h | 11 +++ arch/x86/include/asm/page_64_types.h | 38

[PATCH 01/11] mem: remove duplicate ops for /dev/zero and /dev/null

2020-08-17 Thread Christoph Hellwig
There is no good reason to implement both the traditional ->read and ->write as well as the iter based ops. So implement just the iter based ones. Suggested-by: Al Viro Signed-off-by: Christoph Hellwig --- drivers/char/mem.c | 16 1 file changed, 16 deletions(-) diff -

[PATCH 04/11] uaccess: add infrastructure for kernel builds with set_fs()

2020-08-17 Thread Christoph Hellwig
: Christoph Hellwig --- arch/Kconfig| 3 +++ arch/alpha/Kconfig | 1 + arch/arc/Kconfig| 1 + arch/arm/Kconfig| 1 + arch/arm64/Kconfig | 1 + arch/c6x/Kconfig| 1 + arch/csky/Kconfig | 1 + arch/h8300/Kconfig | 1 + arch/hexagon/Kconfig

[PATCH 06/11] lkdtm: disable set_fs-based tests for !CONFIG_SET_FS

2020-08-17 Thread Christoph Hellwig
Once we can't manipulate the address limit, we also can't test what happens when the manipulation is abused. Signed-off-by: Christoph Hellwig --- drivers/misc/lkdtm/bugs.c | 2 ++ drivers/misc/lkdtm/core.c | 4 drivers/misc/lkdtm/usercopy.c | 2 ++ 3 files changed, 8

[PATCH 02/11] fs: don't allow kernel reads and writes without iter ops

2020-08-17 Thread Christoph Hellwig
ent semantics for messed up enough drivers. Also fails the kernel access to them in that case. Signed-off-by: Christoph Hellwig --- fs/read_write.c | 67 +++-- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/fs/read_write.c b/fs/r

[PATCH 03/11] fs: don't allow splice read/write without explicit ops

2020-08-17 Thread Christoph Hellwig
h bandwith instances all provide a ->splice_read, so this just removes support for various device drivers and procfs/debugfs files. If splice support for any of those turns out to be important it can be added back by switching them to the iter ops and using generic_file_splice_read. Signed-off-

[PATCH 05/11] test_bitmap: skip user bitmap tests for !CONFIG_SET_FS

2020-08-17 Thread Christoph Hellwig
We can't run the tests for userspace bitmap parsing if set_fs() doesn't exist. Signed-off-by: Christoph Hellwig --- lib/test_bitmap.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index df903c53952bb9..49b1d25fbaf

Re: [PATCH 1/5] powerpc: Remove flush_instruction_cache for book3s/32

2020-08-13 Thread Christoph Hellwig
On Thu, Aug 13, 2020 at 01:13:08PM +0100, Christoph Hellwig wrote: > On Thu, Aug 13, 2020 at 10:12:00AM +, Christophe Leroy wrote: > > -#ifndef CONFIG_PPC_8xx > > +#if !defined(CONFIG_PPC_8xx) && !defined(CONFIG_PPC_BOOK3S_32) > > _GLOBAL(flush_instruction_cache

Re: [PATCH 1/5] powerpc: Remove flush_instruction_cache for book3s/32

2020-08-13 Thread Christoph Hellwig
On Thu, Aug 13, 2020 at 10:12:00AM +, Christophe Leroy wrote: > -#ifndef CONFIG_PPC_8xx > +#if !defined(CONFIG_PPC_8xx) && !defined(CONFIG_PPC_BOOK3S_32) > _GLOBAL(flush_instruction_cache) > #if defined(CONFIG_4xx) > lis r3, KERNELBASE@h > @@ -290,18 +289,11 @@ _GLOBAL(flush_instruc

Re: linux-next: manual merge of the set_fs tree with the powerpc tree

2020-08-09 Thread Christoph Hellwig
Hi Stephen, please drop my set_fs tree from linux-next. It is not going to be merged for 5.9 in this form. Thanks!

Re: [PATCH] powerpc/signal: Move and simplify get_clean_sp()

2020-08-06 Thread Christoph Hellwig
On Thu, Aug 06, 2020 at 08:50:20AM +, Christophe Leroy wrote: > get_clean_sp() is only used in kernel/signal.c . Move it there. > > And GCC is smart enough to reduce the function when on PPC32, no > need of a special PPC32 simple version. What about just open coding it in the only caller, whi

Re: [PATCH v3 3/3] powerpc/uaccess: simplify the get_fs() set_fs() logic

2020-08-06 Thread Christoph Hellwig
Do you urgently need this? My plan for 5.10 is to rebased and submit the remaining bits of this branch: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/set_fs-removal which will kill off set_fs/get_fs entirely.

Re: [PATCH 02/15] dma-contiguous: simplify cma_early_percent_memory()

2020-07-27 Thread Christoph Hellwig
er memblock.memory with a call to memblock_phys_mem_size(). > > Signed-off-by: Mike Rapoport Looks good: Reviewed-by: Christoph Hellwig

Re: [PATCH 3/5] dma-mapping: make support for dma ops optional

2020-07-19 Thread Christoph Hellwig
On Sat, Jul 18, 2020 at 10:17:14AM -0700, Guenter Roeck wrote: > On Wed, Jul 08, 2020 at 05:24:47PM +0200, Christoph Hellwig wrote: > > Avoid the overhead of the dma ops support for tiny builds that only > > use the direct mapping. > > > > Signed-off-by:

Re: [PATCH 4/5] dma-mapping: add a dma_ops_bypass flag to struct device

2020-07-14 Thread Christoph Hellwig
On Mon, Jul 13, 2020 at 02:59:39PM +1000, Alexey Kardashevskiy wrote: > > > On 09/07/2020 01:24, Christoph Hellwig wrote: > > Several IOMMU drivers have a bypass mode where they can use a direct > > mapping if the devices DMA mask is large enough. Add generic support > &

Re: PowerNV PCI & SR-IOV cleanups

2020-07-09 Thread Christoph Hellwig
On Fri, Jul 10, 2020 at 03:23:25PM +1000, Oliver O'Halloran wrote: > This is largely prep work for supporting VFs in the 32bit MMIO window. > This is an unfortunate necessity due to how the Linux BAR allocator > handles BARs marked as non-prefetchable. The distinction > between prefetch and non-pre

[PATCH 5/5] powerpc: use the generic dma_ops_bypass mode

2020-07-08 Thread Christoph Hellwig
werpc/pseries/dma: Allow SWIOTLB") Signed-off-by: Christoph Hellwig --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/device.h | 5 -- arch/powerpc/kernel/dma-iommu.c | 90 --- 3 files changed, 10 insertions(+), 86 deletions(-) diff --git a/ar

[PATCH 4/5] dma-mapping: add a dma_ops_bypass flag to struct device

2020-07-08 Thread Christoph Hellwig
Several IOMMU drivers have a bypass mode where they can use a direct mapping if the devices DMA mask is large enough. Add generic support to the core dma-mapping code to do that to switch those drivers to a common solution. Signed-off-by: Christoph Hellwig --- include/linux/device.h | 8

[PATCH 3/5] dma-mapping: make support for dma ops optional

2020-07-08 Thread Christoph Hellwig
Avoid the overhead of the dma ops support for tiny builds that only use the direct mapping. Signed-off-by: Christoph Hellwig --- arch/alpha/Kconfig | 1 + arch/arm/Kconfig| 1 + arch/ia64/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/parisc/Kconfig

[PATCH 2/5] dma-mapping: inline the fast path dma-direct calls

2020-07-08 Thread Christoph Hellwig
bypass mode, and more of those are going to be switched to the generic bypass soon. Signed-off-by: Christoph Hellwig --- include/linux/dma-direct.h | 92 -- kernel/dma/direct.c| 65 --- 2 files changed, 69 insertions(+), 88

[PATCH 1/5] dma-mapping: move the remaining DMA API calls out of line

2020-07-08 Thread Christoph Hellwig
: Christoph Hellwig --- include/linux/dma-direct.h | 58 + include/linux/dma-mapping.h | 247 kernel/dma/direct.c | 9 -- kernel/dma/mapping.c| 164 4 files changed, 244 insertions(+), 234 deletions(-) diff

generic DMA bypass flag v4

2020-07-08 Thread Christoph Hellwig
Hi all, I've recently beeing chatting with Lu about using dma-iommu and per-device DMA ops in the intel IOMMU driver, and one missing feature in dma-iommu is a bypass mode where the direct mapping is used even when an iommu is attached to improve performance. The powerpc code already has a simila

Re: [PATCH 1/4] dma-mapping: move the remaining DMA API calls out of line

2020-07-07 Thread Christoph Hellwig
On Tue, Jul 07, 2020 at 10:43:10AM +1000, Alexey Kardashevskiy wrote: > Any luck there? I'd really like to cross this off my todo list :) Thanks, We had another incident with new net code poking into dma internals blocking this series. That is now sorted out, so the series is back on track.

Re: [PATCH 18/20] block: refator submit_bio_noacct

2020-07-02 Thread Christoph Hellwig
On Thu, Jul 02, 2020 at 10:10:10AM -0400, Qian Cai wrote: > On Mon, Jun 29, 2020 at 09:39:45PM +0200, Christoph Hellwig wrote: > > Split out a __submit_bio_noacct helper for the actual de-recursion > > algorithm, and simplify the loop by using a continue when we can't > >

[PATCH 20/20] block: remove direct_make_request

2020-07-01 Thread Christoph Hellwig
Now that submit_bio_noacct has a decent blk-mq fast path there is no more need for this bypass. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 28 drivers/md/dm.c | 5 + drivers/nvme/host/multipath.c | 2 +- include/linux

[PATCH 19/20] block: shortcut __submit_bio_noacct for blk-mq drivers

2020-07-01 Thread Christoph Hellwig
For blk-mq drivers bios can only be inserted for the same queue. So bypass the complicated sorting logic in __submit_bio_noacct with a blk-mq simpler submission helper. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 30 ++ 1 file changed, 30 insertions

[PATCH 17/20] block: rename generic_make_request to submit_bio_noacct

2020-07-01 Thread Christoph Hellwig
generic_make_request has always been very confusingly misnamed, so rename it to submit_bio_noacct to make it clear that it is submit_bio minus accounting and a few checks. Signed-off-by: Christoph Hellwig --- Documentation/block/biodoc.rst| 2 +- .../fault-injection/fault

[PATCH 18/20] block: refator submit_bio_noacct

2020-07-01 Thread Christoph Hellwig
Split out a __submit_bio_noacct helper for the actual de-recursion algorithm, and simplify the loop by using a continue when we can't enter the queue for a bio. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 143 +-- 1 file change

[PATCH 16/20] block: move ->make_request_fn to struct block_device_operations

2020-07-01 Thread Christoph Hellwig
derived pretty trivially from the bio. Signed-off-by: Christoph Hellwig --- Documentation/block/biodoc.rst| 2 +- .../block/writeback_cache_control.rst | 2 +- arch/m68k/emu/nfblock.c | 5 +- arch/xtensa/platforms/iss/simdisk.c | 5

[PATCH 15/20] block: remove the nr_sectors variable in generic_make_request_checks

2020-07-01 Thread Christoph Hellwig
The variable is only used once, so just open code the bio_sector() there. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 37435d0d433564..28f60985dc75cc 100644 --- a/block/blk

[PATCH 12/20] block: remove the request_queue argument from blk_queue_split

2020-07-01 Thread Christoph Hellwig
The queue can be trivially derived from the bio, so pass one less argument. Signed-off-by: Christoph Hellwig --- block/blk-merge.c | 21 ++--- block/blk-mq.c| 2 +- block/blk.h | 3 +-- drivers/block/drbd/drbd_req.c | 2

[PATCH 14/20] block: remove the NULL queue check in generic_make_request_checks

2020-07-01 Thread Christoph Hellwig
All registers disks must have a valid queue pointer, so don't bother to log a warning for that case. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 95dca7453

[PATCH 13/20] block: tidy up a warning in bio_check_ro

2020-07-01 Thread Christoph Hellwig
The "generic_make_request: " prefix has no value, and will soon become stale. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 76cfd5709f66cd..95dca74534ff73 100644 -

<    5   6   7   8   9   10   11   12   13   14   >