Re: [PATCH v3 04/12] powerpc: Prepare func_desc_t for refactorisation

2022-02-10 Thread Segher Boessenkool
On Thu, Feb 10, 2022 at 04:54:52PM -0800, Kees Cook wrote: > On Sun, Oct 17, 2021 at 02:38:17PM +0200, Christophe Leroy wrote: (edited:) > > +typedef struct { > > + unsigned long addr; > > +} func_desc_t; > > > > static func_desc_t func_desc(unsigned long addr) > > { > > + return

[PATCH] Fixup for next-test 3a1a8f078670 ("powerpc/ftrace: Remove ftrace_32.S")

2022-02-10 Thread Christophe Leroy
Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/trace/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/trace/Makefile b/arch/powerpc/kernel/trace/Makefile index ac7d42a4e8d0..542aa7a8b2b4 100644 --- a/arch/powerpc/kernel/trace/Makefile

[PATCH v2] powerpc/mm: Update default hugetlb size early

2022-02-10 Thread Aneesh Kumar K.V
commit: d9c234005227 ("Do not depend on MAX_ORDER when grouping pages by mobility") introduced pageblock_order which will be used to group pages better. The kernel now groups pages based on the value of HPAGE_SHIFT. Hence HPAGE_SHIFT should be set before we call set_pageblock_order.

Re: [PATCH kernel 3/3] powerpc/llvm/lto: Workaround conditional branches in FTR_SECTION_ELSE

2022-02-10 Thread Russell Currey
On Fri, 2022-02-11 at 13:31 +1100, Alexey Kardashevskiy wrote: > diff --git a/arch/powerpc/lib/memcpy_64.S > b/arch/powerpc/lib/memcpy_64.S > index 016c91e958d8..286c7e2d0883 100644 > --- a/arch/powerpc/lib/memcpy_64.S > +++ b/arch/powerpc/lib/memcpy_64.S > @@ -50,10 +50,11 @@

[PATCH v2 2/2] selftest/vm: Add util.h and and move helper functions there

2022-02-10 Thread Aneesh Kumar K.V
Avoid code duplication by adding util.h Cc: Shuah Khan Cc: linux-kselft...@vger.kernel.org Signed-off-by: Aneesh Kumar K.V --- tools/testing/selftests/vm/ksm_tests.c| 45 +--- tools/testing/selftests/vm/transhuge-stress.c | 49 ++---

[PATCH v2 1/2] selftest/vm: Use correct PAGE_SHIFT value for ppc64

2022-02-10 Thread Aneesh Kumar K.V
Keep it simple by using a #define and limiting hugepage size to 2M. This keeps the test simpler instead of dynamically finding the page size and huge page size. Without this tests are broken w.r.t reading /proc/self/pagemap if (pread(pagemap_fd, ent, sizeof(ent),

[PATCH v2] mm/hugetlb: Fix kernel crash with hugetlb mremap

2022-02-10 Thread Aneesh Kumar K.V
This fixes the below crash: kernel BUG at include/linux/mm.h:2373! cpu 0x5d: Vector: 700 (Program Check) at [c0003c6e76e0] pc: c0581a54: pmd_to_page+0x54/0x80 lr: c058d184: move_hugetlb_page_tables+0x4e4/0x5b0 sp: c0003c6e7980 msr: 90029033 current

Re: [PATCH 3/3] crypto/nx: Constify static attribute_group structs

2022-02-10 Thread Daniel Axtens
Hi Rikard, > The only usage of these is to pass their address to > sysfs_{create,remove}_group(), which takes pointers to const struct > attribute_group. Make them const to allow the compiler to put them in > read-only memory. I checked the file. Indeed, those structs are only used in

Re: [PATCH 38/49] arch/powerpc: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate

2022-02-10 Thread Michael Ellerman
Yury Norov writes: > PowerPC code uses cpumask_weight() to compare the weight of cpumask with > a given number. We can do it more efficiently with cpumask_weight_{eq, ...} > because conditional cpumask_weight may stop traversing the cpumask earlier, > as soon as condition is (or can't be) met. >

[powerpc:next] BUILD REGRESSION 14cc509e7b686ce5db7175d0fb084cacae046d96

2022-02-10 Thread kernel test robot
reference to `_mcount' Error/Warning ids grouped by kconfigs: gcc_recent_errors `-- powerpc64-randconfig-r012-20220210 |-- (.text):undefined-reference-to-_mcount |-- compat_audit.c:(.text):undefined-reference-to-_mcount |-- core.c:(.text):undefined-reference-to-_mcount |-- fault.c

[PATCH kernel 3/3] powerpc/llvm/lto: Workaround conditional branches in FTR_SECTION_ELSE

2022-02-10 Thread Alexey Kardashevskiy
LTO invites ld/lld to optimize the output binary and this may affect the FTP alternative section if alt branches use "bc" (Branch Conditional) which only allows 16 bit offsets. This manifests in errors like: ld.lld: error: InputSection too large for range extension thunk

[PATCH kernel 2/3] powerpc/llvm: Sample config for LLVM LTO

2022-02-10 Thread Alexey Kardashevskiy
The config is a copy of ppc64_defconfig with a few tweaks. This could be a smaller config to merge into ppc64_defconfig but unfortunately merger does not allow disabling already enabled options. This is a command line to compile the kernel using the upstream llvm: make -j64

[PATCH kernel 1/3] powerpc/64: Allow LLVM LTO builds

2022-02-10 Thread Alexey Kardashevskiy
The upstream LLVM supports now LTO on PPC, enable it. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index b779603978e1..91c14f83 100644 --- a/arch/powerpc/Kconfig +++

[PATCH kernel 0/3] powerpc/llvm/lto: Enable CONFIG_LTO_CLANG_THIN=y

2022-02-10 Thread Alexey Kardashevskiy
This is based on sha1 1b43a74f255c Michael Ellerman "Automatic merge of 'master' into merge (2022-02-01 10:41)". Please comment. Thanks. Alexey Kardashevskiy (3): powerpc/64: Allow LLVM LTO builds powerpc/llvm: Sample config for LLVM LTO powerpc/llvm/lto: Workaround conditional

[powerpc:fixes-test] BUILD SUCCESS 9bb162fa26ed76031ed0e7dbc77ccea0bf977758

2022-02-10 Thread kernel test robot
allmodconfig powerpc randconfig-c003-20220210 i386 randconfig-c001 xtensa virt_defconfig powerpc64 defconfig powerpc sequoia_defconfig arm iop32x_defconfig

Re: rcutorture’s init segfaults in ppc64le VM

2022-02-10 Thread Michael Ellerman
Paul Menzel writes: > Am 08.02.22 um 11:09 schrieb Michael Ellerman: >> Paul Menzel writes: > > […] > >>> On the POWER8 server IBM S822LC running Ubuntu 21.10, building Linux >>> 5.17-rc2+ with rcutorture tests >> >> I'm not sure if that's the host kernel version or the version you're >> using

Re: [PATCH v3 12/12] lkdtm: Add a test for function descriptors protection

2022-02-10 Thread Kees Cook
On Sun, Oct 17, 2021 at 02:38:25PM +0200, Christophe Leroy wrote: > Add WRITE_OPD to check that you can't modify function > descriptors. > > Gives the following result when function descriptors are > not protected: > > lkdtm: Performing direct entry WRITE_OPD > lkdtm: attempting bad

Re: [PATCH v3 11/12] lkdtm: Fix execute_[user]_location()

2022-02-10 Thread Kees Cook
On Sun, Oct 17, 2021 at 02:38:24PM +0200, Christophe Leroy wrote: > execute_location() and execute_user_location() intent > to copy do_nothing() text and execute it at a new location. > However, at the time being it doesn't copy do_nothing() function > but do_nothing() function descriptor which

Re: [PATCH v3 08/12] asm-generic: Refactor dereference_[kernel]_function_descriptor()

2022-02-10 Thread Kees Cook
On Thu, Feb 10, 2022 at 09:30:43PM +1100, Michael Ellerman wrote: > Christophe Leroy writes: > > diff --git a/kernel/extable.c b/kernel/extable.c > > index b0ea5eb0c3b4..1ef13789bea9 100644 > > --- a/kernel/extable.c > > +++ b/kernel/extable.c > > @@ -159,12 +160,32 @@ int

Re: [PATCH v3 04/12] powerpc: Prepare func_desc_t for refactorisation

2022-02-10 Thread Kees Cook
On Sun, Oct 17, 2021 at 02:38:17PM +0200, Christophe Leroy wrote: > In preparation of making func_desc_t generic, change the ELFv2 > version to a struct containing 'addr' element. > > This allows using single helpers common to ELFv1 and ELFv2. > > Signed-off-by: Christophe Leroy > --- >

Re: [PATCH v3 01/12] powerpc: Move and rename func_descr_t

2022-02-10 Thread Kees Cook
On Sun, Oct 17, 2021 at 02:38:14PM +0200, Christophe Leroy wrote: > There are three architectures with function descriptors, try to > have common names for the address they contain in order to > refactor some functions into generic functions later. > > powerpc has 'entry' > ia64 has 'ip' > parisc

[PATCHv2] powerpc/lib/sstep: fix 'ptesync' build error

2022-02-10 Thread Anders Roxell
Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian 2.37.90.20220207) the following build error shows up: {standard input}: Assembler messages: {standard input}:2088: Error: unrecognized opcode: `ptesync' make[3]: *** [/builds/linux/scripts/Makefile.build:287:

[PATCH 43/49] soc/qman: replace cpumask_weight with cpumask_weight_lt

2022-02-10 Thread Yury Norov
qman_test_stash() calls cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_lt because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is (or can't be) met. Signed-off-by: Yury Norov ---

[PATCH 38/49] arch/powerpc: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate

2022-02-10 Thread Yury Norov
PowerPC code uses cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_{eq, ...} because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is (or can't be) met. Signed-off-by: Yury Norov

Re: [PATCH v5 0/6] KEXEC_SIG with appended signature

2022-02-10 Thread Luis Chamberlain
On Wed, Feb 09, 2022 at 03:46:05PM +1100, Michael Ellerman wrote: > Luis Chamberlain writes: > > On Tue, Jan 11, 2022 at 12:37:42PM +0100, Michal Suchanek wrote: > >> Hello, > >> > >> This is a refresh of the KEXEC_SIG series. > >> > >> This adds KEXEC_SIG support on powerpc and deduplicates

[PATCH 3/3] crypto/nx: Constify static attribute_group structs

2022-02-10 Thread Rikard Falkeborn
The only usage of these is to pass their address to sysfs_{create,remove}_group(), which takes pointers to const struct attribute_group. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/crypto/nx/nx-common-pseries.c | 4 ++-- 1

[PATCH 2/3] crypto: omap-sham - Constify static attribute_group

2022-02-10 Thread Rikard Falkeborn
The only usage of omap_sham_attr_group is to pass its address to sysfs_{create,remove}_group(), which takes pointers to const struct attribute_group. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/crypto/omap-sham.c | 2 +- 1 file

[PATCH 1/3] crypto: omap-aes - Constify static attribute_group

2022-02-10 Thread Rikard Falkeborn
The only usage of omap_aes_attr_group is to pass its address to sysfs_{create,remove}_group(), which takes pointers to const struct attribute_group. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn --- drivers/crypto/omap-aes.c | 2 +- 1 file

[PATCH 0/3] drivers/crypto: Constify static attribute_group

2022-02-10 Thread Rikard Falkeborn
This series constifies a couple of static attribute_group structs that are not modified. This allows the compiler to put them in read-only memory. The patches are independent and can be applied in any order (and go through different trees if needed). Rikard Falkeborn (3): crypto: omap-aes -

Re: [PATCH] powerpc/lib/sstep: fix 'ptesync' build error

2022-02-10 Thread Christophe Leroy
Le 10/02/2022 à 13:44, Anders Roxell a écrit : > Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian > 2.37.90.20220207) the following build error shows up: > > {standard input}: Assembler messages: > {standard input}:2088: Error: unrecognized opcode: `ptesync' > make[3]: ***

Re: [RFC PATCH 2/3] powerpc/ftrace: Override ftrace_location_lookup() for MPROFILE_KERNEL

2022-02-10 Thread Steven Rostedt
On Thu, 10 Feb 2022 16:40:28 + "Naveen N. Rao" wrote: > The other option is to mark ftrace_cmp_recs() as a __weak function, but > I have a vague recollection of you suggesting #ifdef rather than a > __weak function in the past. I might be mis-remembering, so if you think > making this a

Re: [RFC PATCH 2/3] powerpc/ftrace: Override ftrace_location_lookup() for MPROFILE_KERNEL

2022-02-10 Thread Naveen N. Rao
Steven Rostedt wrote: On Thu, 10 Feb 2022 13:58:29 + "Naveen N. Rao" wrote: diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index f9feb197b2daaf..68f20cf34b0c47 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1510,6 +1510,7 @@ ftrace_ops_test(struct

Re: [PATCH v2 0/7] soc: fsl: guts: cleanups and serial_number support

2022-02-10 Thread Arnd Bergmann
On Wed, Feb 9, 2022 at 5:32 PM Michael Walle wrote: > > This series converts the guts driver from a platform driver to just an > core_initcall. The driver itself cannot (or rather should never) be > unloaded because others depends on detecting the current SoC revision > to apply chip errata.

Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64

2022-02-10 Thread Shuah Khan
On 2/10/22 8:03 AM, Aneesh Kumar K V wrote: On 2/10/22 20:09, Shuah Khan wrote: On 2/9/22 9:12 PM, Aneesh Kumar K.V wrote: Shuah Khan writes: On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote: Keep it simple by using a #define and limiting hugepage size to 2M. This keeps the test simpler instead

Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64

2022-02-10 Thread Aneesh Kumar K V
On 2/10/22 20:09, Shuah Khan wrote: On 2/9/22 9:12 PM, Aneesh Kumar K.V wrote: Shuah Khan writes: On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote: Keep it simple by using a #define and limiting hugepage size to 2M. This keeps the test simpler instead of dynamically finding the page size and

Re: [RFC PATCH 2/3] powerpc/ftrace: Override ftrace_location_lookup() for MPROFILE_KERNEL

2022-02-10 Thread Steven Rostedt
On Thu, 10 Feb 2022 13:58:29 + "Naveen N. Rao" wrote: > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index f9feb197b2daaf..68f20cf34b0c47 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -1510,6 +1510,7 @@ ftrace_ops_test(struct ftrace_ops *ops,

Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64

2022-02-10 Thread Shuah Khan
On 2/9/22 9:12 PM, Aneesh Kumar K.V wrote: Shuah Khan writes: On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote: Keep it simple by using a #define and limiting hugepage size to 2M. This keeps the test simpler instead of dynamically finding the page size and huge page size. Without this tests are

Re: [RFC PATCH 2/3] powerpc/ftrace: Override ftrace_location_lookup() for MPROFILE_KERNEL

2022-02-10 Thread Naveen N. Rao
Steven Rostedt wrote: On Wed, 09 Feb 2022 17:50:09 + "Naveen N. Rao" wrote: However, I think we will not be able to use a fixed range. I would like to reserve instructions from function entry till the branch to _mcount(), and it can be two or four instructions depending on whether a

Re: [powerpc] Warning mm/slub.c:3246 during boot (next-20220210) w/ext4

2022-02-10 Thread Ritesh Harjani
On 22/02/10 06:57PM, Sachin Sant wrote: > While booting 5.17.0-rc3-next-20220210 on Power following warning > is seen: > > [ 32.626501] EXT4-fs (sda2): re-mounted. Quota mode: none. > [ 32.627225] [ cut here ] > [ 32.627236] WARNING: CPU: 27 PID:

[powerpc] Warning mm/slub.c:3246 during boot (next-20220210) w/ext4

2022-02-10 Thread Sachin Sant
While booting 5.17.0-rc3-next-20220210 on Power following warning is seen: [ 32.626501] EXT4-fs (sda2): re-mounted. Quota mode: none. [ 32.627225] [ cut here ] [ 32.627236] WARNING: CPU: 27 PID: 1084 at mm/slub.c:3246 kmem_cache_alloc+0x3b0/0x680 [ 32.627250

[PATCH] powerpc/lib/sstep: fix 'ptesync' build error

2022-02-10 Thread Anders Roxell
Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian 2.37.90.20220207) the following build error shows up: {standard input}: Assembler messages: {standard input}:2088: Error: unrecognized opcode: `ptesync' make[3]: *** [/builds/linux/scripts/Makefile.build:287:

[PATCH v2] scsi: ibmvfc: replace snprintf with sysfs_emit

2022-02-10 Thread davidcomponentone
From: Yang Guang coccinelle report: ./drivers/scsi/ibmvscsi/ibmvfc.c:3453:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/ibmvscsi/ibmvfc.c:3416:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/ibmvscsi/ibmvfc.c:3436:8-16: WARNING: use scnprintf or sprintf

Re: [PATCH v3 08/12] asm-generic: Refactor dereference_[kernel]_function_descriptor()

2022-02-10 Thread Michael Ellerman
Christophe Leroy writes: > diff --git a/kernel/extable.c b/kernel/extable.c > index b0ea5eb0c3b4..1ef13789bea9 100644 > --- a/kernel/extable.c > +++ b/kernel/extable.c > @@ -159,12 +160,32 @@ int kernel_text_address(unsigned long addr) > } > > /* > - * On some architectures (PPC64, IA64)