[PATCH V3 8/8] sched: mips: Remove unused TASK_SIZE_OF
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/mips/include/asm/processor.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h index 4bb24579d12e..8871fc5b0baa 100644 --- a/arch/mips/include/asm/processor.h +++ b/arch/mips/include/asm/processor.h @@ -61,9 +61,6 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src #define TASK_SIZE (test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64) #define STACK_TOP_MAX TASK_SIZE64 -#define TASK_SIZE_OF(tsk) \ - (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64) - #define TASK_IS_32BIT_ADDR test_thread_flag(TIF_32BIT_ADDR) #endif -- 2.25.1
[PATCH V3 7/8] sched: arm64: Remove unused TASK_SIZE_OF
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/arm64/include/asm/processor.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 6f41b65f9962..d24dfb49237d 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -65,8 +65,6 @@ #endif /* CONFIG_ARM64_64K_PAGES */ #define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ TASK_SIZE_32 : TASK_SIZE_64) -#define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \ - TASK_SIZE_32 : TASK_SIZE_64) #define DEFAULT_MAP_WINDOW (test_thread_flag(TIF_32BIT) ? \ TASK_SIZE_32 : DEFAULT_MAP_WINDOW_64) #else -- 2.25.1
[PATCH V3 6/8] sched: parisc: Remove unused TASK_SIZE_OF
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/parisc/include/asm/processor.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h index b669f4b9040b..d9c8dc76ee6a 100644 --- a/arch/parisc/include/asm/processor.h +++ b/arch/parisc/include/asm/processor.h @@ -23,8 +23,7 @@ #define HAVE_ARCH_PICK_MMAP_LAYOUT -#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size) -#define TASK_SIZE TASK_SIZE_OF(current) +#define TASK_SIZE (current->thread.task_size) #define TASK_UNMAPPED_BASE (current->thread.map_base) #define DEFAULT_TASK_SIZE32(0xFFF0UL) -- 2.25.1
[PATCH V3 5/8] sched: s390: Remove unused TASK_SIZE_OF
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/s390/include/asm/processor.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h index f54c152bf2bf..5581b64a4236 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h @@ -88,11 +88,10 @@ extern void __bpon(void); * User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit. */ -#define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_31BIT) ? \ +#define TASK_SIZE (test_thread_flag(TIF_31BIT) ? \ _REGION3_SIZE : TASK_SIZE_MAX) #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_31BIT) ? \ (_REGION3_SIZE >> 1) : (_REGION2_SIZE >> 1)) -#define TASK_SIZE TASK_SIZE_OF(current) #define TASK_SIZE_MAX (-PAGE_SIZE) #define STACK_TOP (test_thread_flag(TIF_31BIT) ? \ -- 2.25.1
[PATCH V3 4/8] sched: powerpc: Remove unused TASK_SIZE_OF
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/powerpc/include/asm/task_size_64.h | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/powerpc/include/asm/task_size_64.h b/arch/powerpc/include/asm/task_size_64.h index c993482237ed..38fdf8041d12 100644 --- a/arch/powerpc/include/asm/task_size_64.h +++ b/arch/powerpc/include/asm/task_size_64.h @@ -44,11 +44,7 @@ */ #define TASK_SIZE_USER32 (0x0001UL - (1 * PAGE_SIZE)) -#define TASK_SIZE_OF(tsk) \ - (test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 : \ - TASK_SIZE_USER64) - -#define TASK_SIZE TASK_SIZE_OF(current) +#define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64) #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4)) #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4)) -- 2.25.1
[PATCH V3 3/8] sched: sparc: Remove unused TASK_SIZE_OF
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/sparc/include/asm/processor_64.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h index ae851e8fce4c..628349fc4cdd 100644 --- a/arch/sparc/include/asm/processor_64.h +++ b/arch/sparc/include/asm/processor_64.h @@ -27,9 +27,6 @@ #define VPTE_SIZE (1 << (VA_BITS - PAGE_SHIFT + 3)) #endif -#define TASK_SIZE_OF(tsk) \ - (test_tsk_thread_flag(tsk,TIF_32BIT) ? \ -(1UL << 32UL) : ((unsigned long)-VPTE_SIZE)) #define TASK_SIZE \ (test_thread_flag(TIF_32BIT) ? \ (1UL << 32UL) : ((unsigned long)-VPTE_SIZE)) -- 2.25.1
[PATCH V3 2/8] sched: x86: Remove unused TASK_SIZE_OF
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/x86/include/asm/page_64_types.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h index e9e2c3ba5923..6191cf417c31 100644 --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h @@ -74,8 +74,6 @@ IA32_PAGE_OFFSET : DEFAULT_MAP_WINDOW) #define TASK_SIZE (test_thread_flag(TIF_ADDR32) ? \ IA32_PAGE_OFFSET : TASK_SIZE_MAX) -#define TASK_SIZE_OF(child)((test_tsk_thread_flag(child, TIF_ADDR32)) ? \ - IA32_PAGE_OFFSET : TASK_SIZE_MAX) #define STACK_TOP TASK_SIZE_LOW #define STACK_TOP_MAX TASK_SIZE_MAX -- 2.25.1
[PATCH V3 1/8] sched: Remove unused TASK_SIZE_OF
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture. Here is the comment by Arnd: Looking through the git history, I see commit a06db751c321 ("pagemap: check permissions and capabilities at open time") removing the last user. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- include/linux/sched.h | 4 1 file changed, 4 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 78c351e35fec..8e5689d06ac8 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2166,10 +2166,6 @@ static inline bool vcpu_is_preempted(int cpu) extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); extern long sched_getaffinity(pid_t pid, struct cpumask *mask); -#ifndef TASK_SIZE_OF -#define TASK_SIZE_OF(tsk) TASK_SIZE -#endif - #ifdef CONFIG_SMP /* Returns effective CPU energy utilization, as seen by the scheduler */ unsigned long sched_cpu_util(int cpu, unsigned long max); -- 2.25.1
[PATCH V3 0/8] sched: Remove unused TASK_SIZE_OF for all archs
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture. Changes in v3: - Fixup Documentation/process/submitting-patches.rst, add sender Signed-off-by. Changes in v2: - Add Arnd's comment in main patch - Optimize coding convention with Christophe's advise Guo Ren (8): sched: Remove unused TASK_SIZE_OF sched: x86: Remove unused TASK_SIZE_OF sched: sparc: Remove unused TASK_SIZE_OF sched: powerpc: Remove unused TASK_SIZE_OF sched: s390: Remove unused TASK_SIZE_OF sched: parisc: Remove unused TASK_SIZE_OF sched: arm64: Remove unused TASK_SIZE_OF sched: mips: Remove unused TASK_SIZE_OF arch/arm64/include/asm/processor.h | 2 -- arch/mips/include/asm/processor.h | 3 --- arch/parisc/include/asm/processor.h | 3 +-- arch/powerpc/include/asm/task_size_64.h | 6 +- arch/s390/include/asm/processor.h | 3 +-- arch/sparc/include/asm/processor_64.h | 3 --- arch/x86/include/asm/page_64_types.h| 2 -- include/linux/sched.h | 4 8 files changed, 3 insertions(+), 23 deletions(-) -- 2.25.1
[powerpc:next-test 127/179] include/linux/compiler_types.h:335:45: error: call to '__compiletime_assert_34' declared with attribute error: BUILD_BUG failed
tree: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next-test head: beeac538c366cd2828092adecd1edab28326c55b commit: 0faf20a1ad1647c0fc0f5a367c71e5e84deaf899 [127/179] powerpc/64s/interrupt: Don't enable MSR[EE] in irq handlers unless perf is in use config: powerpc-randconfig-r021-20211227 (https://download.01.org/0day-ci/archive/20211228/202112281204.rr4j6o5h-...@intel.com/config) compiler: powerpc-linux-gcc (GCC) 11.2.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id=0faf20a1ad1647c0fc0f5a367c71e5e84deaf899 git remote add powerpc https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git git fetch --no-tags powerpc next-test git checkout 0faf20a1ad1647c0fc0f5a367c71e5e84deaf899 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from : arch/powerpc/include/asm/hw_irq.h: In function 'do_hard_irq_enable': >> include/linux/compiler_types.h:335:45: error: call to >> '__compiletime_assert_34' declared with attribute error: BUILD_BUG failed 335 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ include/linux/compiler_types.h:316:25: note: in definition of macro '__compiletime_assert' 316 | prefix ## suffix(); \ | ^~ include/linux/compiler_types.h:335:9: note: in expansion of macro '_compiletime_assert' 335 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~ include/linux/build_bug.h:59:21: note: in expansion of macro 'BUILD_BUG_ON_MSG' 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") | ^~~~ arch/powerpc/include/asm/hw_irq.h:483:9: note: in expansion of macro 'BUILD_BUG' 483 | BUILD_BUG(); | ^ vim +/__compiletime_assert_34 +335 include/linux/compiler_types.h eb5c2d4b45e3d2 Will Deacon 2020-07-21 321 eb5c2d4b45e3d2 Will Deacon 2020-07-21 322 #define _compiletime_assert(condition, msg, prefix, suffix) \ eb5c2d4b45e3d2 Will Deacon 2020-07-21 323 __compiletime_assert(condition, msg, prefix, suffix) eb5c2d4b45e3d2 Will Deacon 2020-07-21 324 eb5c2d4b45e3d2 Will Deacon 2020-07-21 325 /** eb5c2d4b45e3d2 Will Deacon 2020-07-21 326 * compiletime_assert - break build and emit msg if condition is false eb5c2d4b45e3d2 Will Deacon 2020-07-21 327 * @condition: a compile-time constant condition to check eb5c2d4b45e3d2 Will Deacon 2020-07-21 328 * @msg: a message to emit if condition is false eb5c2d4b45e3d2 Will Deacon 2020-07-21 329 * eb5c2d4b45e3d2 Will Deacon 2020-07-21 330 * In tradition of POSIX assert, this macro will break the build if the eb5c2d4b45e3d2 Will Deacon 2020-07-21 331 * supplied condition is *false*, emitting the supplied error message if the eb5c2d4b45e3d2 Will Deacon 2020-07-21 332 * compiler has support to do so. eb5c2d4b45e3d2 Will Deacon 2020-07-21 333 */ eb5c2d4b45e3d2 Will Deacon 2020-07-21 334 #define compiletime_assert(condition, msg) \ eb5c2d4b45e3d2 Will Deacon 2020-07-21 @335 _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) eb5c2d4b45e3d2 Will Deacon 2020-07-21 336 :: The code at line 335 was first introduced by commit :: eb5c2d4b45e3d2d5d052ea6b8f1463976b1020d5 compiler.h: Move compiletime_assert() macros into compiler_types.h :: TO: Will Deacon :: CC: Will Deacon --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
[powerpc:next] BUILD SUCCESS beeac538c366cd2828092adecd1edab28326c55b
alldefconfig sh kfr2r09-romimage_defconfig arm sunxi_defconfig mips ip22_defconfig powerpc ppc64_defconfig sh se7619_defconfig riscvallmodconfig powerpc lite5200b_defconfig powerpc canyonlands_defconfig armvt8500_v6_v7_defconfig sh secureedge5410_defconfig powerpc redwood_defconfig m68km5307c3_defconfig nds32 allnoconfig powerpc mpc866_ads_defconfig ia64 gensparse_defconfig shmigor_defconfig openrisc alldefconfig h8300h8300h-sim_defconfig powerpccell_defconfig armmps2_defconfig sh lboxre2_defconfig armpleb_defconfig powerpc holly_defconfig mips capcella_defconfig arm pxa255-idp_defconfig arm cm_x300_defconfig sh rts7751r2d1_defconfig mips mtx1_defconfig arm pcm027_defconfig arm pxa3xx_defconfig armmmp2_defconfig shsh7785lcr_defconfig m68k allyesconfig powerpc chrp32_defconfig powerpc cm5200_defconfig h8300 defconfig powerpc allnoconfig mips cu1830-neo_defconfig sh urquell_defconfig arm sama5_defconfig m68k m5208evb_defconfig arcnsim_700_defconfig armxcep_defconfig arm pxa168_defconfig arm stm32_defconfig arm tegra_defconfig arm alldefconfig powerpc mpc836x_rdk_defconfig arm gemini_defconfig arm omap2plus_defconfig arm corgi_defconfig sh rsk7264_defconfig powerpc wii_defconfig arc allyesconfig xtensa audio_kc705_defconfig sh sh7710voipgw_defconfig arm orion5x_defconfig powerpc ppa8548_defconfig i386 alldefconfig sh rsk7269_defconfig powerpc linkstation_defconfig powerpc64 defconfig powerpcgamecube_defconfig sh sh2007_defconfig powerpcicon_defconfig arm nhk8815_defconfig parisc defconfig powerpc asp8347_defconfig armmini2440_defconfig shshmin_defconfig arm multi_v4t_defconfig powerpc tqm5200_defconfig arm s3c6400_defconfig riscv allnoconfig arm colibri_pxa270_defconfig mips decstation_64_defconfig armclps711x_defconfig powerpc pcm030_defconfig arm collie_defconfig powerpc makalu_defconfig powerpc storcenter_defconfig ia64 bigsur_defconfig arm integrator_defconfig riscv nommu_k210_sdcard_defconfig mips mpc30x_defconfig arm h5000_defconfig arm imx_v4_v5_defconfig microblaze mmu_defconfig mipsbcm63xx_defconfig xtensa cadence_csp_defconfig arm randconfig-c002-20211225 arm randconfig-c002-20211227 ia64defconfig ia64 allyesconfig m68k allmodconfig m68kdefconfig nios2 defconfig nds32 defconfig nios2allyesconfig alpha defconfig alphaallyesconfig xtensa allyesconfig h8300allyesconfig arc defconfig sh allmodconfig s390 allyesconfig s390 allmodconfig parisc
Re: (No subject)
You should also fix the existing typo in the documentation (inline): > On Dec 27, 2021, at 07:49, Kefeng Wang wrote: > > This patch select HAVE_ARCH_HUGE_VMALLOC to let arm64 support huge > vmalloc mappings. > > Cc: Catalin Marinas > Cc: Will Deacon > Signed-off-by: Kefeng Wang > --- > Documentation/admin-guide/kernel-parameters.txt | 4 ++-- > arch/arm64/Kconfig | 1 + > arch/arm64/kernel/module.c | 5 +++-- > 3 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt > b/Documentation/admin-guide/kernel-parameters.txt > index 7b2f900fd243..e3f9fd7ec106 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -1639,7 +1639,7 @@ >precedence over memory_hotplug.memmap_on_memory. > > > -hugevmalloc=[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC > +hugevmalloc=[KNL,PPC,ARM64] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC >Format: { on | off } >Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED. "Reguires" should be "Requires." > > @@ -3424,7 +3424,7 @@ > >nohugeiomap[KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings. > > -nohugevmalloc[PPC] Disable kernel huge vmalloc mappings. > +nohugevmalloc[KNL,PPC,ARM64] Disable kernel huge vmalloc mappings. > >nosmt[KNL,S390] Disable symmetric multithreading (SMT). >Equivalent to smt=1. > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 3bb0b67292b5..c34bbb4482b0 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -142,6 +142,7 @@ config ARM64 >select HAVE_ARCH_AUDITSYSCALL >select HAVE_ARCH_BITREVERSE >select HAVE_ARCH_COMPILER_H > +select HAVE_ARCH_HUGE_VMALLOC >select HAVE_ARCH_HUGE_VMAP >select HAVE_ARCH_JUMP_LABEL >select HAVE_ARCH_JUMP_LABEL_RELATIVE > diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c > index 309a27553c87..af7b4cbace2b 100644 > --- a/arch/arm64/kernel/module.c > +++ b/arch/arm64/kernel/module.c > @@ -36,7 +36,8 @@ void *module_alloc(unsigned long size) >module_alloc_end = MODULES_END; > >p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base, > -module_alloc_end, gfp_mask, PAGE_KERNEL, VM_DEFER_KMEMLEAK, > +module_alloc_end, gfp_mask, PAGE_KERNEL, > +VM_DEFER_KMEMLEAK | VM_NO_HUGE_VMAP, >NUMA_NO_NODE, __builtin_return_address(0)); > >if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) && > @@ -55,7 +56,7 @@ void *module_alloc(unsigned long size) > */ >p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base, >module_alloc_base + SZ_2G, GFP_KERNEL, > -PAGE_KERNEL, 0, NUMA_NO_NODE, > +PAGE_KERNEL, VM_NO_HUGE_VMAP, NUMA_NO_NODE, >__builtin_return_address(0)); > >if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { > -- > 2.26.2 > >
Re: [PATCH 2/3] KVM: PPC: Fix vmx/vsx mixup in mmio emulation
Nicholas Piggin writes: > Excerpts from Fabiano Rosas's message of December 24, 2021 7:15 am: >> The MMIO emulation code for vector instructions is duplicated between >> VSX and VMX. When emulating VMX we should check the VMX copy size >> instead of the VSX one. >> >> Fixes: acc9eb9305fe ("KVM: PPC: Reimplement LOAD_VMX/STORE_VMX instruction >> ...") >> Signed-off-by: Fabiano Rosas > > Good catch. AFAIKS handle_vmx_store needs the same treatment? If you > agree then Half the bug now, half the bug next year... haha I'll send a v2. aside: All this duplication is kind of annoying. I'm looking into what it would take to have quadword instruction emulation here as well (Alexey caught a bug with syskaller) and the code would be really similar. I see that x86 has a more generic implementation that maybe we could take advantage of. See "f78146b0f923 (KVM: Fix page-crossing MMIO)"
[RFC 02/32] Kconfig: introduce HAS_IOPORT option and select it as necessary
We introduce a new HAS_IOPORT Kconfig option to gate support for I/O port access. In a future patch HAS_IOPORT=n will disable compilation of the I/O accessor functions inb()/outb() and friends on architectures which can not meaningfully support legacy I/O spaces. On these platforms inb()/outb() etc are currently just stubs in asm-generic/io.h which when called will cause a NULL pointer access which some compilers actually detect and warn about. The dependencies on HAS_IOPORT in drivers as well as ifdefs for HAS_IOPORT specific sections will be added in subsequent patches on a per subsystem basis. Then a final patch will ifdef the I/O access functions on HAS_IOPORT thus turning any use not gated by HAS_IOPORT into a compile-time warning. Link: https://lore.kernel.org/lkml/CAHk-=wg80je=k7madf4e7wrrnp37e3qh6y10svhdc7o8sz_...@mail.gmail.com/ Co-developed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Signed-off-by: Niklas Schnelle --- arch/alpha/Kconfig | 1 + arch/arc/Kconfig| 1 + arch/arm/Kconfig| 1 + arch/arm64/Kconfig | 1 + arch/ia64/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/microblaze/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig| 1 + arch/riscv/Kconfig | 1 + arch/sh/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/x86/Kconfig| 1 + drivers/bus/Kconfig | 2 +- lib/Kconfig | 4 lib/Kconfig.kgdb| 1 + 17 files changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 4e87783c90ad..472a0c5e4c2f 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -28,6 +28,7 @@ config ALPHA select AUDIT_ARCH select GENERIC_CPU_VULNERABILITIES select GENERIC_SMP_IDLE_THREAD + select HAS_IOPORT select HAVE_ARCH_AUDITSYSCALL select HAVE_MOD_ARCH_SPECIFIC select MODULES_USE_ELF_RELA diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index b4ae6058902a..b3911ebbd237 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -27,6 +27,7 @@ config ARC select GENERIC_PENDING_IRQ if SMP select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD + select HAS_IOPORT select HAVE_ARCH_KGDB select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE if ARC_MMU_V4 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c2724d986fa0..605709b6eecb 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -66,6 +66,7 @@ config ARM select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD select HARDIRQS_SW_RESEND + select HAS_IOPORT select HAVE_ARCH_AUDITSYSCALL if AEABI && !OABI_COMPAT select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index c4207cf9bb17..a8b199a40c8f 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -135,6 +135,7 @@ config ARM64 select GENERIC_GETTIMEOFDAY select GENERIC_VDSO_TIME_NS select HARDIRQS_SW_RESEND + select HAS_IOPORT select HAVE_MOVE_PMD select HAVE_MOVE_PUD select HAVE_PCI diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 1e33666fa679..672aa2a88b19 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -24,6 +24,7 @@ config IA64 select PCI_DOMAINS if PCI select PCI_MSI select PCI_SYSCALL if PCI + select HAS_IOPORT select HAVE_ASM_MODVERSIONS select HAVE_UNSTABLE_SCHED_CLOCK select HAVE_EXIT_THREAD diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 0b50da08a9c5..926d97c33828 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -16,6 +16,7 @@ config M68K select GENERIC_CPU_DEVICES select GENERIC_IOMAP select GENERIC_IRQ_SHOW + select HAS_IOPORT select HAVE_AOUT if MMU select HAVE_ASM_MODVERSIONS select HAVE_DEBUG_BUGVERBOSE diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 59798e43cdb0..213ef2940079 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -21,6 +21,7 @@ config MICROBLAZE select GENERIC_IRQ_SHOW select GENERIC_PCI_IOMAP select GENERIC_SCHED_CLOCK + select HAS_IOPORT if PCI select HAVE_ARCH_HASH select HAVE_ARCH_KGDB select HAVE_ARCH_SECCOMP diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0215dc1529e9..87e6e7c29493 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -47,6 +47,7 @@ config MIPS select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL select GUP_GET_PTE_LOW_HIGH if CPU_MIPS32 && PHYS_ADDR_T_64BIT + select HAS_IOPORT select HAVE_ARCH_COMPILER_H select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_KGDB if MIPS_FP_SUPPORT diff --git
Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings
On 12/27/21 6:59 AM, Kefeng Wang wrote: > This patch select HAVE_ARCH_HUGE_VMALLOC to let X86_64 and X86_PAE > support huge vmalloc mappings. In general, this seems interesting and the diff is simple. But, I don't see _any_ x86-specific data. I think the bare minimum here would be a few kernel compiles and some 'perf stat' data for some TLB events. > diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c > index 95fa745e310a..6bf5cb7d876a 100644 > --- a/arch/x86/kernel/module.c > +++ b/arch/x86/kernel/module.c > @@ -75,8 +75,8 @@ void *module_alloc(unsigned long size) > > p = __vmalloc_node_range(size, MODULE_ALIGN, > MODULES_VADDR + get_module_load_offset(), > - MODULES_END, gfp_mask, > - PAGE_KERNEL, VM_DEFER_KMEMLEAK, > NUMA_NO_NODE, > + MODULES_END, gfp_mask, PAGE_KERNEL, > + VM_DEFER_KMEMLEAK | VM_NO_HUGE_VMAP, > NUMA_NO_NODE, > __builtin_return_address(0)); > if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { > vfree(p); To figure out what's going on in this hunk, I had to look at the cover letter (which I wasn't cc'd on). That's not great and it means that somebody who stumbles upon this in the code is going to have a really hard time figuring out what is going on. Cover letters don't make it into git history. This desperately needs a comment and some changelog material in *this* patch. But, even the description from the cover letter is sparse: > There are some disadvantages about this feature[2], one of the main > concerns is the possible memory fragmentation/waste in some scenarios, > also archs must ensure that any arch specific vmalloc allocations that > require PAGE_SIZE mappings(eg, module alloc with STRICT_MODULE_RWX) > use the VM_NO_HUGE_VMAP flag to inhibit larger mappings. That just says that x86 *needs* PAGE_SIZE allocations. But, what happens if VM_NO_HUGE_VMAP is not passed (like it was in v1)? Will the subsequent permission changes just fragment the 2M mapping?
[RFC PATCH 3/3] powerpc/pseries/vas: Use migration_in_progress to disable DLPAR
Before migration starts, all secondary CPUs will be offline which can invoke VAS DLPAR event. So disable VAS DLPAR event with migration_in_progress flag during suspend and enable after resume operations. The current partition migration implementation does not freeze the user space and the user space can continue open VAS windows. So when migration_in_progress flag is enabled, VAS open window API returns -EBUSY. Signed-off-by: Haren Myneni --- arch/powerpc/platforms/pseries/vas.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c index d2d7202a4f4e..1a10c1904aaa 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -30,6 +30,7 @@ static bool copypaste_feat; static struct vas_caps vascaps[VAS_MAX_FEAT_TYPE]; static DEFINE_MUTEX(vas_pseries_mutex); +static bool migration_in_progress; static long hcall_return_busy_check(long rc) { @@ -349,8 +350,11 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags, * same fault IRQ is not freed by the OS before. */ mutex_lock(_pseries_mutex); - rc = allocate_setup_window(txwin, (u64 *)[0], - cop_feat_caps->win_type); + if (migration_in_progress) + rc = -EBUSY; + else + rc = allocate_setup_window(txwin, (u64 *)[0], + cop_feat_caps->win_type); mutex_unlock(_pseries_mutex); if (rc) goto out; @@ -771,6 +775,9 @@ int vas_reconfig_capabilties(u8 type) return -ENOMEM; mutex_lock(_pseries_mutex); + if (migration_in_progress) + goto out; + rc = h_query_vas_capabilities(H_QUERY_VAS_CAPABILITIES, vcaps->feat, (u64)virt_to_phys(hv_caps)); if (rc) @@ -866,6 +873,11 @@ static int vas_migrate_windows(bool suspend) mutex_lock(_pseries_mutex); + if (suspend) + migration_in_progress = true; + else + migration_in_progress = false; + for (i = 0; i < VAS_MAX_FEAT_TYPE; i++) { vcaps = [i]; caps = >caps; -- 2.27.0
[RFC PATCH 2/3] powerpc/pseries/vas: Add VAS suspend/resume notifier
Since VAS windows belong to the VAS hardware resource, the hypervisor expects the partition to close them on source partition and reopen them after the partition migrated on the destination machine. This suspend/resume notifier invokes suspend operation before and resume operation after migration. All active windows for both default and QoS types will be closed during suspend and reopen them during resume. During migration, the user space should expect paste instruction failure if issues copy/paste on these active windows. Signed-off-by: Haren Myneni --- arch/powerpc/platforms/pseries/vas.c | 97 +++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c index b9d1c0bac624..d2d7202a4f4e 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "vas.h" @@ -845,6 +846,98 @@ static struct notifier_block pseries_vas_nb = { .notifier_call = pseries_vas_notifier, }; +/* + * For LPM, all windows have to be closed on the source partition + * before migration and reopen them on the destination partition + * after migration. So closing windows during suspend and + * reopen them during resume. + */ +static int vas_migrate_windows(bool suspend) +{ + struct hv_vas_cop_feat_caps *hv_caps; + struct vas_cop_feat_caps *caps; + int lpar_creds, new_creds = 0; + struct vas_caps *vcaps; + int i, rc = 0; + + hv_caps = kmalloc(sizeof(*hv_caps), GFP_KERNEL); + if (!hv_caps) + return -ENOMEM; + + mutex_lock(_pseries_mutex); + + for (i = 0; i < VAS_MAX_FEAT_TYPE; i++) { + vcaps = [i]; + caps = >caps; + lpar_creds = atomic_read(>target_creds); + + rc = h_query_vas_capabilities(H_QUERY_VAS_CAPABILITIES, vcaps->feat, + (u64)virt_to_phys(hv_caps)); + if (!rc) { + new_creds = be16_to_cpu(hv_caps->target_lpar_creds); + /* +* Should not happen. But incase print messages, close all +* windows in the list during suspend and reopen windows +* based on new lpar_creds on the destination system. +*/ + if (lpar_creds != new_creds) { + pr_err("%s: lpar creds: %d HV lpar creds: %d\n", + suspend ? "Suspend" : "Resume", lpar_creds, + new_creds); + pr_err("Used creds: %d, Active creds: %d\n", + atomic_read(>used_creds), + vcaps->num_wins - vcaps->close_wins); + } + } else { + pr_err("%s: Get VAS capabilities failed with %d\n", + suspend ? "Suspend" : "Resume", rc); + /* +* We can not stop migration with the current lpm +* implementation. So continue closing all windows in the +* list (during suspend) and return without opending windows +* (during resume) if VAS capabilities HCALL failed. +*/ + if (!suspend) + goto out; + } + + if (suspend) + rc = reconfig_close_windows(vcaps, vcaps->num_wins, true); + else { + atomic_set(>target_creds, new_creds); + rc = reconfig_open_windows(vcaps, new_creds, true); + } + + /* +* Ignore errors during suspend and return for resume. +*/ + if (rc && !suspend) + goto out; + } + +out: + mutex_unlock(_pseries_mutex); + kfree(hv_caps); + return rc; +} + +static int vas_migration_handler(struct notifier_block *nb, +unsigned long action, void *data) +{ + if (action == PSERIES_RESUMING) + return vas_migrate_windows(false); + else + return vas_migrate_windows(true); + +} + +static struct pseries_suspend_handler vas_suspend_handler = { + .notifier_block = { + .notifier_call = vas_migration_handler, + }, +}; + + static int __init pseries_vas_init(void) { struct hv_vas_cop_feat_caps *hv_cop_caps; @@ -901,8 +994,10 @@ static int __init pseries_vas_init(void) } /* Processors can be added/removed only on LPAR */ -
[RFC PATCH 1/3] powerpc/pseries/vas: Modify reconfig open/close functions for migration
VAS is a hardware engine stays on the chip. So when the partition migrates, all VAS windows on the source system have to be closed and reopen them on the destination after migration. This patch make changes to the current reconfig_open/close_windows functions to support migration: - Sets the window status to VAS_WIN_MIGRATE_CLOSE when closes and reopen windows with the same status during resume. - Continue to close all windows even if deallocate HCALL failed (should not happen) since no way to stop migration with the current LPM implementation. Signed-off-by: Haren Myneni --- arch/powerpc/include/asm/vas.h | 2 + arch/powerpc/platforms/pseries/vas.c | 63 ++-- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h index 72d1df038b4b..8b28cd7aaedc 100644 --- a/arch/powerpc/include/asm/vas.h +++ b/arch/powerpc/include/asm/vas.h @@ -41,6 +41,8 @@ #define VAS_WIN_NO_CRED_CLOSE 0x4 /* Linux specific status when */ /* window is closed due to lost */ /* credit */ +#define VAS_WIN_MIGRATE_CLOSE 0x5 /* Linux status when window is */ + /* closed due to migration */ /* * Get/Set bit fields */ diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c index 169f0cccb166..b9d1c0bac624 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -449,11 +449,12 @@ static int vas_deallocate_window(struct vas_window *vwin) mutex_lock(_pseries_mutex); /* * VAS window is already closed in the hypervisor when -* lost the credit. So just remove the entry from -* the list, remove task references and free vas_window +* lost the credit or with migration. So just remove the entry +* from the list, remove task references and free vas_window * struct. */ - if (win->vas_win.status != VAS_WIN_NO_CRED_CLOSE) { + if ((win->vas_win.status != VAS_WIN_NO_CRED_CLOSE) && + (win->vas_win.status != VAS_WIN_MIGRATE_CLOSE)) { rc = deallocate_free_window(win); if (rc) { mutex_unlock(_pseries_mutex); @@ -570,12 +571,14 @@ static int get_vas_capabilities(u8 feat, enum vas_cop_feat_type type, * by setting the remapping to new paste address if the window is * active. */ -static int reconfig_open_windows(struct vas_caps *vcaps, int creds) +static int reconfig_open_windows(struct vas_caps *vcaps, int creds, +bool migrate) { long domain[PLPAR_HCALL9_BUFSIZE] = {VAS_DEFAULT_DOMAIN_ID}; struct vas_cop_feat_caps *caps = >caps; struct pseries_vas_window *win = NULL, *tmp; int rc, mv_ents = 0; + int status; /* * Nothing to do if there are no closed windows. @@ -594,8 +597,10 @@ static int reconfig_open_windows(struct vas_caps *vcaps, int creds) * (dedicated). If 1 core is added, this LPAR can have 20 more * credits. It means the kernel can reopen 20 windows. So move * 20 entries in the VAS windows lost and reopen next 20 windows. +* For partition migration, reopen all windows that are closed +* during resume. */ - if (vcaps->close_wins > creds) + if ((vcaps->close_wins > creds) && !migrate) mv_ents = vcaps->close_wins - creds; list_for_each_entry_safe(win, tmp, >list, win_list) { @@ -605,11 +610,20 @@ static int reconfig_open_windows(struct vas_caps *vcaps, int creds) mv_ents--; } + /* +* Open windows if they are closed only with migration or +* DLPAR (lost credit) before. +*/ + if (migrate) + status = VAS_WIN_MIGRATE_CLOSE; + else + status = VAS_WIN_NO_CRED_CLOSE; + list_for_each_entry_safe_from(win, tmp, >list, win_list) { /* * Nothing to do on this window if it is active. */ - if (win->vas_win.status != VAS_WIN_NO_CRED_CLOSE) + if (win->vas_win.status != status) continue; rc = allocate_setup_window(win, (u64 *)[0], @@ -652,17 +666,26 @@ static int reconfig_open_windows(struct vas_caps *vcaps, int creds) * the user space to fall back to SW compression and manage with the * existing windows. */ -static int reconfig_close_windows(struct vas_caps *vcap, int excess_creds) +static int reconfig_close_windows(struct vas_caps *vcap, int excess_creds, + bool migrate) { struct pseries_vas_window *win, *tmp; struct vas_user_win_ref *task_ref; struct vm_area_struct *vma; - int rc = 0; +
[RFC PATCH 0/3] powerpc/pseries/vas: VAS/NXGZIP support with LPM
Virtual Accelerator Switchboard (VAS) is an engine stays on the chip. So all windows opened on a specific engine belongs to VAS the chip. The hypervisor expects the partition to close all active windows on the sources system and reopen them after migration on the destination machine. This patch series adds VAS support with the partition migration. When the migration initiates, the VAS code gets suspend notifier which closes all active windows and sets VAS_WIN_MIGRATE_CLOSE as window status. Whereas receives resume notifier after migration to reopen all windows which has VAS_WIN_MIGRATE_CLOSE status. These patches depend on VAS/DLPAR support patch series (https://lists.ozlabs.org/pipermail/linuxppc-dev/2021-December/238331.html) Also the suspend/resume notifier code is added in a separate patch and will be posted later with the actual patches. Haren Myneni (3): powerpc/pseries/vas: Modify reconfig open/close functions for migration powerpc/pseries/vas: Add VAS suspend/resume notifier powerpc/pseries/vas: Use migration_in_progress to disable DLPAR arch/powerpc/include/asm/vas.h | 2 + arch/powerpc/platforms/pseries/vas.c | 176 --- 2 files changed, 162 insertions(+), 16 deletions(-) -- 2.27.0