[PATCH 02/14] swiotlb: remove the alloc_size parameter to swiotlb_tbl_unmap_single

2021-02-28 Thread Christoph Hellwig
Now that swiotlb remembers the allocation size there is no need to pass it back to swiotlb_tbl_unmap_single. Signed-off-by: Christoph Hellwig --- drivers/iommu/dma-iommu.c | 11 +++--- drivers/xen/swiotlb-xen.c | 4 ++-- include/linux/swiotlb.h | 1 - kernel/dma/direct.h | 2

swiotlb cleanups v2

2021-02-28 Thread Christoph Hellwig
Hi Konrad, this series contains a bunch of swiotlb cleanups, mostly to reduce the amount of internals exposed to code outside of swiotlb.c, which should helper to prepare for supporting multiple different bounce buffer pools. Changes since v1: - rebased to v5.12-rc1 - a few more cleanups -

[PATCH 01/14] powerpc/svm: stop using io_tlb_start

2021-02-28 Thread Christoph Hellwig
Use the local variable that is passed to swiotlb_init_with_tbl for freeing the memory in the failure case to isolate the code a little better from swiotlb internals. Signed-off-by: Christoph Hellwig --- arch/powerpc/platforms/pseries/svm.c | 6 +++--- 1 file changed, 3 insertions(+), 3

Re: [PATCH] mm: Generalize HUGETLB_PAGE_SIZE_VARIABLE

2021-02-28 Thread Christoph Hellwig
: Andrew Morton > Cc: Christoph Hellwig > Cc: linux-i...@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux...@kvack.org > Cc: linux-ker...@vger.kernel.org > Suggested-by: Christoph Hellwig > Signed-off-by: Anshuman Khandual > --- > This change wa

Re: [PATCH v4 12/14] swiotlb: Add restricted DMA alloc/free support.

2021-02-25 Thread Christoph Hellwig
On Fri, Feb 26, 2021 at 12:17:50PM +0800, Claire Chang wrote: > Do you think I should fix this and rebase on the latest linux-next > now? I wonder if there are more factor and clean up coming and I > should wait after that. Here is my preferred plan: 1) wait for my series to support the min

Re: [PATCH v4 01/14] swiotlb: Remove external access to io_tlb_start

2021-02-09 Thread Christoph Hellwig
On Tue, Feb 09, 2021 at 02:21:18PM +0800, Claire Chang wrote: > This can be dropped if Christoph's swiotlb cleanups are landed. > https://lore.kernel.org/linux-iommu/20210207160934.2955931-1-...@lst.de/T/#m7124f29b6076d462101fcff6433295157621da09 > FYI, I've also started looking into additional

[PATCH 8/8] xen-swiotlb: remove the unused size argument from xen_swiotlb_fixup

2021-02-07 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- drivers/xen/swiotlb-xen.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index b2d9e77059bf5a..621a20c1143597 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb

[PATCH 7/8] xen-swiotlb: split xen_swiotlb_init

2021-02-07 Thread Christoph Hellwig
Split xen_swiotlb_init into a normal an an early case. That makes both much simpler and more readable, and also allows marking the early code as __init and x86-only. Signed-off-by: Christoph Hellwig --- arch/arm/xen/mm.c | 2 +- arch/x86/xen/pci-swiotlb-xen.c | 4 +- drivers

[PATCH 2/8] xen-swiotlb: use is_swiotlb_buffer in is_xen_swiotlb_buffer

2021-02-07 Thread Christoph Hellwig
Use the is_swiotlb_buffer to check if a physical address is a swiotlb buffer. This works because xen-swiotlb does use the same buffer as the main swiotlb code, and xen_io_tlb_{start,end} are just the addresses for it that went through phys_to_virt. Signed-off-by: Christoph Hellwig --- drivers

[PATCH 6/8] swiotlb: lift the double initialization protection from xen-swiotlb

2021-02-07 Thread Christoph Hellwig
Lift the double initialization protection from xen-swiotlb to the core code to avoid exposing too many swiotlb internals. Also upgrade the check to a warning as it should not happen. Signed-off-by: Christoph Hellwig --- drivers/xen/swiotlb-xen.c | 7 --- kernel/dma/swiotlb.c | 8

[PATCH 3/8] xen-swiotlb: use io_tlb_end in xen_swiotlb_dma_supported

2021-02-07 Thread Christoph Hellwig
Use the existing variable that holds the physical address for xen_io_tlb_end to simplify xen_swiotlb_dma_supported a bit, and remove the otherwise unused xen_io_tlb_end variable and the xen_virt_to_bus helper. Signed-off-by: Christoph Hellwig --- drivers/xen/swiotlb-xen.c | 10 ++ 1

[PATCH 1/8] powerpc/svm: stop using io_tlb_start

2021-02-07 Thread Christoph Hellwig
Use the local variable that is passed to swiotlb_init_with_tbl for freeing the memory in the failure case to isolate the code a little better from swiotlb internals. Signed-off-by: Christoph Hellwig --- arch/powerpc/platforms/pseries/svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 4/8] xen-swiotlb: remove xen_set_nslabs

2021-02-07 Thread Christoph Hellwig
three lines in the caller. Signed-off-by: Christoph Hellwig --- drivers/xen/swiotlb-xen.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 4298f74a083985..57f8d5fadc1fcd 100644 --- a/drivers/xen

swiotlb cleanups

2021-02-07 Thread Christoph Hellwig
Hi Konrad, this series contains a bunch of swiotlb cleanups, mostly to reduce the amount of internals exposed to code outside of swiotlb.c, which should helper to prepare for supporting multiple different bounce buffer pools.

[PATCH 5/8] xen-swiotlb: remove xen_io_tlb_start and xen_io_tlb_nslabs

2021-02-07 Thread Christoph Hellwig
The xen_io_tlb_start and xen_io_tlb_nslabs variables ar now only used in xen_swiotlb_init, so replace them with local variables. Signed-off-by: Christoph Hellwig --- drivers/xen/swiotlb-xen.c | 57 +-- 1 file changed, 25 insertions(+), 32 deletions(-) diff

Re: [PATCH RFC v1 5/6] xen-swiotlb: convert variables to arrays

2021-02-07 Thread Christoph Hellwig
On Thu, Feb 04, 2021 at 09:40:23AM +0100, Christoph Hellwig wrote: > So one thing that has been on my mind for a while: I'd really like > to kill the separate dma ops in Xen swiotlb. If we compare xen-swiotlb > to swiotlb the main difference seems to be: > > - additional reason

Re: [PATCH RFC v1 5/6] xen-swiotlb: convert variables to arrays

2021-02-04 Thread Christoph Hellwig
So one thing that has been on my mind for a while: I'd really like to kill the separate dma ops in Xen swiotlb. If we compare xen-swiotlb to swiotlb the main difference seems to be: - additional reasons to bounce I/O vs the plain DMA capable - the possibility to do a hypercall on arm/arm64 -

Re: [PATCH RFC v1 2/6] swiotlb: convert variables to arrays

2021-02-03 Thread Christoph Hellwig
On Wed, Feb 03, 2021 at 03:37:05PM -0800, Dongli Zhang wrote: > This patch converts several swiotlb related variables to arrays, in > order to maintain stat/status for different swiotlb buffers. Here are > variables involved: > > - io_tlb_start and io_tlb_end > - io_tlb_nslabs and io_tlb_used > -

Re: [PATCH 02/13] drm: remove drm_fb_helper_modinit

2021-02-03 Thread Christoph Hellwig
On Wed, Feb 03, 2021 at 11:34:50AM +0100, Daniel Vetter wrote: > On Thu, Jan 28, 2021 at 07:14:10PM +0100, Christoph Hellwig wrote: > > drm_fb_helper_modinit has a lot of boilerplate for what is not very > > simple functionality. Just open code it in the only caller using

Re: [PATCH 10/13] module: pass struct find_symbol_args to find_symbol

2021-02-03 Thread Christoph Hellwig
FYI, this is the updated version: --- >From 664ca3378deac7530fe8fc15fe73d583ddf2 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 20 Jan 2021 14:58:27 +0100 Subject: module: pass struct find_symbol_args to find_symbol Simplify the calling convention by pass

Re: [PATCH 10/13] module: pass struct find_symbol_args to find_symbol

2021-02-02 Thread Christoph Hellwig
On Tue, Feb 02, 2021 at 03:07:51PM +0100, Miroslav Benes wrote: > > preempt_disable(); > > - sym = find_symbol(symbol, , NULL, NULL, true, true); > > - if (sym && strong_try_module_get(owner)) > > - sym = NULL; > > + if (!find_symbol() || !strong_try_module_get(fsa.owner)) { >

Re: module loader dead code removal and cleanups v3

2021-02-02 Thread Christoph Hellwig
On Tue, Feb 02, 2021 at 03:37:04PM +0100, Jessica Yu wrote: > The patchset looks good so far. After Miroslav's comments are > addressed, I'll wait an extra day or two in case there are more > comments before queueing them onto modules-next. I can take the first > two patches as well provided the

[PATCH 13/13] module: remove EXPORT_UNUSED_SYMBOL*

2021-02-02 Thread Christoph Hellwig
EXPORT_UNUSED_SYMBOL* is not actually used anywhere. Remove the unused functionality as we generally just remove unused code anyway. Signed-off-by: Christoph Hellwig --- arch/arm/configs/bcm2835_defconfig | 1 - arch/arm/configs/mxs_defconfig | 1 - arch/mips/configs

[PATCH 12/13] module: remove EXPORT_SYMBOL_GPL_FUTURE

2021-02-02 Thread Christoph Hellwig
As far as I can tell this has never been used at all, and certainly not any time recently. Signed-off-by: Christoph Hellwig --- arch/x86/tools/relocs.c | 4 ++-- include/asm-generic/vmlinux.lds.h | 14 -- include/linux/export.h| 1 - include/linux/module.h

[PATCH 10/13] module: pass struct find_symbol_args to find_symbol

2021-02-02 Thread Christoph Hellwig
Simplify the calling convention by passing the find_symbol_args structure to find_symbol instead of initializing it inside the function. Signed-off-by: Christoph Hellwig --- kernel/module.c | 113 ++-- 1 file changed, 52 insertions(+), 61 deletions

[PATCH 11/13] module: move struct symsearch to module.c

2021-02-02 Thread Christoph Hellwig
struct symsearch is only used inside of module.h, so move the definition out of module.h. Signed-off-by: Christoph Hellwig --- include/linux/module.h | 11 --- kernel/module.c| 11 +++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/linux

[PATCH 09/13] module: merge each_symbol_section into find_symbol

2021-02-02 Thread Christoph Hellwig
each_symbol_section is only called by find_symbol, so merge the two functions. Signed-off-by: Christoph Hellwig --- kernel/module.c | 148 ++-- 1 file changed, 69 insertions(+), 79 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index

[PATCH 08/13] module: remove each_symbol_in_section

2021-02-02 Thread Christoph Hellwig
each_symbol_in_section just contains a trivial loop over its arguments. Just open code the loop in the two callers. Signed-off-by: Christoph Hellwig --- kernel/module.c | 29 +++-- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/kernel/module.c b/kernel

[PATCH 07/13] module: mark module_mutex static

2021-02-02 Thread Christoph Hellwig
Except for two lockdep asserts module_mutex is only used in module.c. Remove the two asserts given that the functions they are in are not exported and just called from the module code, and mark module_mutex static. Signed-off-by: Christoph Hellwig --- include/linux/module.h | 2 -- kernel

[PATCH 06/13] kallsyms: only build {, module_}kallsyms_on_each_symbol when required

2021-02-02 Thread Christoph Hellwig
kallsyms_on_each_symbol and module_kallsyms_on_each_symbol are only used by the livepatching code, so don't build them if livepatching is not enabled. Signed-off-by: Christoph Hellwig --- include/linux/kallsyms.h | 17 - include/linux/module.h | 16 kernel

[PATCH 05/13] kallsyms: refactor {,module_}kallsyms_on_each_symbol

2021-02-02 Thread Christoph Hellwig
for the livepatch code in that the symbols from vmlinux are not iterated anymore if objname is set, but that actually is the desired behavior in this case. Signed-off-by: Christoph Hellwig Acked-by: Miroslav Benes --- kernel/kallsyms.c | 6 +- kernel/livepatch/core.c | 2 -- kernel

[PATCH 04/13] module: use RCU to synchronize find_module

2021-02-02 Thread Christoph Hellwig
Allow for a RCU-sched critical section around find_module, following the lower level find_module_all helper, and switch the two callers outside of module.c to use such a RCU-sched critical section instead of module_mutex. Signed-off-by: Christoph Hellwig Reviewed-by: Petr Mladek Acked

[PATCH 01/13] powerpc/powernv: remove get_cxl_module

2021-02-02 Thread Christoph Hellwig
The static inline get_cxl_module function is entirely unused since commit 8bf6b91a5125a ("Revert "powerpc/powernv: Add support for the cxl kernel api on the real phb"), so remove it. Signed-off-by: Christoph Hellwig Reviewed-by: Andrew Donnellan --- arch/powerpc/platforms/po

[PATCH 02/13] drm: remove drm_fb_helper_modinit

2021-02-02 Thread Christoph Hellwig
check either). Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/drm_crtc_helper_internal.h | 10 - drivers/gpu/drm/drm_fb_helper.c| 21 -- drivers/gpu/drm/drm_kms_helper_common.c| 25 +++--- 3 files changed, 12 insertions(+), 44

module loader dead code removal and cleanups v3

2021-02-02 Thread Christoph Hellwig
Hi all, this series removes support for long term unused export types and cleans up various loose ends in the module loader. Changes since v2: - clean up klp_find_object_symbol a bit - remove the now unused module_assert_mutex helper Changes since v1: - move struct symsearch to module.c -

[PATCH 03/13] module: unexport find_module and module_mutex

2021-02-02 Thread Christoph Hellwig
find_module is not used by modular code any more, and random driver code has no business calling it to start with. Signed-off-by: Christoph Hellwig Reviewed-by: Miroslav Benes --- kernel/module.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index

Re: [PATCH 05/13] kallsyms: refactor {,module_}kallsyms_on_each_symbol

2021-02-01 Thread Christoph Hellwig
-- >From 18af41e88d088cfb8680d1669fcae2bc2ede5328 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 20 Jan 2021 16:23:16 +0100 Subject: kallsyms: refactor {,module_}kallsyms_on_each_symbol Require an explicit call to module_kallsyms_on_each_symbol to look for symbols in modules

Re: [PATCH 05/13] kallsyms: refactor {,module_}kallsyms_on_each_symbol

2021-02-01 Thread Christoph Hellwig
On Fri, Jan 29, 2021 at 10:43:36AM +0100, Petr Mladek wrote: > > --- a/kernel/livepatch/core.c > > +++ b/kernel/livepatch/core.c > > @@ -164,12 +164,8 @@ static int klp_find_object_symbol(const char *objname, > > const char *name, > > .pos = sympos, > > }; > > > > -

Re: [PATCH 04/13] module: use RCU to synchronize find_module

2021-02-01 Thread Christoph Hellwig
On Fri, Jan 29, 2021 at 04:29:02PM +0100, Miroslav Benes wrote: > > > > - mutex_lock(_mutex); > > + rcu_read_lock_sched(); > > /* > > * We do not want to block removal of patched modules and therefore > > * we do not take a reference here. The patches are removed by > > @@

Re: [PATCH 04/13] module: use RCU to synchronize find_module

2021-01-28 Thread Christoph Hellwig
On Thu, Jan 28, 2021 at 05:50:56PM -0300, Thiago Jung Bauermann wrote: > > struct module *find_module(const char *name) > > { > > - module_assert_mutex(); > > Does it make sense to replace the assert above with the warn below (untested)? > > RCU_LOCKDEP_WARN(rcu_read_lock_sched_held());

[PATCH 13/13] module: remove EXPORT_UNUSED_SYMBOL*

2021-01-28 Thread Christoph Hellwig
EXPORT_UNUSED_SYMBOL* is not actually used anywhere. Remove the unused functionality as we generally just remove unused code anyway. Signed-off-by: Christoph Hellwig --- arch/arm/configs/bcm2835_defconfig | 1 - arch/arm/configs/mxs_defconfig | 1 - arch/mips/configs

[PATCH 12/13] module: remove EXPORT_SYMBOL_GPL_FUTURE

2021-01-28 Thread Christoph Hellwig
As far as I can tell this has never been used at all, and certainly not any time recently. Signed-off-by: Christoph Hellwig --- arch/x86/tools/relocs.c | 4 ++-- include/asm-generic/vmlinux.lds.h | 14 -- include/linux/export.h| 1 - include/linux/module.h

[PATCH 11/13] module: move struct symsearch to module.c

2021-01-28 Thread Christoph Hellwig
struct symsearch is only used inside of module.h, so move the definition out of module.h. Signed-off-by: Christoph Hellwig --- include/linux/module.h | 11 --- kernel/module.c| 11 +++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/linux

[PATCH 10/13] module: pass struct find_symbol_args to find_symbol

2021-01-28 Thread Christoph Hellwig
Simplify the calling convention by passing the find_symbol_args structure to find_symbol instead of initializing it inside the function. Signed-off-by: Christoph Hellwig --- kernel/module.c | 113 ++-- 1 file changed, 52 insertions(+), 61 deletions

[PATCH 07/13] module: mark module_mutex static

2021-01-28 Thread Christoph Hellwig
Except for two lockdep asserts module_mutex is only used in module.c. Remove the two asserts given that the functions they are in are not exported and just called from the module code, and mark module_mutex static. Signed-off-by: Christoph Hellwig --- include/linux/module.h | 2 -- kernel

[PATCH 09/13] module: merge each_symbol_section into find_symbol

2021-01-28 Thread Christoph Hellwig
each_symbol_section is only called by find_symbol, so merge the two functions. Signed-off-by: Christoph Hellwig --- kernel/module.c | 148 ++-- 1 file changed, 69 insertions(+), 79 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index

[PATCH 08/13] module: remove each_symbol_in_section

2021-01-28 Thread Christoph Hellwig
each_symbol_in_section just contains a trivial loop over its arguments. Just open code the loop in the two callers. Signed-off-by: Christoph Hellwig --- kernel/module.c | 29 +++-- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/kernel/module.c b/kernel

[PATCH 06/13] kallsyms: only build {, module_}kallsyms_on_each_symbol when required

2021-01-28 Thread Christoph Hellwig
kallsyms_on_each_symbol and module_kallsyms_on_each_symbol are only used by the livepatching code, so don't build them if livepatching is not enabled. Signed-off-by: Christoph Hellwig --- include/linux/kallsyms.h | 17 - include/linux/module.h | 16 kernel

[PATCH 05/13] kallsyms: refactor {,module_}kallsyms_on_each_symbol

2021-01-28 Thread Christoph Hellwig
Require an explicit call to module_kallsyms_on_each_symbol to look for symbols in modules instead of the call from kallsyms_on_each_symbol, and acquire module_mutex inside of module_kallsyms_on_each_symbol instead of leaving that up to the caller. Signed-off-by: Christoph Hellwig --- kernel

[PATCH 03/13] module: unexport find_module and module_mutex

2021-01-28 Thread Christoph Hellwig
find_module is not used by modular code any more, and random driver code has no business calling it to start with. Signed-off-by: Christoph Hellwig --- kernel/module.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 4bf30e4b3eaaa1..981302f616b411

[PATCH 04/13] module: use RCU to synchronize find_module

2021-01-28 Thread Christoph Hellwig
Allow for a RCU-sched critical section around find_module, following the lower level find_module_all helper, and switch the two callers outside of module.c to use such a RCU-sched critical section instead of module_mutex. Signed-off-by: Christoph Hellwig --- include/linux/module.h | 2

[PATCH 02/13] drm: remove drm_fb_helper_modinit

2021-01-28 Thread Christoph Hellwig
check either). Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/drm_crtc_helper_internal.h | 10 - drivers/gpu/drm/drm_fb_helper.c| 21 -- drivers/gpu/drm/drm_kms_helper_common.c| 25 +++--- 3 files changed, 12 insertions(+), 44

module loader dead code removal and cleanups v2

2021-01-28 Thread Christoph Hellwig
Hi all, this series removes support for long term unused export types and cleans up various loose ends in the module loader. Changes since v1: - move struct symsearch to module.c - rework drm to not call find_module at all - llow RCU-sched locking for find_module - keep find_module as a

[PATCH 01/13] powerpc/powernv: remove get_cxl_module

2021-01-28 Thread Christoph Hellwig
The static inline get_cxl_module function is entirely unused since commit 8bf6b91a5125a ("Revert "powerpc/powernv: Add support for the cxl kernel api on the real phb"), so remove it. Signed-off-by: Christoph Hellwig Reviewed-by: Andrew Donnellan --- arch/powerpc/platforms/po

Re: [PATCH 03/13] livepatch: refactor klp_init_object

2021-01-28 Thread Christoph Hellwig
On Thu, Jan 28, 2021 at 05:22:40PM +0100, Christoph Hellwig wrote: > > We need to either update the function description or keep this check. > > > > I prefer to keep the check. The function does the right thing also > > for the object "vmlinux". Also the livepa

Re: [PATCH 03/13] livepatch: refactor klp_init_object

2021-01-28 Thread Christoph Hellwig
On Wed, Jan 27, 2021 at 01:58:21PM +0100, Petr Mladek wrote: > > --- a/kernel/livepatch/core.c > > +++ b/kernel/livepatch/core.c > > @@ -54,9 +54,6 @@ static void klp_find_object_module(struct klp_object *obj) > > { > > struct module *mod; > > > > - if (!klp_is_module(obj)) > > -

Re: [PATCH 13/13] module: remove EXPORY_UNUSED_SYMBOL*

2021-01-28 Thread Christoph Hellwig
On Wed, Jan 27, 2021 at 02:49:38PM +0100, Jessica Yu wrote: >> #ifdef CONFIG_MODULE_SIG >> /* Signature was verified. */ >> bool sig_ok; >> @@ -592,7 +580,6 @@ struct symsearch { >> GPL_ONLY, >> WILL_BE_GPL_ONLY, >> } license; >> -bool unused; >> }; >

Re: [PATCH v11 04/13] mm/ioremap: rename ioremap_*_range to vmap_*_range

2021-01-25 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig

Re: [PATCH 3/5] powerpc/xive: remove unnecessary unmap_kernel_range

2021-01-25 Thread Christoph Hellwig
On Tue, Jan 26, 2021 at 02:54:02PM +1000, Nicholas Piggin wrote: > iounmap will remove ptes. Looks good, Reviewed-by: Christoph Hellwig

Re: [PATCH v10 11/12] mm/vmalloc: Hugepage vmalloc mappings

2021-01-24 Thread Christoph Hellwig
On Sun, Jan 24, 2021 at 06:22:29PM +1000, Nicholas Piggin wrote: > diff --git a/arch/Kconfig b/arch/Kconfig > index 24862d15f3a3..f87feb616184 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -724,6 +724,16 @@ config HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD > config HAVE_ARCH_HUGE_VMAP >

Re: [PATCH v10 10/12] mm/vmalloc: add vmap_range_noflush variant

2021-01-24 Thread Christoph Hellwig
good, Reviewed-by: Christoph Hellwig

Re: [PATCH v10 09/12] mm: Move vmap_range from mm/ioremap.c to mm/vmalloc.c

2021-01-24 Thread Christoph Hellwig
On Sun, Jan 24, 2021 at 06:22:27PM +1000, Nicholas Piggin wrote: > This is a generic kernel virtual memory mapper, not specific to ioremap. Looks good: Reviewed-by: Christoph Hellwig Although it would be nice if you could fix up the > 80 lines while you're at it.

Re: [PATCH v10 05/12] mm: HUGE_VMAP arch support cleanup

2021-01-24 Thread Christoph Hellwig
> diff --git a/arch/arm64/include/asm/vmalloc.h > b/arch/arm64/include/asm/vmalloc.h > index 2ca708ab9b20..597b40405319 100644 > --- a/arch/arm64/include/asm/vmalloc.h > +++ b/arch/arm64/include/asm/vmalloc.h > @@ -1,4 +1,12 @@ > #ifndef _ASM_ARM64_VMALLOC_H > #define _ASM_ARM64_VMALLOC_H > >

Re: [PATCH v10 04/12] mm/ioremap: rename ioremap_*_range to vmap_*_range

2021-01-24 Thread Christoph Hellwig
On Sun, Jan 24, 2021 at 06:22:22PM +1000, Nicholas Piggin wrote: > This will be used as a generic kernel virtual mapping function, so > re-name it in preparation. The new name looks ok, but shouldn't it also move to vmalloc.c with the more generic name and purpose?

Re: [PATCH v10 03/12] mm/vmalloc: rename vmap_*_range vmap_pages_*_range

2021-01-24 Thread Christoph Hellwig
On Sun, Jan 24, 2021 at 06:22:21PM +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 Looks good, Reviewed-by: Christoph Hellwig

Re: [PATCH v10 02/12] mm: apply_to_pte_range warn and fail if a large pte is encountered

2021-01-24 Thread Christoph Hellwig
On Sun, Jan 24, 2021 at 06:22:20PM +1000, Nicholas Piggin wrote: > apply_to_pte_range might mistake a large pte for bad, or treat it as a > page table, resulting in a crash or corruption. Add a test to warn and > return error if large entries are found. Looks good, Reviewed-by: Christoph Hellwig

Re: [PATCH v10 01/12] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings

2021-01-24 Thread Christoph Hellwig
ble instead of fix would be better in the subject line? Otherwise this looks good: Reviewed-by: Christoph Hellwig

Re: [PATCH 02/13] module: add a module_loaded helper

2021-01-21 Thread Christoph Hellwig
On Thu, Jan 21, 2021 at 11:00:20AM +0100, Christophe Leroy wrote: > > +bool module_loaded(const char *name); > > Maybe module_is_loaded() would be a better name. Fine with me.

Re: [PATCH 08/13] drm: remove drm_fb_helper_modinit

2021-01-21 Thread Christoph Hellwig
On Thu, Jan 21, 2021 at 09:25:40AM +0100, Daniel Vetter wrote: > On Thu, Jan 21, 2021 at 8:55 AM Christoph Hellwig wrote: > > > > drm_fb_helper_modinit has a lot of boilerplate for what is not very > > simple functionality. Just open code it in the only caller using > &g

[PATCH 13/13] module: remove EXPORY_UNUSED_SYMBOL*

2021-01-21 Thread Christoph Hellwig
EXPORT_UNUSED_SYMBOL* is not actually used anywhere. Remove the unused functionality as we generally just remove unused code anyway. Signed-off-by: Christoph Hellwig --- arch/arm/configs/bcm2835_defconfig | 1 - arch/arm/configs/mxs_defconfig | 1 - arch/mips/configs

[PATCH 12/13] module: remove EXPORT_SYMBOL_GPL_FUTURE

2021-01-21 Thread Christoph Hellwig
As far as I can tell this has never been used at all, and certainly not any time recently. Signed-off-by: Christoph Hellwig --- arch/x86/tools/relocs.c | 4 ++-- include/asm-generic/vmlinux.lds.h | 14 -- include/linux/export.h| 1 - include/linux/module.h

[PATCH 11/13] module: pass struct find_symbol_args to find_symbol

2021-01-21 Thread Christoph Hellwig
Simplify the calling convention by passing the find_symbol_args structure to find_symbol instead of initializing it inside the function. Signed-off-by: Christoph Hellwig --- kernel/module.c | 113 ++-- 1 file changed, 52 insertions(+), 61 deletions

[PATCH 10/13] module: merge each_symbol_section into find_symbol

2021-01-21 Thread Christoph Hellwig
each_symbol_section is only called by find_symbol, so merge the two functions. Signed-off-by: Christoph Hellwig --- kernel/module.c | 148 ++-- 1 file changed, 69 insertions(+), 79 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index

[PATCH 09/13] module: remove each_symbol_in_section

2021-01-21 Thread Christoph Hellwig
each_symbol_in_section just contains a trivial loop over its arguments. Just open code the loop in the two callers. Signed-off-by: Christoph Hellwig --- kernel/module.c | 29 +++-- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/kernel/module.c b/kernel

[PATCH 08/13] drm: remove drm_fb_helper_modinit

2021-01-21 Thread Christoph Hellwig
drm_fb_helper_modinit has a lot of boilerplate for what is not very simple functionality. Just open code it in the only caller using IS_ENABLED and IS_MODULE. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/drm_crtc_helper_internal.h | 10 - drivers/gpu/drm/drm_fb_helper.c

[PATCH 07/13] module: mark module_mutex static

2021-01-21 Thread Christoph Hellwig
Except for two lockdep asserts module_mutex is only used in module.c. Remove the two asserts given that the functions they are in are not exported and just called from the module code, and mark module_mutex static. Signed-off-by: Christoph Hellwig --- include/linux/module.h | 2 -- kernel

[PATCH 06/13] kallsyms: only build {, module_}kallsyms_on_each_symbol when required

2021-01-21 Thread Christoph Hellwig
kallsyms_on_each_symbol and module_kallsyms_on_each_symbol are only used by the livepatching code, so don't build them if livepatching is not enabled. Signed-off-by: Christoph Hellwig --- include/linux/kallsyms.h | 17 - include/linux/module.h | 16 kernel

[PATCH 05/13] kallsyms: refactor {,module_}kallsyms_on_each_symbol

2021-01-21 Thread Christoph Hellwig
Require an explicit cll to module_kallsyms_on_each_symbol to look for symbols in modules instead of the call from kallsyms_on_each_symbol, and acquire module_mutex inside of module_kallsyms_on_each_symbol instead of leaving that up to the caller. Signed-off-by: Christoph Hellwig --- kernel

[PATCH 04/13] livepatch: move klp_find_object_module to module.c

2021-01-21 Thread Christoph Hellwig
To uncouple the livepatch code from module loader internals move a slightly refactored version of klp_find_object_module to module.c This allows to mark find_module static and removes one of the last users of module_mutex outside of module.c. Signed-off-by: Christoph Hellwig --- include/linux

[PATCH 03/13] livepatch: refactor klp_init_object

2021-01-21 Thread Christoph Hellwig
Merge three calls to klp_is_module (including one hidden inside klp_find_object_module) into a single one to simplify the code a bit. Signed-off-by: Christoph Hellwig --- kernel/livepatch/core.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kernel

[PATCH 02/13] module: add a module_loaded helper

2021-01-20 Thread Christoph Hellwig
Add a helper that takes modules_mutex and uses find_module to check if a given module is loaded. This provides a better abstraction for the two callers, and allows to unexport modules_mutex and find_module. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/drm_fb_helper.c | 7

[PATCH 01/13] powerpc/powernv: remove get_cxl_module

2021-01-20 Thread Christoph Hellwig
The static inline get_cxl_module function is entirely unused, remove it. Signed-off-by: Christoph Hellwig --- arch/powerpc/platforms/powernv/pci-cxl.c | 22 -- 1 file changed, 22 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-cxl.c b/arch/powerpc/platforms

module loader dead code removal and cleanusp

2021-01-20 Thread Christoph Hellwig
Hi all, this series removes support for long term unused export types and cleans up various loose ends in the module loader. Diffstat: arch/arm/configs/bcm2835_defconfig |1 arch/arm/configs/mxs_defconfig |1 arch/mips/configs/nlm_xlp_defconfig |1

Re: [RFC PATCH v3 4/6] swiotlb: Add restricted DMA alloc/free support.

2021-01-13 Thread Christoph Hellwig
On Wed, Jan 13, 2021 at 06:27:08PM +, Robin Murphy wrote: >> Can we hook in somewhat lower level in the dma-direct code so that all >> the remapping in dma-direct can be reused instead of duplicated? That >> also becomes important if we want to use non-remapping uncached support, >> e.g. on

Re: [RFC PATCH v3 4/6] swiotlb: Add restricted DMA alloc/free support.

2021-01-13 Thread Christoph Hellwig
> +#ifdef CONFIG_SWIOTLB > + if (unlikely(dev->dma_io_tlb_mem)) > + return swiotlb_alloc(dev, size, dma_handle, attrs); > +#endif Another place where the dma_io_tlb_mem is useful to avoid the ifdef. > -phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t >

Re: [RFC PATCH v3 3/6] swiotlb: Use restricted DMA pool if available

2021-01-13 Thread Christoph Hellwig
> +#ifdef CONFIG_SWIOTLB > + if (unlikely(swiotlb_force == SWIOTLB_FORCE) || dev->dma_io_tlb_mem) > return swiotlb_map(dev, phys, size, dir, attrs); > +#endif Please provide a wrapper for the dev->dma_io_tlb_mem check that always returns false if the per-device swiotlb support

Re: [RFC PATCH v3 2/6] swiotlb: Add restricted DMA pool

2021-01-13 Thread Christoph Hellwig
> +#ifdef CONFIG_SWIOTLB > + struct io_tlb_mem *dma_io_tlb_mem; > #endif Please add a new config option for this code instead of always building it when swiotlb is enabled. > +static int swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start, > +

Re: [RFC PATCH v3 2/6] swiotlb: Add restricted DMA pool

2021-01-13 Thread Christoph Hellwig
On Wed, Jan 13, 2021 at 01:29:05PM +0100, Greg KH wrote: > > > Why does this have to be added here? Shouldn't the platform-specific > > > code handle it instead? > > > > The whole code added here is pretty generic. What we need to eventually > > do, though is to add a separate dma_device

Re: [RFC PATCH v3 2/6] swiotlb: Add restricted DMA pool

2021-01-13 Thread Christoph Hellwig
On Wed, Jan 06, 2021 at 08:50:03AM +0100, Greg KH wrote: > > --- a/include/linux/device.h > > +++ b/include/linux/device.h > > @@ -413,6 +413,7 @@ struct dev_links_info { > > * @dma_pools: Dma pools (if dma'ble device). > > * @dma_mem: Internal for coherent mem override. > > *

Re: [RFC PATCH v3 1/6] swiotlb: Add io_tlb_mem struct

2021-01-13 Thread Christoph Hellwig
On Wed, Jan 06, 2021 at 11:41:19AM +0800, Claire Chang wrote: > Added a new struct, io_tlb_mem, as the IO TLB memory pool descriptor and > moved relevant global variables into that struct. > This will be useful later to allow for restricted DMA pool. I like where this is going, but a few

Re: [PATCH] powerpc/mm: Fix KUAP warning by providing copy_from_kernel_nofault_allowed()

2020-12-05 Thread Christoph Hellwig
Yes, I think at this point in the release cycle the specific powerpc fix is safer anyway. But this screams for an eventual general solution.

Re: [PATCH] powerpc/mm: Fix KUAP warning by providing copy_from_kernel_nofault_allowed()

2020-12-05 Thread Christoph Hellwig
that copy_from_kernel_nofault() will return -ERANGE. Looks good. I wonder if we should just default to the TASK_SIZE_MAX check in copy_from_kernel_nofault_allowed for architectures that select CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE? > > Reported-by: Qian Cai > Fixes: c33165253492 (&q

Re: [PATCH V2 4/5] ocxl: Add mmu notifier

2020-11-24 Thread Christoph Hellwig
You probably want to add Jason for an audit of new notifier uses. On Fri, Nov 20, 2020 at 06:32:40PM +0100, Christophe Lombard wrote: > Add invalidate_range mmu notifier, when required (ATSD access of MMIO > registers is available), to initiate TLB invalidation commands. > For the time being, the

Re: [PATCH kernel v4 2/2] powerpc/dma: Fallback to dma_ops when persistent memory present

2020-11-14 Thread Christoph Hellwig
On Thu, Oct 29, 2020 at 12:52:41PM +1100, Alexey Kardashevskiy wrote: > +EXPORT_SYMBOL_GPL(arch_dma_map_page_direct); I've dropped the unused exports and applied the series to dma-mapping-for-next.

Re: [PATCH 1/6] ibmvfc: byte swap login_buf.resp values in attribute show functions

2020-11-12 Thread Christoph Hellwig
On Wed, Nov 11, 2020 at 07:04:37PM -0600, Tyrel Datwyler wrote: > Both ibmvfc_show_host_(capabilities|npiv_version) functions retrieve > values from vhost->login_buf.resp buffer. This is the MAD response > buffer from the VIOS and as such any multi-byte non-string values are in > big endian

Re: [patch V2 00/18] mm/highmem: Preemptible variant of kmap_atomic & friends

2020-10-30 Thread Christoph Hellwig
On Thu, Oct 29, 2020 at 11:18:06PM +0100, Thomas Gleixner wrote: > This is achieved by: ... > > - Consolidating all kmap atomic implementations in generic code ... > Though I wanted to share the current state of affairs before investigating > that further. If there is consensus in going

Re: [PATCH kernel v3 1/2] dma: Allow mixing bypass and mapped DMA operation

2020-10-28 Thread Christoph Hellwig
On Wed, Oct 28, 2020 at 06:00:29PM +1100, Alexey Kardashevskiy wrote: > At the moment we allow bypassing DMA ops only when we can do this for > the entire RAM. However there are configs with mixed type memory > where we could still allow bypassing IOMMU in most cases; > POWERPC with persistent

Re: [PATCH kernel v2 1/2] dma: Allow mixing bypass and normal IOMMU operation

2020-10-28 Thread Christoph Hellwig
On Wed, Oct 28, 2020 at 05:55:23PM +1100, Alexey Kardashevskiy wrote: > > It is passing an address of the end of the mapped area so passing a page > struct means passing page and offset which is an extra parameter and we do > not want to do anything with the page in those hooks anyway so I'd

Re: [PATCH kernel v2 1/2] dma: Allow mixing bypass and normal IOMMU operation

2020-10-27 Thread Christoph Hellwig
> +static inline bool dma_handle_direct(struct device *dev, dma_addr_t > dma_handle) > +{ > + return dma_handle >= dev->archdata.dma_offset; > +} This won't compile except for powerpc, and directly accesing arch members in common code is a bad idea. Maybe both your helpers need to be

Re: [PATCH kernel 0/2] powerpc/dma: Fallback to dma_ops when persistent memory present

2020-10-27 Thread Christoph Hellwig
On Wed, Oct 21, 2020 at 02:20:24PM +1100, Alexey Kardashevskiy wrote: > This allows mixing direct DMA (to/from RAM) and > IOMMU (to/from apersistent memory) on the PPC64/pseries > platform. This was supposed to be a single patch but > unexpected move of direct DMA functions happened. > > This is

<    2   3   4   5   6   7   8   9   10   11   >