Re: [PATCH v2 12/13] lkdtm: Fix execute_[user]_location()

2021-10-15 Thread Christophe Leroy
Le 15/10/2021 à 23:31, Kees Cook a écrit : On Thu, Oct 14, 2021 at 07:50:01AM +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 d

Re: [PATCH v2 11/13] lkdtm: Fix lkdtm_EXEC_RODATA()

2021-10-15 Thread Christophe Leroy
Le 15/10/2021 à 23:32, Kees Cook a écrit : On Thu, Oct 14, 2021 at 07:50:00AM +0200, Christophe Leroy wrote: Behind its location, lkdtm_EXEC_RODATA() executes lkdtm_rodata_do_nothing() which is a real function, not a copy of do_nothing(). So executes it directly instead of using execute_loca

Re: [PATCH v2 13/13] lkdtm: Add a test for function descriptors protection

2021-10-15 Thread Christophe Leroy
Le 15/10/2021 à 23:35, Kees Cook a écrit : On Thu, Oct 14, 2021 at 07:50:02AM +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 WRIT

Re: [PATCH 02/13] nvme-multipath: add error handling support for add_disk()

2021-10-15 Thread Christoph Hellwig
Thanks, applied to nvme-5.16.

Re: [PATCH 06/13] nvdimm/blk: avoid calling del_gendisk() on early failures

2021-10-15 Thread Dan Williams
On Fri, Oct 15, 2021 at 4:53 PM Luis Chamberlain wrote: > > If nd_integrity_init() fails we'd get del_gendisk() called, > but that's not correct as we should only call that if we're > done with device_add_disk(). Fix this by providing unwinding > prior to the devm call being registered and moving

Re: [PATCH 02/13] nvme-multipath: add error handling support for add_disk()

2021-10-15 Thread Keith Busch
On Fri, Oct 15, 2021 at 04:52:08PM -0700, Luis Chamberlain wrote: > We never checked for errors on add_disk() as this function > returned void. Now that this is fixed, use the shiny new > error handling. > > Since we now can tell for sure when a disk was added, move > setting the bit NVME_NSHEAD_D

[PATCH 08/13] zram: add error handling support for add_disk()

2021-10-15 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/block/zram/zram_drv.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/block/zram/zram_d

[PATCH 11/13] ps3vram: add error handling support for add_disk()

2021-10-15 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/block/ps3vram.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/block/ps3vram.c b/driv

[PATCH 05/13] nvdimm/btt: add error handling support for add_disk()

2021-10-15 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/nvdimm/btt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/btt.c b/drivers/nvdim

[PATCH 13/13] mtd/ubi/block: add error handling support for add_disk()

2021-10-15 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/mtd/ubi/block.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/block.c b/dri

[PATCH 09/13] z2ram: add error handling support for add_disk()

2021-10-15 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Only the disk is cleaned up inside z2ram_register_disk() as the caller deals with the rest. Signed-off-by: Luis Chamberlain --- drivers/block/z2ram.c | 7 +-- 1

[PATCH 06/13] nvdimm/blk: avoid calling del_gendisk() on early failures

2021-10-15 Thread Luis Chamberlain
If nd_integrity_init() fails we'd get del_gendisk() called, but that's not correct as we should only call that if we're done with device_add_disk(). Fix this by providing unwinding prior to the devm call being registered and moving the devm registration to the very end. This should fix calling del

[PATCH 10/13] ps3disk: add error handling support for add_disk()

2021-10-15 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/block/ps3disk.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/block/ps3disk.c b/dr

[PATCH 03/13] nvdimm/btt: do not call del_gendisk() if not needed

2021-10-15 Thread Luis Chamberlain
We know we don't need del_gendisk() if we haven't added the disk, so just skip it. This should fix a bug on older kernels, as del_gendisk() became able to deal with disks not added only recently, after the patch titled "block: add flag for add_disk() completion notation". Signed-off-by: Luis Chamb

[PATCH 02/13] nvme-multipath: add error handling support for add_disk()

2021-10-15 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Since we now can tell for sure when a disk was added, move setting the bit NVME_NSHEAD_DISK_LIVE only when we did add the disk successfully. Nothing to do here as th

[PATCH 00/13] block: add_disk() error handling stragglers

2021-10-15 Thread Luis Chamberlain
This patch set consists of al the straggler drivers for which we have have no patch reviews done for yet. I'd like to ask for folks to please consider chiming in, specially if you're the maintainer for the driver. Additionally if you can specify if you'll take the patch in yourself or if you want J

[PATCH 07/13] nvdimm/blk: add error handling support for add_disk()

2021-10-15 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Since nvdimm/blk uses devm we just need to move the devm registration towards the end. And in hindsight, that seems to also provide a fix given del_gendisk() should n

[PATCH 01/13] block/brd: add error handling support for add_disk()

2021-10-15 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Signed-off-by: Luis Chamberlain --- drivers/block/brd.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/block/brd.c b/drivers/b

[PATCH 04/13] nvdimm/btt: use goto error labels on btt_blk_init()

2021-10-15 Thread Luis Chamberlain
This will make it easier to share common error paths. Signed-off-by: Luis Chamberlain --- drivers/nvdimm/btt.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 29cc7325e890..23ee8c005db5 100644 --- a/driver

[PATCH 12/13] block/sunvdc: add error handling support for add_disk()

2021-10-15 Thread Luis Chamberlain
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. We re-use the same free tag call, so we also add a label for that as well. Signed-off-by: Luis Chamberlain --- drivers/block/sunvdc.c | 14 +++--- 1 file c

Re: [PATCH v6 00/11] PCI: Drop duplicated tracking of a pci_dev's bound driver

2021-10-15 Thread Andy Shevchenko
On Fri, Oct 15, 2021 at 7:46 PM Bjorn Helgaas wrote: > On Wed, Oct 13, 2021 at 04:23:09PM +0300, Andy Shevchenko wrote: ... > so compared to Uwe's v6, I restored that section to the original code. > My goal here was to make the patch as simple and easy to review as > possible. Thanks for elabor

Re: [PATCH v6 00/11] PCI: Drop duplicated tracking of a pci_dev's bound driver

2021-10-15 Thread Bjorn Helgaas
On Wed, Oct 13, 2021 at 04:23:09PM +0300, Andy Shevchenko wrote: > On Wed, Oct 13, 2021 at 06:33:56AM -0500, Bjorn Helgaas wrote: > > On Wed, Oct 13, 2021 at 12:26:42PM +0300, Andy Shevchenko wrote: > > > On Wed, Oct 13, 2021 at 2:33 AM Bjorn Helgaas wrote: > > > > On Mon, Oct 04, 2021 at 02:59:24

RE: [PATCH] soc: fsl: dpio: protect smp_processor_id when get processor id

2021-10-15 Thread Li, Meng
> -Original Message- > From: Robin Murphy > Sent: Friday, October 15, 2021 9:40 PM > To: Li, Meng ; roy.ple...@nxp.com; > leoyang...@nxp.com; ruxandra.radule...@nxp.com; horia.gea...@nxp.com > Cc: linux-ker...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; linux-arm- > ker...@lists.infr

Re: [PATCH 2/2] sched: Centralize SCHED_{SMT, MC, CLUSTER} definitions

2021-10-15 Thread Peter Zijlstra
On Fri, Oct 08, 2021 at 04:22:27PM +0100, Valentin Schneider wrote: > So x86 has it default yes, and a lot of others (e.g. arm64) have it default > no. > > IMO you don't gain much by disabling them. SCHED_MC and SCHED_CLUSTER only > control the presence of a sched_domain_topology_level - if it's

[PATCH] soc: fsl: dpio: protect smp_processor_id when get processor id

2021-10-15 Thread Meng . Li
From: Meng Li When enable debug kernel configs,there will be calltrace as below: BUG: using smp_processor_id() in preemptible [] code: swapper/0/1 caller is debug_smp_processor_id+0x20/0x30 CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.10.63-yocto-standard #1 Hardware name: NXP Layerscape

Re: [PATCH net-next 11/12] ethernet: ibmveth: use ether_addr_to_u64()

2021-10-15 Thread Tyrel Datwyler
On 10/15/21 3:16 PM, Jakub Kicinski wrote: > We'll want to make netdev->dev_addr const, remove the local > helper which is missing a const qualifier on the argument > and use ether_addr_to_u64(). LGTM. ibmveth_encode_mac_addr() is clearly code duplication of ether_addr_to_u64() minus the const qua

[PATCH net-next 11/12] ethernet: ibmveth: use ether_addr_to_u64()

2021-10-15 Thread Jakub Kicinski
We'll want to make netdev->dev_addr const, remove the local helper which is missing a const qualifier on the argument and use ether_addr_to_u64(). Similar story to mlx4. Signed-off-by: Jakub Kicinski --- CC: cforn...@linux.ibm.com CC: m...@ellerman.id.au CC: b...@kernel.crashing.org CC: pau...@s

Re: [PATCH v2 13/13] lkdtm: Add a test for function descriptors protection

2021-10-15 Thread Kees Cook
On Thu, Oct 14, 2021 at 07:50:02AM +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 1

Re: [PATCH v2 11/13] lkdtm: Fix lkdtm_EXEC_RODATA()

2021-10-15 Thread Kees Cook
On Thu, Oct 14, 2021 at 07:50:00AM +0200, Christophe Leroy wrote: > Behind its location, lkdtm_EXEC_RODATA() executes > lkdtm_rodata_do_nothing() which is a real function, > not a copy of do_nothing(). > > So executes it directly instead of using execute_location(). > > This is necessary because

Re: [PATCH v2 12/13] lkdtm: Fix execute_[user]_location()

2021-10-15 Thread Kees Cook
On Thu, Oct 14, 2021 at 07:50:01AM +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 sti

Re: [PATCH] ibmvscsi: use GFP_KERNEL with dma_alloc_coherent in initialize_event_pool

2021-10-15 Thread Tyrel Datwyler
On 10/14/21 9:36 PM, Michael Ellerman wrote: > Tyrel Datwyler writes: >> Just stumbled upon this trivial little patch that looks to have gotten lost >> in >> the shuffle. Seems it even got a reviewed-by from Brian [1]. >> >> So, uh I guess after almost 3 years...ping? > > It's marked "Changes Re

Re: [PATCH] tracing: Have all levels of checks prevent recursion

2021-10-15 Thread Steven Rostedt
On Fri, 15 Oct 2021 20:24:59 +0200 Peter Zijlstra wrote: > > @@ -206,11 +206,7 @@ DEFINE_OUTPUT_COPY(__output_copy_user, > > arch_perf_out_copy_user) > > static inline int get_recursion_context(int *recursion) > > { > > unsigned int pc = preempt_count(); > > Although I think we can do w

Re: [PATCH] tracing: Have all levels of checks prevent recursion

2021-10-15 Thread Peter Zijlstra
On Fri, Oct 15, 2021 at 02:20:33PM -0400, Steven Rostedt wrote: > On Fri, 15 Oct 2021 20:04:29 +0200 > Peter Zijlstra wrote: > > > On Fri, Oct 15, 2021 at 01:58:06PM -0400, Steven Rostedt wrote: > > > Something like this: > > > > I think having one copy of that in a header is better than havin

Re: [PATCH] tracing: Have all levels of checks prevent recursion

2021-10-15 Thread Steven Rostedt
On Fri, 15 Oct 2021 14:20:33 -0400 Steven Rostedt wrote: > > I think having one copy of that in a header is better than having 3 > > copies. But yes, something along them lines. > > I was just about to ask you about this patch ;-) Except it doesn't build :-p (need to move the inlined function

Re: [PATCH] tracing: Have all levels of checks prevent recursion

2021-10-15 Thread Steven Rostedt
On Fri, 15 Oct 2021 20:04:29 +0200 Peter Zijlstra wrote: > On Fri, Oct 15, 2021 at 01:58:06PM -0400, Steven Rostedt wrote: > > Something like this: > > I think having one copy of that in a header is better than having 3 > copies. But yes, something along them lines. I was just about to ask yo

Re: [PATCH] tracing: Have all levels of checks prevent recursion

2021-10-15 Thread Peter Zijlstra
On Fri, Oct 15, 2021 at 01:58:06PM -0400, Steven Rostedt wrote: > Something like this: I think having one copy of that in a header is better than having 3 copies. But yes, something along them lines.

Re: [PATCH] tracing: Have all levels of checks prevent recursion

2021-10-15 Thread Steven Rostedt
On Fri, 15 Oct 2021 13:35:04 -0400 Steven Rostedt wrote: > On Fri, 15 Oct 2021 18:17:02 +0200 > Peter Zijlstra wrote: > > > On Fri, Oct 15, 2021 at 11:00:35AM -0400, Steven Rostedt wrote: > > > From: "Steven Rostedt (VMware)" > > > > > > While writing an email explaining the "bit = 0" logic

[PATCH v2] powerpc/smp: do not decrement idle task preempt count in CPU offline

2021-10-15 Thread Nathan Lynch
With PREEMPT_COUNT=y, when a CPU is offlined and then onlined again, we get: BUG: scheduling while atomic: swapper/1/0/0x no locks held by swapper/1/0. CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.15.0-rc2+ #100 Call Trace: dump_stack_lvl+0xac/0x108 __schedule_bug+0xac/0xe0 __schedule+0x

Re: [PATCH] tracing: Have all levels of checks prevent recursion

2021-10-15 Thread Steven Rostedt
On Fri, 15 Oct 2021 18:17:02 +0200 Peter Zijlstra wrote: > On Fri, Oct 15, 2021 at 11:00:35AM -0400, Steven Rostedt wrote: > > From: "Steven Rostedt (VMware)" > > > > While writing an email explaining the "bit = 0" logic for a discussion on > > > bit = trace_get_context_bit() + start;

Re: [PATCH] powerpc/smp: do not decrement idle task preempt count in CPU offline

2021-10-15 Thread Nathan Lynch
Valentin Schneider writes: > On 15/10/21 09:55, Nathan Lynch wrote: >> With PREEMPT_COUNT=y, when a CPU is offlined and then onlined again, we >> get: >> >> BUG: scheduling while atomic: swapper/1/0/0x >> no locks held by swapper/1/0. >> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.15.0-rc

Re: [PATCH 0/4] Update mpc5200 dts files to fix warnings

2021-10-15 Thread Rob Herring
On Wed, Oct 13, 2021 at 5:05 PM Anatolij Gustschin wrote: > > This series fixes localbus, memory and pci node build warnings. > It was tested with current linux-next on digsy_mtc and tqm5200 > boards. > > Anatolij Gustschin (4): > powerpc/5200: dts: add missing pci ranges > powerpc/5200: dts:

Re: [PATCH 4/4] powerpc/5200: dts: fix localbus node warnings

2021-10-15 Thread Rob Herring
On Wed, Oct 13, 2021 at 5:05 PM Anatolij Gustschin wrote: > > Fix build warnings like: > localbus:ranges: 'oneOf' conditional failed, one must be fixed > ... > Warning (unit_address_vs_reg): /localbus: node has a reg or ranges property, > but no unit name > Warning (simple_bus_reg): /localbus/fla

Re: [PATCH] tracing: Have all levels of checks prevent recursion

2021-10-15 Thread Peter Zijlstra
On Fri, Oct 15, 2021 at 11:00:35AM -0400, Steven Rostedt wrote: > From: "Steven Rostedt (VMware)" > > While writing an email explaining the "bit = 0" logic for a discussion on > bit = trace_get_context_bit() + start; While there, you were also going to update that function to match/use ge

Re: [PATCH v2] powerpc/mpc512x: dts: fix PSC node warnings

2021-10-15 Thread Rob Herring
On Thu, Oct 14, 2021 at 5:42 PM Anatolij Gustschin wrote: > > Rework PSC node description to fix build warnings like: > mpc5121.dtsi:397.13-406.5: Warning (spi_bus_bridge): /soc@8000/psc@11400: > node name for SPI buses should be 'spi' > mpc5121.dtsi:409.13-418.5: Warning (spi_bus_bridge): /s

[PATCH v1 11/11] powerpc/microwatt: Don't select the hash MMU code

2021-10-15 Thread Nicholas Piggin
Microwatt is radix-only, so it does not require hash MMU support. This saves 20kB compressed dtbImage and 56kB vmlinux size. Signed-off-by: Nicholas Piggin --- arch/powerpc/configs/microwatt_defconfig | 1 - arch/powerpc/platforms/microwatt/Kconfig | 1 - 2 files changed, 2 deletions(-) diff -

[PATCH v1 10/11] powerpc/configs/microwatt: add POWER9_CPU

2021-10-15 Thread Nicholas Piggin
Microwatt implements a subset of ISA v3.0 (which is equivalent to the POWER9_CPU option). Signed-off-by: Nicholas Piggin --- arch/powerpc/configs/microwatt_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/configs/microwatt_defconfig b/arch/powerpc/configs/microwatt_def

[PATCH v1 09/11] powerpc/64s: Make hash MMU code build configurable

2021-10-15 Thread Nicholas Piggin
Introduce a new option CONFIG_PPC_64S_HASH_MMU which allows the 64s hash MMU code to be compiled out if radix is selected and the minimum supported CPU type is POWER9 or higher, and KVM is not selected. This saves 128kB kernel image size (90kB text) on powernv_defconfig minus KVM, 350kB on pseries

[PATCH v1 08/11] powerpc/64s: Make flush_and_reload_slb a no-op when radix is enabled

2021-10-15 Thread Nicholas Piggin
The radix test can exclude slb_flush_all_realmode() from being called because flush_and_reload_slb() is only expected to flush ERAT when called by flush_erat(), which is only on pre-ISA v3.0 CPUs that do not support radix. This helps the later change to make hash support configurable to not introd

[PATCH v1 07/11] powerpc/64s: move THP trace point creation out of hash specific file

2021-10-15 Thread Nicholas Piggin
In preparation for making hash MMU support configurable, move THP trace point function definitions out of an otherwise hash specific file. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/Makefile | 2 +- arch/powerpc/mm/book3s64/hash_pgtable.c | 1 - arch/powerpc/mm/book3s64/pg

[PATCH v1 06/11] powerpc/pseries: lparcfg don't include slb_size line in radix mode

2021-10-15 Thread Nicholas Piggin
This avoids a change in behaviour in the later patch making hash support configurable. This is possibly a user interface change, so the alternative would be a hard-coded slb_size=0 here. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/pseries/lparcfg.c | 3 ++- 1 file changed, 2 insert

[PATCH v1 05/11] powerpc/pseries: move pseries_lpar_register_process_table() out from hash specific code

2021-10-15 Thread Nicholas Piggin
This reduces ifdefs in a later change making hash support configurable. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/pseries/lpar.c | 56 +-- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc

[PATCH v1 04/11] powerpc/64s: Move and rename do_bad_slb_fault as it is not hash specific

2021-10-15 Thread Nicholas Piggin
slb.c is hash-specific SLB management, but do_bad_slb_fault deals with segment interrupts that occur with radix MMU as well. --- arch/powerpc/include/asm/interrupt.h | 2 +- arch/powerpc/kernel/exceptions-64s.S | 4 ++-- arch/powerpc/mm/book3s64/slb.c | 16 arch/powerpc/mm

[PATCH v1 03/11] powerpc/pseries: Stop selecting PPC_HASH_MMU_NATIVE

2021-10-15 Thread Nicholas Piggin
The pseries platform does not use the native hash code but the PAPR virtualised hash interfaces, so remove PPC_HASH_MMU_NATIVE. This requires moving tlbiel code from hash_native.c to hash_utils.c. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/tlbflush.h | 4 - arch/pow

[PATCH v1 02/11] powerpc: Rename PPC_NATIVE to PPC_HASH_MMU_NATIVE

2021-10-15 Thread Nicholas Piggin
PPC_NATIVE now only controls the native HPT code, so rename it to be more descriptive. Restrict it to Book3S only. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/Makefile | 2 +- arch/powerpc/mm/book3s64/hash_utils.c | 2 +- arch/powerpc/platforms/52xx/Kconfig|

[PATCH v1 00/11] powerpc: Make hash MMU code build configurable

2021-10-15 Thread Nicholas Piggin
Now that there's a platform that can make good use of it, here's a series that can prevent the hash MMU code being built for 64s platforms that don't need it. Thanks Christophe and Michael for reviews of the RFC, I hope I got all the issues raised. Since RFC: - Split out large code movement from

[PATCH v1 01/11] powerpc: Remove unused FW_FEATURE_NATIVE references

2021-10-15 Thread Nicholas Piggin
FW_FEATURE_NATIVE_ALWAYS and FW_FEATURE_NATIVE_POSSIBLE are always zero and never do anything. Remove them. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/firmware.h | 8 1 file changed, 8 deletions(-) diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/includ

Re: [PATCH] powerpc/smp: do not decrement idle task preempt count in CPU offline

2021-10-15 Thread Valentin Schneider
On 15/10/21 09:55, Nathan Lynch wrote: > With PREEMPT_COUNT=y, when a CPU is offlined and then onlined again, we > get: > > BUG: scheduling while atomic: swapper/1/0/0x > no locks held by swapper/1/0. > CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.15.0-rc2+ #100 > Call Trace: > dump_stack_l

[PATCH] tracing: Have all levels of checks prevent recursion

2021-10-15 Thread Steven Rostedt
From: "Steven Rostedt (VMware)" While writing an email explaining the "bit = 0" logic for a discussion on making ftrace_test_recursion_trylock() disable preemption, I discovered a path that makes the "not do the logic if bit is zero" unsafe. The recursion logic is done in hot paths like the func

[PATCH] powerpc/smp: do not decrement idle task preempt count in CPU offline

2021-10-15 Thread Nathan Lynch
With PREEMPT_COUNT=y, when a CPU is offlined and then onlined again, we get: BUG: scheduling while atomic: swapper/1/0/0x no locks held by swapper/1/0. CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.15.0-rc2+ #100 Call Trace: dump_stack_lvl+0xac/0x108 __schedule_bug+0xac/0xe0 __schedule+0x

[PATCH v2 19/24] PCI/DPC: Use RESPONSE_IS_PCI_ERROR() to check read from hardware

2021-10-15 Thread Naveen Naidu
An MMIO read from a PCI device that doesn't exist or doesn't respond causes a PCI error. There's no real data to return to satisfy the CPU read, so most hardware fabricates ~0 data. Use RESPONSE_IS_PCI_ERROR() to check the response we get when we read data from hardware. This helps unify PCI err

Re: [PATCH v2 00/24] Unify PCI error response checking

2021-10-15 Thread Naveen Naidu
On 15/10, Naveen Naidu wrote: > An MMIO read from a PCI device that doesn't exist or doesn't respond > causes a PCI error. There's no real data to return to satisfy the > CPU read, so most hardware fabricates ~0 data. > > This patch series adds PCI_ERROR_RESPONSE definition and other helper > de

Re: [PATCH v3 1/2] ftrace: disable preemption between ftrace_test_recursion_trylock/unlock()

2021-10-15 Thread Petr Mladek
On Fri 2021-10-15 11:13:08, 王贇 wrote: > > > On 2021/10/14 下午11:14, Petr Mladek wrote: > [snip] > >> - return trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, > >> TRACE_FTRACE_MAX); > >> + int bit; > >> + > >> + bit = trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_STA

[PATCH v2 00/24] Unify PCI error response checking

2021-10-15 Thread Naveen Naidu
An MMIO read from a PCI device that doesn't exist or doesn't respond causes a PCI error. There's no real data to return to satisfy the CPU read, so most hardware fabricates ~0 data. This patch series adds PCI_ERROR_RESPONSE definition and other helper definition SET_PCI_ERROR_RESPONSE and RESPON

[PATCH v2 00/24] Unify PCI error response checking

2021-10-15 Thread Naveen Naidu
An MMIO read from a PCI device that doesn't exist or doesn't respond causes a PCI error. There's no real data to return to satisfy the CPU read, so most hardware fabricates ~0 data. This patch series adds PCI_ERROR_RESPONSE definition and other helper definition SET_PCI_ERROR_RESPONSE and RESPON

Re: [PATCH] soc: fsl: dpio: protect smp_processor_id when get processor id

2021-10-15 Thread Robin Murphy
On 2021-10-15 07:36, meng...@windriver.com wrote: From: Meng Li When enable debug kernel configs,there will be calltrace as below: BUG: using smp_processor_id() in preemptible [] code: swapper/0/1 caller is debug_smp_processor_id+0x20/0x30 CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.10

[PATCH 2/2] KVM: PPC: Book3S HV: Make idle_kvm_start_guest() return 0 if it went to guest

2021-10-15 Thread Michael Ellerman
We call idle_kvm_start_guest() from power7_offline() if the thread has been requested to enter KVM. We pass it the SRR1 value that was returned from power7_idle_insn() which tells us what sort of wakeup we're processing. Depending on the SRR1 value we pass in, the KVM code might enter the guest, o

[PATCH 1/2] KVM: PPC: Book3S HV: Fix stack handling in idle_kvm_start_guest()

2021-10-15 Thread Michael Ellerman
In commit 10d91611f426 ("powerpc/64s: Reimplement book3s idle code in C") kvm_start_guest() became idle_kvm_start_guest(). The old code allocated a stack frame on the emergency stack, but didn't use the frame to store anything, and also didn't store anything in its caller's frame. idle_kvm_start_g

Re: [PATCH v3 1/2] ftrace: disable preemption between ftrace_test_recursion_trylock/unlock()

2021-10-15 Thread Steven Rostedt
On Fri, 15 Oct 2021 17:12:26 +0800 王贇 wrote: > Maybe take some example would be easier to understand... > > Currently there are two way of using ftrace_test_recursion_trylock(), > one with TRACE_FTRACE_XXX we mark as A, one with TRACE_LIST_XXX we mark > as B, then: > > A followed by B on same c

Re: [PATCH v11 2/3] tty: hvc: pass DMA capable memory to put_chars()

2021-10-15 Thread Xianting Tian
Hi Greg and experts Is this version ok for you?  thanks 在 2021/10/15 上午10:46, Xianting Tian 写道: As well known, hvc backend can register its opertions to hvc backend. the operations contain put_chars(), get_chars() and so on. Some hvc backend may do dma in its operations. eg, put_chars() of vir

Re: [PATCH 2/2] kbuild: use more subdir- for visiting subdirectories while cleaning

2021-10-15 Thread Michael Ellerman
Masahiro Yamada writes: > ... > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile > index aa6808e70647..b61d8be3c226 100644 > --- a/arch/powerpc/Makefile > +++ b/arch/powerpc/Makefile > @@ -411,9 +409,6 @@ install: > sh -x $(srctree)/$(boot)/install.sh "$(KERNELRELEASE)" vmlinux \ >

Re: [PATCH v2 06/13] asm-generic: Use HAVE_FUNCTION_DESCRIPTORS to define associated stubs

2021-10-15 Thread Nicholas Piggin
Excerpts from Nicholas Piggin's message of October 15, 2021 6:02 pm: > Excerpts from Christophe Leroy's message of October 15, 2021 4:24 pm: >> >> >> Le 15/10/2021 à 08:16, Nicholas Piggin a écrit : >>> Excerpts from Christophe Leroy's message of October 14, 2021 3:49 pm: Replace HAVE_DEREFE

Re: [PATCH v2] powerpc/s64: Clarify that radix lacks DEBUG_PAGEALLOC

2021-10-15 Thread Michael Ellerman
Christophe Leroy writes: > Le 13/10/2021 à 23:34, Joel Stanley a écrit : >> The page_alloc.c code will call into __kernel_map_pages when >> DEBUG_PAGEALLOC is configured and enabled. >> >> As the implementation assumes hash, this should crash spectacularly if >> not for a bit of luck in __kernel_

[PATCH v1 8/8] powerpc/fsl_booke: Enable STRICT_KERNEL_RWX

2021-10-15 Thread Christophe Leroy
Enable STRICT_KERNEL_RWX on fsl_booke. For that, we need additional TLBCAMs dedicated to linear mapping, based on the alignment of _sinittext. By default, up to 768 Mbytes of memory are mapped. It uses 3 TLBCAMs of size 256 Mbytes. With a data alignment of 16, we need up to 9 TLBCAMs: 16/16/16

[PATCH v1 5/8] powerpc/fsl_booke: Tell map_mem_in_cams() if init is done

2021-10-15 Thread Christophe Leroy
In order to be able to call map_mem_in_cams() once more after init for STRICT_KERNEL_RWX, add an argument. For now, map_mem_in_cams() is always called only during init. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/mmu_decl.h | 2 +- arch/powerpc/mm/nohash/fsl_book3e.c | 12 ++

[PATCH v1 7/8] powerpc/fsl_booke: Update of TLBCAMs after init

2021-10-15 Thread Christophe Leroy
After init, set readonly memory as ROX and set readwrite memory as RWX, if STRICT_KERNEL_RWX is enabled. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/mmu_decl.h | 2 +- arch/powerpc/mm/nohash/fsl_book3e.c | 32 + 2 files changed, 29 insertions(+), 5 d

[PATCH v1 1/8] powerpc/booke: Disable STRICT_KERNEL_RWX, DEBUG_PAGEALLOC and KFENCE

2021-10-15 Thread Christophe Leroy
fsl_booke and 44x are not able to map kernel linear memory with pages, so they can't support DEBUG_PAGEALLOC and KFENCE, and STRICT_KERNEL_RWX is also a problem for now. Enable those only on book3s (both 32 and 64 except KFENCE), 8xx and 40x. Fixes: 88df6e90fa97 ("[POWERPC] DEBUG_PAGEALLOC for 32

[PATCH v1 4/8] powerpc/fsl_booke: Enable reloading of TLBCAM without switching to AS1

2021-10-15 Thread Christophe Leroy
Avoid switching to AS1 when reloading TLBCAM after init for STRICT_KERNEL_RWX. When we setup AS1 we expect the entire accessible memory to be mapped through one entry, this is not the case anymore at the end of init. We are not changing the size of TLBCAMs, only flags, so no need to switch to AS1

[PATCH v1 2/8] powerpc/fsl_booke: Rename fsl_booke.c to fsl_book3e.c

2021-10-15 Thread Christophe Leroy
We have a myriad of CONFIG symbols around different variants of BOOKEs, which would be worth tidying up one day. But at least, make file names and CONFIG option match: We have CONFIG_FSL_BOOKE and CONFIG_PPC_FSL_BOOK3E. fsl_booke.c is selected by and only by CONFIG_PPC_FSL_BOOK3E. So rename it f

[PATCH v1 6/8] powerpc/fsl_booke: Allocate separate TLBCAMs for readonly memory

2021-10-15 Thread Christophe Leroy
Reorganise TLBCAM allocation so that when STRICT_KERNEL_RWX is enabled, TLBCAMs are allocated such that readonly memory uses different TLBCAMs. This results in an allocation looking like: Memory CAM mapping: 4/4/4/1/1/1/1/16/16/16/64/64/64/256/256 Mb, residual: 256Mb Signed-off-by: Christophe Le

[PATCH v1 3/8] powerpc/fsl_booke: Take exec flag into account when setting TLBCAMs

2021-10-15 Thread Christophe Leroy
Don't force MAS3_SX and MAS3_UX at all time. Take into account the exec flag. While at it, fix a couple of closeby style problems (indent with space and unnecessary parenthesis), it keeps more readability. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/nohash/fsl_book3e.c | 10 ++

Re: [PATCH v3 1/2] ftrace: disable preemption between ftrace_test_recursion_trylock/unlock()

2021-10-15 Thread 王贇
On 2021/10/15 下午3:28, Petr Mladek wrote: > On Fri 2021-10-15 11:13:08, 王贇 wrote: >> >> >> On 2021/10/14 下午11:14, Petr Mladek wrote: >> [snip] - return trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, TRACE_FTRACE_MAX); + int bit; + + bit = trace_test_a

Re: [PATCH v2 06/13] asm-generic: Use HAVE_FUNCTION_DESCRIPTORS to define associated stubs

2021-10-15 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of October 15, 2021 4:24 pm: > > > Le 15/10/2021 à 08:16, Nicholas Piggin a écrit : >> Excerpts from Christophe Leroy's message of October 14, 2021 3:49 pm: >>> Replace HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR by >>> HAVE_FUNCTION_DESCRIPTORS and use it instea

Re: [PATCH] powerpc/mce: check if event info is valid

2021-10-15 Thread Nicholas Piggin
Excerpts from Michael Ellerman's message of October 7, 2021 10:09 pm: > Ganesh writes: >> On 8/6/21 6:53 PM, Ganesh Goudar wrote: >> >>> Check if the event info is valid before printing the >>> event information. When a fwnmi enabled nested kvm guest >>> hits a machine check exception L0 and L2 wo

[PATCH 2/2] powerpc/eeh: Use a goto for recovery failures

2021-10-15 Thread Daniel Axtens
From: Oliver O'Halloran The EEH recovery logic in eeh_handle_normal_event() has some pretty strange flow control. If we remove all the actual recovery logic we're left with the following skeleton: if (result != PCI_ERS_RESULT_DISCONNECT) { ... } if (resul

[PATCH 1/2] eeh: Small refactor of eeh_handle_normal_event

2021-10-15 Thread Daniel Axtens
The control flow of eeh_handle_normal_event is a bit tricky. Break out one of the error handling paths - rather than be in an else block, we'll make it part of the regular body of the function and put a 'goto out;' in the true limb of the if. Signed-off-by: Daniel Axtens --- This doesn't reall

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

2021-10-15 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of October 14, 2021 3:49 pm: > dereference_function_descriptor() and > dereference_kernel_function_descriptor() are identical on the > three architectures implementing them. > > Make them common and put them out-of-line in kernel/extable.c > which is one of