Re: [PATCH 2/2] powerpc: add ALTIVEC support to lib/ when PPC_FPU not set

2021-04-19 Thread Segher Boessenkool
On Mon, Apr 19, 2021 at 03:38:02PM +0200, Christophe Leroy wrote: > Le 19/04/2021 à 15:32, Segher Boessenkool a écrit : > >On Sun, Apr 18, 2021 at 01:17:26PM -0700, Randy Dunlap wrote: > >>Add ldstfp.o to the Makefile for CONFIG_ALTIVEC and add > >>externs for get_vr()

Re: [PATCH 2/2] powerpc: add ALTIVEC support to lib/ when PPC_FPU not set

2021-04-19 Thread Segher Boessenkool
Hi! On Sun, Apr 18, 2021 at 01:17:26PM -0700, Randy Dunlap wrote: > Add ldstfp.o to the Makefile for CONFIG_ALTIVEC and add > externs for get_vr() and put_vr() in lib/sstep.c to fix the > build errors. > obj-$(CONFIG_PPC_FPU)+= ldstfp.o > +obj-$(CONFIG_ALTIVEC)+= ldstfp.o It is

Re: PPC_FPU, ALTIVEC: enable_kernel_fp, put_vr, get_vr

2021-04-18 Thread Segher Boessenkool
On Sun, Apr 18, 2021 at 06:24:29PM +0200, Christophe Leroy wrote: > Le 17/04/2021 à 22:17, Randy Dunlap a écrit : > >Should the code + Kconfigs/Makefiles handle that kind of > >kernel config or should ALTIVEC always mean PPC_FPU as well? > > As far as I understand, Altivec is completely

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-14 Thread Segher Boessenkool
On Wed, Apr 14, 2021 at 03:32:04PM +, David Laight wrote: > From: Segher Boessenkool > > Sent: 14 April 2021 16:19 > ... > > > Could the kernel use GCC builtin atomic functions instead ? > > > > > > https://gcc.gnu.org/onlinedocs/gcc/_005f_005f

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-14 Thread Segher Boessenkool
On Wed, Apr 14, 2021 at 02:42:51PM +0200, Christophe Leroy wrote: > Le 14/04/2021 à 14:24, Segher Boessenkool a écrit : > >On Wed, Apr 14, 2021 at 12:01:21PM +1000, Nicholas Piggin wrote: > >>Would be nice if we could let the compiler deal with it all... > >> > &g

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-14 Thread Segher Boessenkool
On Wed, Apr 14, 2021 at 12:01:21PM +1000, Nicholas Piggin wrote: > Would be nice if we could let the compiler deal with it all... > > static inline unsigned long lr(unsigned long *mem) > { > unsigned long val; > > /* > * This doesn't clobber memory but want to avoid

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-13 Thread Segher Boessenkool
On Tue, Apr 13, 2021 at 06:33:19PM +0200, Christophe Leroy wrote: > Le 12/04/2021 à 23:54, Segher Boessenkool a écrit : > >On Thu, Apr 08, 2021 at 03:33:44PM +, Christophe Leroy wrote: > >>For clear bits, on 32 bits 'rlwinm' can be used instead or 'andc' for > >>

Re: [PATCH v2 1/1] powerpc/iommu: Enable remaining IOMMU Pagesizes present in LoPAR

2021-04-12 Thread Segher Boessenkool
On Fri, Apr 09, 2021 at 02:36:16PM +1000, Alexey Kardashevskiy wrote: > On 08/04/2021 19:04, Michael Ellerman wrote: > +#define QUERY_DDW_PGSIZE_4K 0x01 > +#define QUERY_DDW_PGSIZE_64K 0x02 > +#define QUERY_DDW_PGSIZE_16M 0x04 > +#define QUERY_DDW_PGSIZE_32M 0x08 >

Re: [PATCH v1 2/2] powerpc/atomics: Use immediate operand when possible

2021-04-12 Thread Segher Boessenkool
%0,%0,%2 \n" > "stwcx. %0,0,%1 \n\ > bne- 1b \n" > PPC_ATOMIC_EXIT_BARRIER > -"subf%0,%2,%0 \n\ > +"sub%I2 %0,%0,%2 \n\ > 2:" > - : "=" (t) > - : "r" (>counter), "r" (a), "r" (u) > + : "=" (t) > + : "r" (>counter), "rI" (a), "r" (u) > : "cc", "memory"); Same here. Nice patches! Acked-by: Segher Boessenkool Segher

Re: [PATCH v1 1/2] powerpc/bitops: Use immediate operand when possible

2021-04-12 Thread Segher Boessenkool
Hi! On Thu, Apr 08, 2021 at 03:33:44PM +, Christophe Leroy wrote: > For clear bits, on 32 bits 'rlwinm' can be used instead or 'andc' for > when all bits to be cleared are consecutive. Also on 64-bits, as long as both the top and bottom bits are in the low 32-bit half (for 32 bit mode, it

Re: static_branch/jump_label vs branch merging

2021-04-10 Thread Segher Boessenkool
On Fri, Apr 09, 2021 at 12:33:29PM -0700, Nick Desaulniers wrote: > Since asm goto is implicitly volatile qualified, it sounds like > removing the implicit volatile qualifier from asm goto might help? > Then if there were side effects but you forgot to inform the compiler > that there were via an

Re: [PATCH v3] powerpc/traps: Enhance readability for trap types

2021-04-10 Thread Segher Boessenkool
On Sat, Apr 10, 2021 at 11:42:41AM +0200, Christophe Leroy wrote: > Le 10/04/2021 à 02:04, Michael Ellerman a écrit : > >I think these can all be avoided by defining most of the values > >regardless of what platform we're building for. Only the values that > >overlap need to be kept behind an

Re: [PATCH v3] powerpc/traps: Enhance readability for trap types

2021-04-09 Thread Segher Boessenkool
On Fri, Apr 09, 2021 at 06:14:19PM +0200, Christophe Leroy wrote: > >+#define INTERRUPT_SYSTEM_RESET0x100 > > INT_SRESET SRESET exists on many PowerPC, it means "soft reset". Not the same thing at all. I think "INT" is not a great prefix fwiw, there are many things you can abbr to "INT".

Re: static_branch/jump_label vs branch merging

2021-04-09 Thread Segher Boessenkool
On Thu, Apr 08, 2021 at 06:52:18PM +0200, Peter Zijlstra wrote: > Is there *any* way in which we can have the compiler recognise that the > asm_goto only depends on its arguments and have it merge the branches > itself? > > I do realize that asm-goto being volatile this is a fairly huge ask, but

Re: [PATCH 2/2] powerpc: make 'boot_text_mapped' static

2021-04-09 Thread Segher Boessenkool
Hi! On Thu, Apr 08, 2021 at 07:04:35AM +0200, Christophe Leroy wrote: > Le 08/04/2021 à 03:18, Yu Kuai a écrit : > >-int boot_text_mapped __force_data = 0; > >+static int boot_text_mapped __force_data; > > Are you sure the initialisation to 0 can be removed ? Usually > initialisation to 0 is

Re: [PATCH] powerpc/32: Remove powerpc specific definition of 'ptrdiff_t'

2021-04-05 Thread Segher Boessenkool
powerpc specific definitions and fallback on > generic ones. > > Signed-off-by: Christophe Leroy Thanks! Acked-by: Segher Boessenkool Segher

Re: [PATCH v2] powerpc/traps: Enhance readability for trap types

2021-04-01 Thread Segher Boessenkool
On Thu, Apr 01, 2021 at 06:01:29PM +1000, Nicholas Piggin wrote: > Excerpts from Michael Ellerman's message of April 1, 2021 12:39 pm: > > Segher Boessenkool writes: > >> On Wed, Mar 31, 2021 at 08:58:17PM +1100, Michael Ellerman wrote: > >>> So perhaps: &

Re: [PATCH v2] powerpc/traps: Enhance readability for trap types

2021-04-01 Thread Segher Boessenkool
On Thu, Apr 01, 2021 at 10:55:58AM +0800, Xiongwei Song wrote: > Segher Boessenkool 于2021年4月1日周四 上午6:15写道: > > > On Wed, Mar 31, 2021 at 08:58:17PM +1100, Michael Ellerman wrote: > > > So perhaps: > > > > > > EXC_SYSTEM_RESET > > &

Re: [PATCH v2] powerpc/traps: Enhance readability for trap types

2021-03-31 Thread Segher Boessenkool
On Wed, Mar 31, 2021 at 08:58:17PM +1100, Michael Ellerman wrote: > So perhaps: > > EXC_SYSTEM_RESET > EXC_MACHINE_CHECK > EXC_DATA_STORAGE > EXC_DATA_SEGMENT > EXC_INST_STORAGE > EXC_INST_SEGMENT > EXC_EXTERNAL_INTERRUPT > EXC_ALIGNMENT > EXC_PROGRAM_CHECK >

Re: [PATCH mm] kfence: fix printk format for ptrdiff_t

2021-03-19 Thread Segher Boessenkool
On Thu, Mar 18, 2021 at 10:38:43AM +0100, Christophe Leroy wrote: > Yes it seems to be wrong. It was changed by commit d27dfd3887 ("Import > pre2.0.8"), so that's long time ago. Before that it was an 'int' for ppc32. > > gcc provides ptrdiff_t in stddef.h via __PTRDIFF_TYPE__ > gcc defined

Re: [PATCH mm] kfence: fix printk format for ptrdiff_t

2021-03-16 Thread Segher Boessenkool
On Tue, Mar 16, 2021 at 09:32:32AM +0100, Christophe Leroy wrote: > +segher I cannot see through the wood of #defines here, sorry. > Still a problem. > > I don't understand, gcc bug ? Rule #1: If you do not understand what is happening, it is not a compiler bug. I'm not saying that it isn't,

Re: [PATCH] powerpc/vdso32: Add missing _restgpr_31_x to fix build failure

2021-03-15 Thread Segher Boessenkool
On Mon, Mar 15, 2021 at 04:38:52PM +, David Laight wrote: > From: Rasmus Villemoes > > Sent: 15 March 2021 16:24 > > On 12/03/2021 03.29, Segher Boessenkool wrote: > > > On Tue, Mar 09, 2021 at 06:19:30AM +, Christophe Leroy wrote: > > &g

Re: [PATCH] powerpc/vdso32: Add missing _restgpr_31_x to fix build failure

2021-03-15 Thread Segher Boessenkool
On Mon, Mar 15, 2021 at 05:23:44PM +0100, Rasmus Villemoes wrote: > On 12/03/2021 03.29, Segher Boessenkool wrote: > > On Tue, Mar 09, 2021 at 06:19:30AM +, Christophe Leroy wrote: > >> With some defconfig including CONFIG_CC_OPTIMIZE_FOR_SIZE, > >> (for

Re: [PATCH] powerpc/vdso32: Add missing _restgpr_31_x to fix build failure

2021-03-11 Thread Segher Boessenkool
Hi! On Tue, Mar 09, 2021 at 06:19:30AM +, Christophe Leroy wrote: > With some defconfig including CONFIG_CC_OPTIMIZE_FOR_SIZE, > (for instance mvme5100_defconfig and ps3_defconfig), gcc 5 > generates a call to _restgpr_31_x. > I don't know if there is a way to tell GCC not to emit that call,

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-10 Thread Segher Boessenkool
Hi! On Wed, Mar 10, 2021 at 11:32:20AM +, Mark Rutland wrote: > On Tue, Mar 09, 2021 at 04:05:32PM -0600, Segher Boessenkool wrote: > > On Tue, Mar 09, 2021 at 04:05:23PM +, Mark Rutland wrote: > > > On Thu, Mar 04, 2021 at 03:54:48PM -0600, Segher Boessenkool wrote: &

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-09 Thread Segher Boessenkool
Hi! On Tue, Mar 09, 2021 at 04:05:23PM +, Mark Rutland wrote: > On Thu, Mar 04, 2021 at 03:54:48PM -0600, Segher Boessenkool wrote: > > On Thu, Mar 04, 2021 at 02:57:30PM +, Mark Rutland wrote: > > > It looks like GCC is happy to give us the function-entry

Re: [PATCH] Replace __toc_start + 0x8000 with .TOC.

2021-03-06 Thread Segher Boessenkool
Hi! On Sat, Mar 06, 2021 at 09:14:33PM -0800, Fangrui Song wrote: > TOC relocations are like GOT relocations on other architectures. > However, unlike other architectures, GNU ld's ppc64 port defines .TOC. > relative to the .got output section instead of the linker synthesized > .got input

Re: [PATCH v2 1/7] cmdline: Add generic function to build command line.

2021-03-05 Thread Segher Boessenkool
On Fri, Mar 05, 2021 at 01:49:03PM +0100, Christophe Leroy wrote: > Le 05/03/2021 à 12:58, Michael Ellerman a écrit : > >prom_init runs as an OF client, with the MMU off (except on some Apple > >machines), and we don't own the MMU. So there's really nothing we can do :) > > > >Though now that I

Re: [PATCH v2 1/7] cmdline: Add generic function to build command line.

2021-03-05 Thread Segher Boessenkool
On Fri, Mar 05, 2021 at 10:58:02PM +1100, Michael Ellerman wrote: > Will Deacon writes: > > That's very similar to us; we're not relocated, although we are at least > > in control of the MMU (which is using a temporary set of page-tables). > > prom_init runs as an OF client, with the MMU off

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-05 Thread Segher Boessenkool
On Fri, Mar 05, 2021 at 07:38:25AM +0100, Christophe Leroy wrote: > Le 04/03/2021 à 20:24, Segher Boessenkool a écrit : > https://github.com/linuxppc/linux/commit/a9a3ed1eff36 > > > > >That is much heavier than needed (an mb()). You can just put an empty > >inl

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Segher Boessenkool
Hi! On Thu, Mar 04, 2021 at 02:57:30PM +, Mark Rutland wrote: > It looks like GCC is happy to give us the function-entry-time FP if we use > __builtin_frame_address(1), >From the GCC manual: Calling this function with a nonzero argument can have unpredictable effects, including

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Segher Boessenkool
On Thu, Mar 04, 2021 at 09:54:44AM -0800, Nick Desaulniers wrote: > On Thu, Mar 4, 2021 at 9:42 AM Marco Elver wrote: > include/linux/compiler.h:246: > prevent_tail_call_optimization > > commit a9a3ed1eff36 ("x86: Fix early boot crash on gcc-10, third try") That is much heavier than needed (an

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-02 Thread Segher Boessenkool
On Tue, Mar 02, 2021 at 10:40:03PM +1100, Michael Ellerman wrote: > >> -- Change the unwinder, if it's possible for ppc32. > > > > I don't think it is possible. > > I think this actually is the solution. > > It seems the good architectures have all added support for > arch_stack_walk(), and we

Re: [PATCH v1 01/15] powerpc/uaccess: Remove __get_user_allowed() and unsafe_op_wrap()

2021-03-01 Thread Segher Boessenkool
On Tue, Mar 02, 2021 at 09:02:54AM +1100, Daniel Axtens wrote: > Checkpatch does have one check that is relevant: > > CHECK: Macro argument reuse 'p' - possible side-effects? > #36: FILE: arch/powerpc/include/asm/uaccess.h:482: > +#define unsafe_get_user(x, p, e) do {

Re: {standard input}:577: Error: unsupported relocation against base

2021-02-17 Thread Segher Boessenkool
Hi! On Wed, Feb 17, 2021 at 04:43:45PM +1100, Michael Ellerman wrote: > Segher Boessenkool writes: > > On Tue, Feb 16, 2021 at 08:36:02PM +1100, Michael Ellerman wrote: > >> Feng Tang writes: > >> > {standard input}:577: Error: unsupported relocation against base

Re: {standard input}:577: Error: unsupported relocation against base

2021-02-16 Thread Segher Boessenkool
Hi! On Tue, Feb 16, 2021 at 08:36:02PM +1100, Michael Ellerman wrote: > Feng Tang writes: > > {standard input}:577: Error: unsupported relocation against base > > {standard input}:580: Error: unsupported relocation against base > > {standard input}:583: Error: unsupported relocation

Re: [PATCH] powerpc/bug: Remove specific powerpc BUG_ON()

2021-02-11 Thread Segher Boessenkool
On Thu, Feb 11, 2021 at 03:09:43PM +0100, Christophe Leroy wrote: > Le 11/02/2021 à 12:49, Segher Boessenkool a écrit : > >On Thu, Feb 11, 2021 at 07:41:52AM +, Christophe Leroy wrote: > >>powerpc BUG_ON() is based on using twnei or tdnei instruction, > >>

Re: [PATCH] powerpc/bug: Remove specific powerpc BUG_ON()

2021-02-11 Thread Segher Boessenkool
On Thu, Feb 11, 2021 at 01:26:12PM +0100, Christophe Leroy wrote: > >What PowerPC cpus implement branch folding? I know none. > > Extract from powerpc mpc8323 reference manual: > — Zero-cycle branch capability (branch folding) Yeah, this is not what is traditionally called branch folding

Re: [PATCH] powerpc/bug: Remove specific powerpc BUG_ON()

2021-02-11 Thread Segher Boessenkool
On Thu, Feb 11, 2021 at 08:04:55PM +1000, Nicholas Piggin wrote: > Excerpts from Christophe Leroy's message of February 11, 2021 5:41 pm: > > As modern powerpc implement branch folding, that's even more efficient. Ah, it seems you mean what Arm calls branch folding. Sure, power4 already did

Re: [PATCH] powerpc/bug: Remove specific powerpc BUG_ON()

2021-02-11 Thread Segher Boessenkool
On Thu, Feb 11, 2021 at 07:41:52AM +, Christophe Leroy wrote: > powerpc BUG_ON() is based on using twnei or tdnei instruction, > which obliges gcc to format the condition into a 0 or 1 value > in a register. Huh? Why is that? Will it work better if this used __builtin_trap? Or does the

Re: [PATCH] powerpc/bug: Remove specific powerpc BUG_ON()

2021-02-11 Thread Segher Boessenkool
On Thu, Feb 11, 2021 at 08:04:55PM +1000, Nicholas Piggin wrote: > It would be nice if we could have a __builtin_trap_if that gcc would use > conditional traps with, (and which never assumes following code is > unreachable even for constant true, so we can use it with WARN and put > explicit

Re: [PATCH v5 20/22] powerpc/syscall: Avoid storing 'current' in another pointer

2021-02-09 Thread Segher Boessenkool
On Tue, Feb 09, 2021 at 12:36:20PM +1000, Nicholas Piggin wrote: > What if you did this? > +static inline struct task_struct *get_current(void) > +{ > + register struct task_struct *task asm ("r2"); > + > + return task; > +} Local register asm variables are *only* guaranteed to live in

Re: [PATCH v4 11/23] powerpc/syscall: Rename syscall_64.c into syscall.c

2021-02-02 Thread Segher Boessenkool
On Tue, Feb 02, 2021 at 04:38:31PM +1000, Nicholas Piggin wrote: > > So to avoid confusion, I'll rename it. But I think "interrupt" is maybe not > > the right name. An > > interrupt most of the time refers to IRQ. > > That depends what you mean by interrupt and IRQ. In the PowerPC

Re: [PATCH v2] powerpc: Handle .text.{hot,unlikely}.* in linker script

2021-01-16 Thread Segher Boessenkool
Hi! Very late of course, and the patch is fine, but: On Mon, Jan 04, 2021 at 01:59:53PM -0700, Nathan Chancellor wrote: > Commit eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input > sections") added ".text.unlikely.*" and ".text.hot.*" due to an LLVM > change [1]. > > After another LLVM

Re: [PATCH] powerpc:Don't print raw EIP/LR hex values in dump_stack() and show_regs()

2020-12-22 Thread Segher Boessenkool
On Tue, Dec 22, 2020 at 09:45:03PM +0800, Xiaoming Ni wrote: > On 2020/12/22 1:12, Segher Boessenkool wrote: > >On Mon, Dec 21, 2020 at 04:42:23PM +, David Laight wrote: > >>From: Segher Boessenkool > >>>Sent: 21 December 2020 16:32 > >>> >

Re: [PATCH] powerpc:Don't print raw EIP/LR hex values in dump_stack() and show_regs()

2020-12-21 Thread Segher Boessenkool
On Mon, Dec 21, 2020 at 04:42:23PM +, David Laight wrote: > From: Segher Boessenkool > > Sent: 21 December 2020 16:32 > > > > On Mon, Dec 21, 2020 at 04:17:21PM +0100, Christophe Leroy wrote: > > > Le 21/12/2020 à 04:27, Xiaoming Ni a écrit : > > > &

Re: [PATCH] powerpc:Don't print raw EIP/LR hex values in dump_stack() and show_regs()

2020-12-21 Thread Segher Boessenkool
On Mon, Dec 21, 2020 at 04:17:21PM +0100, Christophe Leroy wrote: > Le 21/12/2020 à 04:27, Xiaoming Ni a écrit : > >Since the commit 2b0e86cc5de6 ("powerpc/fsl_booke/32: implement KASLR > >infrastructure"), the powerpc system is ready to support KASLR. > >To reduces the risk of invalidating

Re: [PATCH v2 3/4] Kbuild: make DWARF version a choice

2020-12-01 Thread Segher Boessenkool
On Tue, Dec 01, 2020 at 12:38:16PM +0900, Masahiro Yamada wrote: > > We can bump -Wa,-gdwarf-2 to -Wa,-gdwarf-3 since GNU actually emits > > DWARF v3 DW_AT_ranges (see > > https://sourceware.org/bugzilla/show_bug.cgi?id=26850 ) > > This can avoid the `warning: DWARF2 only supports one section per

Re: [PATCH v2 3/4] Kbuild: make DWARF version a choice

2020-11-24 Thread Segher Boessenkool
On Tue, Nov 24, 2020 at 11:56:02AM -0500, Arvind Sankar wrote: > On Mon, Nov 23, 2020 at 06:33:57PM -0600, Segher Boessenkool wrote: > > On Mon, Nov 23, 2020 at 06:22:10PM -0500, Arvind Sankar wrote: > > > Btw, is -gsplit-dwarf at all useful for assembler files? >

Re: [PATCH v2 3/4] Kbuild: make DWARF version a choice

2020-11-23 Thread Segher Boessenkool
On Mon, Nov 23, 2020 at 06:22:10PM -0500, Arvind Sankar wrote: > Btw, is -gsplit-dwarf at all useful for assembler files? If you invoke the assembler via the compiler, with that flag it still creates separate .o and .dwo files (via objcopy invocations as usual). Whether that is useful depends on

Re: violating function pointer signature

2020-11-19 Thread Segher Boessenkool
On Thu, Nov 19, 2020 at 05:42:34PM +, David Laight wrote: > From: Segher Boessenkool > > Sent: 19 November 2020 16:35 > > I just meant "valid C language code as defined by the standards". Many > > people want all UB to just go away, while that is *impossibl

Re: violating function pointer signature

2020-11-19 Thread Segher Boessenkool
On Thu, Nov 19, 2020 at 09:59:51AM -0500, Steven Rostedt wrote: > On Thu, 19 Nov 2020 08:37:35 -0600 > Segher Boessenkool wrote: > > > Note that we have a fairly extensive tradition of defining away UB with > > > language extentions, -fno-strict-overfl

Re: violating function pointer signature

2020-11-19 Thread Segher Boessenkool
On Thu, Nov 19, 2020 at 09:36:48AM +0100, Peter Zijlstra wrote: > On Wed, Nov 18, 2020 at 01:11:27PM -0600, Segher Boessenkool wrote: > > Calling this via a different declared function type is undefined > > behaviour, but that is independent of how the function is *defined*. >

Re: violating function pointer signature

2020-11-18 Thread Segher Boessenkool
On Wed, Nov 18, 2020 at 02:33:43PM -0500, Steven Rostedt wrote: > On Wed, 18 Nov 2020 13:11:27 -0600 > Segher Boessenkool wrote: > > > Calling this via a different declared function type is undefined > > behaviour, but that is independent of how the function is *defined*.

Re: violating function pointer signature

2020-11-18 Thread Segher Boessenkool
On Wed, Nov 18, 2020 at 01:58:23PM -0500, Steven Rostedt wrote: > I wonder if we should define on all architectures a void void_stub(void), > in assembly, that just does a return, an not worry about gcc messing up the > creation of the stub function. > > On x86_64: > > GLOBAL(void_stub) >

Re: violating function pointer signature

2020-11-18 Thread Segher Boessenkool
On Wed, Nov 18, 2020 at 07:31:50PM +0100, Florian Weimer wrote: > * Segher Boessenkool: > > > On Wed, Nov 18, 2020 at 12:17:30PM -0500, Steven Rostedt wrote: > >> I could change the stub from (void) to () if that would be better. > > > > Don't? In a function defi

Re: violating function pointer signature

2020-11-18 Thread Segher Boessenkool
On Wed, Nov 18, 2020 at 12:17:30PM -0500, Steven Rostedt wrote: > I could change the stub from (void) to () if that would be better. Don't? In a function definition they mean exactly the same thing (and the kernel uses (void) everywhere else, which many people find clearer). In a function

Re: Error: invalid switch -me200

2020-11-16 Thread Segher Boessenkool
On Mon, Nov 16, 2020 at 02:27:12PM -0600, Scott Wood wrote: > On Fri, 2020-11-13 at 18:50 -0600, Segher Boessenkool wrote: > > All the others work fine (and are needed afaics), it is only -me200 that > > doesn't exist (in mainline binutils). Perhaps -me5500 will work for

Re: Error: invalid switch -me200

2020-11-13 Thread Segher Boessenkool
On Fri, Nov 13, 2020 at 04:37:38PM -0800, Fāng-ruì Sòng wrote: > On Fri, Nov 13, 2020 at 4:23 PM Segher Boessenkool > wrote: > > On Fri, Nov 13, 2020 at 12:14:18PM -0800, Nick Desaulniers wrote: > > > > > > Error: invalid switch -me200 > > >

Re: Error: invalid switch -me200

2020-11-13 Thread Segher Boessenkool
On Fri, Nov 13, 2020 at 12:14:18PM -0800, Nick Desaulniers wrote: > > > > Error: invalid switch -me200 > > > > Error: unrecognized option -me200 > > > > > > 251 cpu-as-$(CONFIG_E200) += -Wa,-me200 > > > > > > Are those all broken configs, or is Kconfig messed up such that > > > randconfig can

Re: [PATCH v5 04/17] x86/acrn: Introduce hypercall interfaces

2020-11-03 Thread Segher Boessenkool
On Tue, Nov 03, 2020 at 05:44:35PM +0100, Borislav Petkov wrote: > On Mon, Nov 02, 2020 at 05:18:09PM -0600, Segher Boessenkool wrote: > > That is invalid actually: local register asm as input to an inline asm > > should use *that* register! > > > > This is all

Re: [PATCH v5 04/17] x86/acrn: Introduce hypercall interfaces

2020-11-02 Thread Segher Boessenkool
On Mon, Nov 02, 2020 at 11:54:39PM +0100, Borislav Petkov wrote: > On Mon, Nov 02, 2020 at 02:01:13PM -0600, Segher Boessenkool wrote: > > It just asks the general_operand function, which (for registers) accepts > > the hard registers that are accessible. This does in

Re: [PATCH v5 04/17] x86/acrn: Introduce hypercall interfaces

2020-11-02 Thread Segher Boessenkool
On Mon, Nov 02, 2020 at 07:34:30PM +0100, Borislav Petkov wrote: > On Mon, Nov 02, 2020 at 12:10:00PM -0600, Segher Boessenkool wrote: > > (It does not allow *all* memory and *all* constants, btw... And the > > condition for registers is not really "general register"

Re: [PATCH v5 04/17] x86/acrn: Introduce hypercall interfaces

2020-11-02 Thread Segher Boessenkool
Hi! On Mon, Nov 02, 2020 at 06:19:50PM +0100, Borislav Petkov wrote: > On Mon, Nov 02, 2020 at 10:09:01AM -0600, Segher Boessenkool wrote: > > I think that will work for x86_64. But it won't matter much, most of > > the time you give an immediate number. > > Yeah, my q

Re: [PATCH v5 04/17] x86/acrn: Introduce hypercall interfaces

2020-11-02 Thread Segher Boessenkool
On Mon, Nov 02, 2020 at 03:56:57PM +0100, Borislav Petkov wrote: > On Mon, Oct 19, 2020 at 02:17:50PM +0800, shuo.a@intel.com wrote: > > +static inline long acrn_hypercall0(unsigned long hcall_id) > > +{ > > + long result; > > + > > + asm volatile("movl %1, %%r8d\n\t" > > +

Re: [PATCH v2 1/2] bpf: don't rely on GCC __attribute__((optimize)) to disable GCSE

2020-10-29 Thread Segher Boessenkool
On Wed, Oct 28, 2020 at 10:57:45PM -0400, Arvind Sankar wrote: > On Wed, Oct 28, 2020 at 04:20:01PM -0700, Alexei Starovoitov wrote: > > All compilers have bugs. Kernel has bugs. What can go wrong? Heh. > +linux-toolchains. GCC updated the documentation in 7.x to discourage > people from using

Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c"

2020-10-24 Thread Segher Boessenkool
On Fri, Oct 23, 2020 at 09:28:59PM +, David Laight wrote: > From: Segher Boessenkool > > Sent: 23 October 2020 19:27 > > On Fri, Oct 23, 2020 at 06:58:57PM +0100, Al Viro wrote: > > > On Fri, Oct 23, 2020 at 03:09:30PM +0200, David Hildenbrand wrote: > > > On

Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c"

2020-10-23 Thread Segher Boessenkool
On Fri, Oct 23, 2020 at 06:58:57PM +0100, Al Viro wrote: > On Fri, Oct 23, 2020 at 03:09:30PM +0200, David Hildenbrand wrote: > > > Now, I am not a compiler expert, but as I already cited, at least on > > x86-64 clang expects that the high bits were cleared by the caller - in > > contrast to gcc.

Re: [PATCH] powerpc/bitops: Fix possible undefined behaviour with fls() and fls64()

2020-10-22 Thread Segher Boessenkool
gt; input argument 0, __builtin_ctz() and __builtin_ctzll() are > documented as undefined for value 0. > When the input of fls(x) is a constant, just check x for nullity and > return either 0 or __builtin_clz(x). Otherwise, use cntlzw instruction > directly. That looks good :-)

Re: [PATCH v2 3/3] powerpc: Fix update form addressing in inline assembly

2020-10-20 Thread Segher Boessenkool
s mentioned in previous patch, this fails with gcc 4.9, so > "<>" can't be used directly. > > Use UPD_CONSTR macro everywhere %Un modifier is used. > > Signed-off-by: Christophe Leroy Oh well, it will be easy enough to remove this wart later, so Reviewed-by: Segher Bo

Re: [PATCH 3/3] powerpc: Fix pre-update addressing in inline assembly

2020-10-20 Thread Segher Boessenkool
On Tue, Oct 20, 2020 at 09:44:33AM +0200, Christophe Leroy wrote: > Le 19/10/2020 à 22:24, Segher Boessenkool a écrit : > >>but the associated "<>" constraint is missing. > > > >But that is just fine. Pointless, sure, but not a bug. > > Most of tho

Re: [PATCH 3/3] powerpc: Fix pre-update addressing in inline assembly

2020-10-19 Thread Segher Boessenkool
On Mon, Oct 19, 2020 at 12:12:48PM +, Christophe Leroy wrote: > In several places, inline assembly uses the "%Un" modifier > to enable the use of instruction with pre-update addressing, Calling this "pre-update" is misleading: the register is not updated before the address is generated (or

Re: [PATCH 2/3] powerpc: Fix incorrect stw{, ux, u, x} instructions in __set_pte_at

2020-10-19 Thread Segher Boessenkool
for argument %0 ever differs > from argument %1. "Instruction selection" isn't correct here... "if the memory addressing of operand 0 is a different form from that of operand 1", perhaps? The patch looks fine of course :-) Acked-by: Segher Boessenkool Segher

Re: [PATCH 1/3] powerpc/uaccess: Don't use "m<>" constraint with GCC 4.9

2020-10-19 Thread Segher Boessenkool
+294,7 @@ extern long __get_user_bad(void); > ".previous\n" \ > EX_TABLE(1b, 3b)\ > : "=r" (err), "=r" (x) \ > - : "m<>"

Re: [PATCH] asm-generic: Force inlining of get_order() to work around gcc10 poor decision

2020-10-19 Thread Segher Boessenkool
On Mon, Oct 19, 2020 at 10:54:40AM +0200, Christophe Leroy wrote: > Le 19/10/2020 à 10:32, Segher Boessenkool a écrit : > >The kernel should just use __always_inline if that is what it *wants*; > >that is true here most likely. GCC could perhaps improve its heuristics > >

Re: [PATCH] asm-generic: Force inlining of get_order() to work around gcc10 poor decision

2020-10-19 Thread Segher Boessenkool
On Mon, Oct 19, 2020 at 07:50:41AM +0200, Christophe Leroy wrote: > Le 19/10/2020 à 06:55, Joel Stanley a écrit : > >>In the old days, marking a function 'static inline' was forcing > >>GCC to inline, but since commit ac7c3e4ff401 ("compiler: enable > >>CONFIG_OPTIMIZE_INLINING forcibly") GCC may

Re: [PATCH] powerpc: force inlining of csum_partial() to avoid multiple csum_partial() with GCC10

2020-10-15 Thread Segher Boessenkool
pen a GCC PR for this please? > To enforce inlining of that branch to __csum_partial(), > mark csum_partial() as __always_inline. That should be fine of course, but it would be good if we could fix this in the compiler :-) Reviewed-by: Segher Boessenkool Segher

Re: Additional debug info to aid cacheline analysis

2020-10-11 Thread Segher Boessenkool
Hi! On Sat, Oct 10, 2020 at 10:58:36PM +0200, Mark Wielaard wrote: > On Thu, Oct 08, 2020 at 02:23:00PM -0700, Andi Kleen wrote: > > So I guess could disable it for 5.0+ only. > > Yes, that would work. I don't know what the lowest supported GCC > version is, but technically it was definitely

Re: linux tooling mailing list

2020-10-02 Thread Segher Boessenkool
On Fri, Oct 02, 2020 at 02:01:13PM +0200, Sedat Dilek wrote: > On Thu, Oct 1, 2020 at 12:26 AM David Miller wrote: > > From: Nick Desaulniers > > Date: Wed, 30 Sep 2020 12:29:38 -0700 > > > linux-toolcha...@vger.kernel.org > > > > Created. > > I am subscribed, too. > > Will there be a(n)...? >

Re: [PATCH 1/6] powerpc/time: Rename mftbl() to mftb()

2020-10-01 Thread Segher Boessenkool
On Thu, Oct 01, 2020 at 12:42:39PM +, Christophe Leroy wrote: > On PPC64, we have mftb(). > On PPC32, we have mftbl() and an #define mftb() mftbl(). > > mftb() and mftbl() are equivalent, their purpose is to read the > content of SPRN_TRBL, as returned by 'mftb' simplified instruction. > >

Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-10-01 Thread Segher Boessenkool
Hi! On Thu, Oct 01, 2020 at 12:15:39PM +0200, Miguel Ojeda wrote: > > So it looks like the best option is to exclude these > > 2 files from conversion. > > Agreed. Nevertheless, is there any reason arch/powerpc/* should not be > compiling cleanly with compiler.h? (CC'ing the rest of the PowerPC

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Segher Boessenkool
On Wed, Sep 30, 2020 at 07:38:15PM -0400, Arvind Sankar wrote: > On Wed, Sep 30, 2020 at 06:25:59PM -0500, Segher Boessenkool wrote: > > On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > > > Do we need register local storage here? > > > > Depends

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Segher Boessenkool
On Wed, Sep 30, 2020 at 03:59:15PM -0400, Arvind Sankar wrote: > On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > > On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra > > wrote: > > > > > > On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boess

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Segher Boessenkool
On Wed, Sep 30, 2020 at 09:42:40PM +0200, Peter Zijlstra wrote: > > Looks like yes. You can even check different GCC versions via the > > dropdown in the top right. > > That only tells me it compiles it, not if that (IMO) weird construct is > actually guaranteed to work as expected. > > I'd

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Segher Boessenkool
On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > Do we need register local storage here? Depends what you want. It looks like you do: > static inline long bar(unsigned long hcall_id) > { > long result; > asm volatile("movl %1, %%r8d\n\t" > "vmcall\n\t" > : "=a"

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Segher Boessenkool
Hi! On Wed, Sep 30, 2020 at 01:16:12PM +0200, Peter Zijlstra wrote: > On Sun, Sep 27, 2020 at 08:38:03AM -0700, Dave Hansen wrote: > > On 9/27/20 3:51 AM, Greg Kroah-Hartman wrote: > > >> +static inline long acrn_hypercall0(unsigned long hcall_id) > > >> +{ > > >> +register long r8

Re: [PATCH v2 4/7] powerpc: Remove PowerPC 601

2020-09-29 Thread Segher Boessenkool
On Tue, Sep 29, 2020 at 06:09:21AM +, Christophe Leroy wrote: > Powerpc 601 is 25 years old. So is 603, but that one is still used! :-) > It is not selected by any defconfig. > > It requires a lot of special handling as it deviates from the > standard 6xx. > > Retire it. That is fine

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

2020-09-10 Thread Segher Boessenkool
On Wed, Sep 09, 2020 at 02:33:36PM -0700, Linus Torvalds wrote: > On Wed, Sep 9, 2020 at 11:42 AM Segher Boessenkool > wrote: > > > > It will not work like this in GCC, no. The LLVM people know about that. > > I do not know why they insist on pushing this, being incompa

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

2020-09-10 Thread Segher Boessenkool
On Thu, Sep 10, 2020 at 12:26:53PM +, David Laight wrote: > Actually this is pretty sound: > __label__ label; > register int eax asm ("eax"); > // Ensure eax can't be reloaded from anywhere > // In particular it can't be reloaded after the asm goto line > asm

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

2020-09-10 Thread Segher Boessenkool
On Thu, Sep 10, 2020 at 03:31:53PM +, David Laight wrote: > > > asm volatile ("" : "+r" (eax)); > > > // So here eax must contain the value set by the "x" instructions. > > > > No, the register eax will contain the value of the eax variable. In the > > asm; it might well be there

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

2020-09-10 Thread Segher Boessenkool
On Thu, Sep 10, 2020 at 09:26:28AM +, David Laight wrote: > From: Christophe Leroy > > Sent: 10 September 2020 09:14 > > > > Le 10/09/2020 à 10:04, David Laight a écrit : > > > From: Linus Torvalds > > >> Sent: 09 September 2020 22:34 > > >&

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

2020-09-09 Thread Segher Boessenkool
On Wed, Sep 09, 2020 at 10:31:34AM -0700, Linus Torvalds wrote: > And apparently there are people working on this on the gcc side too, > so it won't just be clang-specific. Nor kernel-specific in that Nick > tells me some other projects are looking at using that asm goto with > outputs too. It

Re: [PATCH v2] x86/asm: Replace __force_order with memory clobber

2020-09-02 Thread Segher Boessenkool
On Wed, Sep 02, 2020 at 11:33:46AM -0400, Arvind Sankar wrote: > The CRn accessor functions use __force_order as a dummy operand to > prevent the compiler from reordering the inline asm. > > The fact that the asm is volatile should be enough to prevent this > already, however older versions of

Re: [PATCH 2/2] powerpc/vdso32: link vdso64 with linker

2020-09-02 Thread Segher Boessenkool
On Wed, Sep 02, 2020 at 05:43:03PM +0200, Christophe Leroy wrote: > >Try with a newer ld? If it still happens with current versions, please > >open a bug report? https://sourceware.org/bugzilla > > Yes it works with 2.30 and 2.34 Ah okay, I missed this part. > But minimum for building kernel

Re: [PATCH 2/2] powerpc/vdso32: link vdso64 with linker

2020-09-02 Thread Segher Boessenkool
Hi! On Wed, Sep 02, 2020 at 06:46:45AM +, Christophe Leroy wrote: > ld crashes: > > LD arch/powerpc/kernel/vdso32/vdso32.so.dbg > /bin/sh: line 1: 23780 Segmentation fault (core dumped) > ppc-linux-ld -EB -m elf32ppc -shared -soname linux-vdso32.so.1 > --eh-frame-hdr

Re: Re:Re: [PATCH] powerpc: Fix a bug in __div64_32 if divisor is zero

2020-08-24 Thread Segher Boessenkool
On Mon, Aug 24, 2020 at 07:54:07PM +0800, Guohua Zhong wrote: > >> Yet, I have noticed that there is no checking of 'base' in these functions. > >> But I am not sure how to check is better.As we know that the result is > >> undefined when divisor is zero. It maybe good to print error and dump >

Re: Re:Re: [PATCH] powerpc: Fix a bug in __div64_32 if divisor is zero

2020-08-22 Thread Segher Boessenkool
On Sun, Aug 23, 2020 at 12:54:33AM +0800, Guohua Zhong wrote: > Yet, I have noticed that there is no checking of 'base' in these functions. > But I am not sure how to check is better.As we know that the result is > undefined when divisor is zero. It maybe good to print error and dump stack. >

Re: [PATCH] x86: work around clang IAS bug referencing __force_order

2020-08-22 Thread Segher Boessenkool
On Sat, Aug 22, 2020 at 11:51:56AM +0200, Sedat Dilek wrote: > On Sat, Aug 22, 2020 at 11:23 AM Sedat Dilek wrote: > > > > On Sat, Aug 22, 2020 at 10:42 AM Segher Boessenkool > > wrote: > > > > > > Hi Arvind, > > > > > > On Fri, Aug 21,

Re: [PATCH] x86: work around clang IAS bug referencing __force_order

2020-08-22 Thread Segher Boessenkool
Hi Arvind, On Fri, Aug 21, 2020 at 11:55:52PM -0400, Arvind Sankar wrote: > Cc Segher. > > Segher, we were looking at gcc PR82602, where IRA could reorder volatile > asm's (reported on ARM). The fix was backported to gcc-6. I know ;-) > Do you know if > there is any reason the problem couldn't

Re: [PATCH] sfc_ef100: Fix build failure on powerpc

2020-08-13 Thread Segher Boessenkool
On Thu, Aug 13, 2020 at 02:39:10PM +, Christophe Leroy wrote: > ppc6xx_defconfig fails building sfc.ko module, complaining > about the lack of _umoddi3 symbol. > > This is due to the following test > > if (EFX_MIN_DMAQ_SIZE % reader->value) { > > Because reader->value is u64.

  1   2   3   4   5   6   7   8   9   >