Re: [RFC PATCH v2 0/6] KVM: PPC: Nested PAPR guests

2023-06-06 Thread Nicholas Piggin
On Mon Jun 5, 2023 at 4:48 PM AEST, Jordan Niethe wrote: > There is existing support for nested guests on powernv hosts however the > hcall interface this uses is not support by other PAPR hosts. I kind of liked it being called nested-HV v1 and v2 APIs as short and to the point, but I suppose that

Re: [PATCH RFC v2 6/6] docs: powerpc: Document nested KVM on POWER

2023-06-06 Thread Gautam Menghani
On Mon, Jun 05, 2023 at 04:48:48PM +1000, Jordan Niethe wrote: > From: Michael Neuling Hi, There are some minor typos in the documentation pointed out below > +H_GUEST_GET_STATE() > +--- > + > +This is called to get state associated with an L2 (Guest-wide or vCPU > specific). >

Re: [PATCH 05/12] powerpc: add pte_free_defer() for pgtables sharing page

2023-06-06 Thread Hugh Dickins
On Tue, 6 Jun 2023, Jason Gunthorpe wrote: > On Tue, Jun 06, 2023 at 03:03:31PM -0400, Peter Xu wrote: > > On Tue, Jun 06, 2023 at 03:23:30PM -0300, Jason Gunthorpe wrote: > > > On Mon, Jun 05, 2023 at 08:40:01PM -0700, Hugh Dickins wrote: > > > > > > > diff --git a/arch/powerpc/mm/pgtable-frag.c

[PATCH] lazy tlb: consolidate lazy tlb mm switching fix

2023-06-06 Thread Nicholas Piggin
Fix an upstream powerpc bug that was discovered with a WARN_ON added in "lazy tlb: consolidate lazy tlb mm switching": Switching mm and tinkering with current->active_mm should be done with irqs disabled. There is a path where exit_lazy_flush_tlb can be called with irqs enabled:

[PATCH] powerpc/64s/radix: Fix exit lazy tlb mm switch with irqs enabled

2023-06-06 Thread Nicholas Piggin
Switching mm and tinkering with current->active_mm should be done with irqs disabled. There is a path where exit_lazy_flush_tlb can be called with irqs enabled: exit_lazy_flush_tlb flush_type_needed __flush_all_mm tlb_finish_mmu exit_mmap Which results in the switching being i

Re: WARN at kernel/sched/core.c:5358 (kthread_end_lazy_tlb_mm)

2023-06-06 Thread Michael Ellerman
"Nicholas Piggin" writes: > On Thu Jun 1, 2023 at 8:46 PM AEST, Sachin Sant wrote: >> While compiling a kernel on a IBM Power system booted with >> 6.4.0-rc4-next-20230601 following warning is observed >> >> [ 276.351697] [ cut here ] >> [ 276.351709] WARNING: CPU: 27 PID

Re: [PATCH] security/integrity: fix pointer to ESL data and its size on pseries

2023-06-06 Thread Jarkko Sakkinen
On Tue Jun 6, 2023 at 8:26 PM EEST, Nayna Jain wrote: > On PowerVM guest, variable data is prefixed with 8 bytes of timestamp. > Extract ESL by stripping off the timestamp before passing to ESL parser. > Cc: sta...@vger.kenrnel.org # v6.3 ? > Fixes: 4b3e71e9a34c ("integrity/powerpc: Support load

Re: Passing the complex args in the GPR's

2023-06-06 Thread David Edelsohn
On Tue, Jun 6, 2023 at 1:08 PM Umesh Kalappa via Gcc wrote: > Hi Segher , > > >>What did you expect, what happened instead? > For example the complex args are passed in GPR's for cexp in the case > GCC and Clang uses caller memory . > > for reference : https://godbolt.org/z/MfMz3cTe7 > > We hav

Re: Passing the complex args in the GPR's

2023-06-06 Thread Umesh Kalappa
Hi Segher , >>What did you expect, what happened instead? For example the complex args are passed in GPR's for cexp in the case GCC and Clang uses caller memory . for reference : https://godbolt.org/z/MfMz3cTe7 We have cross tools like some of libraries built using the GCC and some use Clan

Re: Passing the complex args in the GPR's

2023-06-06 Thread Umesh Kalappa
Hi Adnrew, Thank you for the quick response and for PPC64 too ,we do have mismatches in ABI b/w complex operations like https://godbolt.org/z/bjsYovx4c . Any reason why GCC chose to use GPR 's here ? ~Umesh On Tue, Jun 6, 2023 at 8:28 PM Andrew Pinski wrote: > > On Tue, Jun 6, 2023 at 7:50 AM U

Passing the complex args in the GPR's

2023-06-06 Thread Umesh Kalappa
Hi all , For the test case https://godbolt.org/z/vjs1vfs5W ,we see the mismatch in the ABI b/w gcc and clang . Do we have any supporting documents that second the GCC behaviour over CLANG ? EABI states like In the Power Architecture 64-Bit ELF V2 ABI Specification document (v1.1 from 16 July 20

Re: [PATCH 07/12] s390: add pte_free_defer(), with use of mmdrop_async()

2023-06-06 Thread Gerald Schaefer
On Mon, 5 Jun 2023 22:11:52 -0700 (PDT) Hugh Dickins wrote: > On Sun, 28 May 2023, Hugh Dickins wrote: > > > Add s390-specific pte_free_defer(), to call pte_free() via call_rcu(). > > pte_free_defer() will be called inside khugepaged's retract_page_tables() > > loop, where allocating extra memor

Re: [PATCH 05/12] powerpc: add pte_free_defer() for pgtables sharing page

2023-06-06 Thread Jason Gunthorpe
On Tue, Jun 06, 2023 at 03:03:31PM -0400, Peter Xu wrote: > On Tue, Jun 06, 2023 at 03:23:30PM -0300, Jason Gunthorpe wrote: > > On Mon, Jun 05, 2023 at 08:40:01PM -0700, Hugh Dickins wrote: > > > > > diff --git a/arch/powerpc/mm/pgtable-frag.c > > > b/arch/powerpc/mm/pgtable-frag.c > > > index 2

Re: [PATCH 05/12] powerpc: add pte_free_defer() for pgtables sharing page

2023-06-06 Thread Peter Xu
On Tue, Jun 06, 2023 at 03:23:30PM -0300, Jason Gunthorpe wrote: > On Mon, Jun 05, 2023 at 08:40:01PM -0700, Hugh Dickins wrote: > > > diff --git a/arch/powerpc/mm/pgtable-frag.c b/arch/powerpc/mm/pgtable-frag.c > > index 20652daa1d7e..e4f58c5fc2ac 100644 > > --- a/arch/powerpc/mm/pgtable-frag.c >

Re: [PATCH 07/12] s390: add pte_free_defer(), with use of mmdrop_async()

2023-06-06 Thread Jason Gunthorpe
On Mon, Jun 05, 2023 at 10:11:52PM -0700, Hugh Dickins wrote: > "deposited" pagetable fragments, over in arch/s390/mm/pgtable.c: use > the first two longs of the page table itself for threading the list. It is not RCU anymore if it writes to the page table itself before the grace period, so this

Re: [PATCH 05/12] powerpc: add pte_free_defer() for pgtables sharing page

2023-06-06 Thread Jason Gunthorpe
On Mon, Jun 05, 2023 at 08:40:01PM -0700, Hugh Dickins wrote: > diff --git a/arch/powerpc/mm/pgtable-frag.c b/arch/powerpc/mm/pgtable-frag.c > index 20652daa1d7e..e4f58c5fc2ac 100644 > --- a/arch/powerpc/mm/pgtable-frag.c > +++ b/arch/powerpc/mm/pgtable-frag.c > @@ -120,3 +120,54 @@ void pte_fragm

Re: [PATCH 00/13] mm: jit/text allocator

2023-06-06 Thread Song Liu
On Mon, Jun 5, 2023 at 3:09 AM Mark Rutland wrote: [...] > > > > Can you give more detail on what parameters you need? If the only extra > > > > parameter is just "does this allocation need to live close to kernel > > > > text", that's not that big of a deal. > > > > > > My thinking was that we

[PATCH] security/integrity: fix pointer to ESL data and its size on pseries

2023-06-06 Thread Nayna Jain
On PowerVM guest, variable data is prefixed with 8 bytes of timestamp. Extract ESL by stripping off the timestamp before passing to ESL parser. Fixes: 4b3e71e9a34c ("integrity/powerpc: Support loading keys from PLPKS") Signed-off-by: Nayna Jain --- .../integrity/platform_certs/load_powerpc.c |

Re: Passing the complex args in the GPR's

2023-06-06 Thread Joseph Myers
On Tue, 6 Jun 2023, Andrew Pinski via Gcc wrote: > You are looking at the wrong ABI document. > That is for the 64bit ABI. > The 32bit ABI document is located at: > http://refspecs.linux-foundation.org/elf/elfspec_ppc.pdf > > Plus the 32bit ABI document does not document Complex argument passing

Re: Passing the complex args in the GPR's

2023-06-06 Thread Segher Boessenkool
Hi! On Tue, Jun 06, 2023 at 08:35:22PM +0530, Umesh Kalappa wrote: > Hi Adnrew, > Thank you for the quick response and for PPC64 too ,we do have > mismatches in ABI b/w complex operations like > https://godbolt.org/z/bjsYovx4c . > > Any reason why GCC chose to use GPR 's here ? What did you expe

[PATCH net-next v2 0/8] net: freescale: Convert to platform remove callback returning void

2023-06-06 Thread Uwe Kleine-König
Hello, (implicit) v1 of this series was sent in March and can be found at https://lore.kernel.org/netdev/20230313103653.2753139-1-u.kleine-koe...@pengutronix.de Changes since then: - Dropped "net: fec: Don't return early on error in .remove()", this is replaced by "net: fec: Better handle pm

[PATCH net-next v2 5/8] net: fs_enet: Convert to platform remove callback returning void

2023-06-06 Thread Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to

[PATCH net-next v2 8/8] net: ucc_geth: Convert to platform remove callback returning void

2023-06-06 Thread Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to

Re: Passing the complex args in the GPR's

2023-06-06 Thread Andrew Pinski
On Tue, Jun 6, 2023 at 8:05 AM Umesh Kalappa wrote: > > Hi Adnrew, > Thank you for the quick response and for PPC64 too ,we do have > mismatches in ABI b/w complex operations like > https://godbolt.org/z/bjsYovx4c . > > Any reason why GCC chose to use GPR 's here ? Yes because it was set before 2

Re: Passing the complex args in the GPR's

2023-06-06 Thread Andrew Pinski
On Tue, Jun 6, 2023 at 7:50 AM Umesh Kalappa via Libc-alpha wrote: > > Hi all , > > For the test case https://godbolt.org/z/vjs1vfs5W ,we see the mismatch > in the ABI b/w gcc and clang . > > Do we have any supporting documents that second the GCC behaviour over CLANG ? > > EABI states like > > In

Re: [PATCH mm-unstable v2 01/10] mm/kvm: add mmu_notifier_ops->test_clear_young()

2023-06-06 Thread Tzung-Bi Shih
On Fri, May 26, 2023 at 05:44:26PM -0600, Yu Zhao wrote: > +/* > + * Architectures that implement kvm_arch_test_clear_young() should override > + * kvm_arch_has_test_clear_young(). > + * > + * kvm_arch_has_test_clear_young() is allowed to return false positive, > i.e., it > + * can return true if

[PATCH v3 6/6] powerpc/64: Rename entry_64.S to prom_entry_64.S

2023-06-06 Thread Nicholas Piggin
This file contains only the enter_prom implementation now. Trim includes and update header comment while we're here. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/Makefile | 12 .../kernel/{entry_64.S => prom_entry_64.S}| 30 ++- scripts/hea

[PATCH v3 5/6] powerpc: merge 32-bit and 64-bit _switch implementation

2023-06-06 Thread Nicholas Piggin
The _switch stack frame setup are substantially the same, so are the comments. The difference in how the stack and current are switched, and other hardware and software housekeeping is done is moved into macros. Generated code should be unchanged. Signed-off-by: Nicholas Piggin --- arch/powerpc

[PATCH v3 4/6] powerpc/32: Rearrange _switch to prepare for 32/64 merge

2023-06-06 Thread Nicholas Piggin
Change the order of some operations and change some register numbers in preparation to merge 32-bit and 64-bit switch. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/entry_32.S | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/entry_32.S b

[PATCH v3 3/6] powerpc/32: Remove sync from _switch

2023-06-06 Thread Nicholas Piggin
64-bit has removed the sync from _switch since commit 9145effd626d1 ("powerpc/64: Drop explicit hwsync in context switch"). The same logic there should apply to 32-bit. Remove the sync and replace with a placeholder comment (32 and 64 will be merged with a later change). Signed-off-by: Nicholas Pi

[PATCH v3 2/6] powerpc/64: Rearrange 64-bit _switch to prepare for 32/64 merge

2023-06-06 Thread Nicholas Piggin
More some 64-bit specifics out from the function epilogue and rearrange this to be a bit neater, use 32-bit mem ops for CR save/restore, and change some register numbers. This is preparation to consolidate 32-bit and 64-bit switch code. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/ent

[PATCH v3 1/6] powerpc/64s: move stack SLB pinning out of line from _switch

2023-06-06 Thread Nicholas Piggin
The large hunk of SLB pinning in _switch asm code makes it more difficult to see everything else that's going on. It is a less important path now, so icache and fetch footprint overhead can be avoided. Move context switch stack SLB pinning out of line. Signed-off-by: Nicholas Piggin --- arch/po

[PATCH v3 0/6] powerpc: merge _switch in 32/64

2023-06-06 Thread Nicholas Piggin
Since v2: - Add PPC_CREATE_STACK_FRAME() to abstract prologue differences. - Build fix. - Makefile tidy [Christophe] - Fix a missing SOB. Since v1: - Don't re-order 32-bit prologue. - Improve Kconfig conditional includes. - Break out code changes into their own patches before merging, so merge p

[PATCH] powerpc/32s: Fix LLVM SMP build

2023-06-06 Thread Nicholas Piggin
LLVM assembler does not recognise 3-operand cmpi, use cmpwi. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s32/hash_low.S | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/mm/book3s32/hash_low.S b/arch/powerpc/mm/book3s32/hash_low.S index 6925ce9

Re: [PATCH 00/13] mm: jit/text allocator

2023-06-06 Thread Mike Rapoport
On Mon, Jun 05, 2023 at 11:09:34AM +0100, Mark Rutland wrote: > On Mon, Jun 05, 2023 at 12:20:40PM +0300, Mike Rapoport wrote: > > On Fri, Jun 02, 2023 at 10:35:09AM +0100, Mark Rutland wrote: > > > > It sill can be achieved with a single jit_alloc_arch_params(), just by > > adding enum jit_type pa

Re: [PATCHv3 pci-next 2/2] PCI/AER: Rate limit the reporting of the correctable errors

2023-06-06 Thread kernel test robot
Hi Grant, kernel test robot noticed the following build errors: [auto build test ERROR on pci/next] [also build test ERROR on pci/for-linus linus/master v6.4-rc5 next-20230606] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use

Re: WARN at kernel/sched/core.c:5358 (kthread_end_lazy_tlb_mm)

2023-06-06 Thread Nicholas Piggin
On Thu Jun 1, 2023 at 8:46 PM AEST, Sachin Sant wrote: > While compiling a kernel on a IBM Power system booted with > 6.4.0-rc4-next-20230601 following warning is observed > > [ 276.351697] [ cut here ] > [ 276.351709] WARNING: CPU: 27 PID: 9237 at kernel/sched/core.c:5358

[PATCH v2 4/4] powerpc/64s: Remove support for ELFv1 little endian userspace

2023-06-06 Thread Nicholas Piggin
ELFv2 was introduced together with little-endian. ELFv1 with LE has never been a thing. The GNU toolchain can create such a beast, but anyone doing that is a maniac who needs to be stopped so I consider this patch a feature. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/elf.h

[PATCH v2 3/4] powerpc/64: Use -mprofile-kernel for big endian ELFv2 kernels

2023-06-06 Thread Nicholas Piggin
-mprofile-kernel is an optimised calling convention for mcount that Linux has only implemented with the ELFv2 ABI, so it was disabled for big endian kernels. However it does work with ELFv2 big endian, so let's allow that if the compiler supports it. Acked-by: Naveen N. Rao Suggested-by: Christo

[PATCH v2 2/4] powerpc/64: Make ELFv2 the default for big-endian builds

2023-06-06 Thread Nicholas Piggin
All supported toolchains now support ELFv2 on big-endian, so flip the default on this and hide the option behind EXPERT for the purpose of bug hunting. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/K

[PATCH v2 1/4] powerpc/64: Force ELFv2 when building with LLVM linker

2023-06-06 Thread Nicholas Piggin
The LLVM linker does not support ELFv1 at all, so BE kernels must be built with ELFv2. The LLD version check was added to be conservative, LLD simply fails to link ELFv1 entirely, effectively requiring LLD >= 15 and ELFv2 for BE builds. Instead remove that restriction until proven otherwise (LLD 14

[PATCH v2 0/4] powerpc/64: ELFv2 conversion

2023-06-06 Thread Nicholas Piggin
This is a follow on from the series here https://lore.kernel.org/linuxppc-dev/20230505071850.228734-1-npig...@gmail.com/ With feedback addressed and Christophe's -mprofile-kernel for BE added, https://lore.kernel.org/linuxppc-dev/20230506011814.8766-1-npig...@gmail.com/ And dropped the last RFC

Re: [PATCH 4/4] powerpc/kuap: Make disabling KUAP at boottime optional

2023-06-06 Thread Nicholas Piggin
On Mon Jun 5, 2023 at 9:04 PM AEST, Christophe Leroy wrote: > It is possible to disable KUAP at boottime with 'nosmap' parameter. > > That is implemented with jump_label hence adds a 'nop' in front > of each open/close of userspace access. > > From a security point of view it makes sence to disallo

Re: [PATCH 3/4] powerpc/kuap: Refactor static branch for disabling kuap

2023-06-06 Thread Nicholas Piggin
On Mon Jun 5, 2023 at 9:04 PM AEST, Christophe Leroy wrote: > All but book3s/64 use a static branch key for disabling kuap. > book3s/64 uses a memory feature. > > Refactor all targets except book3s/64. > > Signed-off-by: Christophe Leroy > --- > arch/powerpc/include/asm/book3s/32/kup.h | 7 -

Re: [PATCH 2/4] powerpc/kuap: Avoid useless jump_label on empty function

2023-06-06 Thread Nicholas Piggin
On Mon Jun 5, 2023 at 9:04 PM AEST, Christophe Leroy wrote: > Disassembly of interrupt_enter_prepare() shows a pointless nop before the mftb > > c000abf0 : > c000abf0: 81 23 00 84 lwz r9,132(r3) > c000abf4: 71 29 40 00 andi. r9,r9,16384 > c000abf8: 41 82 00 2

Re: [PATCH] powerpc/signal32: Force inlining of __unsafe_save_user_regs() and save_tm_user_regs_unsafe()

2023-06-06 Thread Nicholas Piggin
On Mon Jun 5, 2023 at 6:58 PM AEST, Christophe Leroy wrote: > Looking at generated code for handle_signal32() shows calls to a > function called __unsafe_save_user_regs.constprop.0 while user access > is open. > > And that __unsafe_save_user_regs.constprop.0 function has two nops at > the begining,

Re: [PATCH] powerpc/interrupt: Don't read MSR from interrupt_exit_kernel_prepare()

2023-06-06 Thread Nicholas Piggin
On Mon Jun 5, 2023 at 6:55 PM AEST, Christophe Leroy wrote: > A disassembly of interrupt_exit_kernel_prepare() shows a useless read > of MSR register. This is shown by r9 being re-used immediately without > doing anything with the value read. > > c000e0e0: 60 00 00 00 nop > c000e0e4:

Re: [PATCHv3 pci-next 2/2] PCI/AER: Rate limit the reporting of the correctable errors

2023-06-06 Thread kernel test robot
Hi Grant, kernel test robot noticed the following build errors: [auto build test ERROR on pci/next] [also build test ERROR on pci/for-linus linus/master v6.4-rc5 next-20230606] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use