[PATCH 1/2] PCI: endpoint: Clean up hardware description for BARs

2024-02-09 Thread Niklas Cassel
The hardware description for BARs is scattered in many different variables in pci_epc_features. Some of these things are mutually exclusive, so it can create confusion over which variable that has precedence over another. Improve the situation by creating a struct pci_epc_bar_desc, and a new enum

[PATCH 0/2] PCI endpoint BAR hardware description cleanup

2024-02-09 Thread Niklas Cassel
The series is based on top of: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=endpoint Hello all, This series cleans up the hardware description for PCI endpoint BARs. The problems with the existing hardware description: -The documentation is lackluster. -Some of the names

[PATCH 4/4] powerpc: ibmebus: make ibmebus_bus_type const

2024-02-09 Thread Ricardo B. Marliere
Now that the driver core can properly handle constant struct bus_type, move the ibmebus_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B.

[PATCH 3/4] powerpc: mpic: make mpic_subsys const

2024-02-09 Thread Ricardo B. Marliere
Now that the driver core can properly handle constant struct bus_type, move the mpic_subsys variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B.

[PATCH 2/4] powerpc: vio: make vio_bus_type const

2024-02-09 Thread Ricardo B. Marliere
Now that the driver core can properly handle constant struct bus_type, move the vio_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B.

[PATCH 1/4] powerpc: vio: move device attributes into a new ifdef

2024-02-09 Thread Ricardo B. Marliere
In order to make the distinction of the vio_bus_type variable based on CONFIG_PPC_SMLPAR more explicit, move the required structs into a new ifdef block. This is needed in order to make vio_bus_type const and because the distinction is made explicit, there is no need to set the fields within the

[PATCH 0/4] powerpc: struct bus_type cleanup

2024-02-09 Thread Ricardo B. Marliere
: 20240209-bus_cleanup-powerpc2-498426fccb98 Best regards, -- Ricardo B. Marliere

Re: [PATCH v5 00/25] Transparent Contiguous PTEs for User Mappings

2024-02-09 Thread Ryan Roberts
On 09/02/2024 22:16, David Hildenbrand wrote: >>> 1) Convert READ_ONCE() -> ptep_get() >>> 2) Convert set_pte_at() -> set_ptes() >>> 3) All the "New layer" renames and addition of the trivial wrappers >> >> Yep that makes sense. I'll start prepping that today. I'll hold off reposting >> until I

Re: [PATCH] mm/hugetlb: Move page order check inside hugetlb_cma_reserve()

2024-02-09 Thread Jane Chu
On 2/8/2024 9:42 PM, Anshuman Khandual wrote: All platforms could benefit from page order check against MAX_PAGE_ORDER before allocating a CMA area for gigantic hugetlb pages. Let's move this check from individual platforms to generic hugetlb. Cc: Catalin Marinas Cc: Will Deacon Cc: Michael

Re: [PATCH v3 01/15] arm64/mm: Make set_ptes() robust when OAs cross 48-bit boundary

2024-02-09 Thread David Hildenbrand
On 08.02.24 07:10, Mike Rapoport wrote: On Mon, Jan 29, 2024 at 01:46:35PM +0100, David Hildenbrand wrote: From: Ryan Roberts Since the high bits [51:48] of an OA are not stored contiguously in the PTE, there is a theoretical bug in set_ptes(), which just adds PAGE_SIZE to the pte to get the

Re: [PATCH v5 00/25] Transparent Contiguous PTEs for User Mappings

2024-02-09 Thread David Hildenbrand
1) Convert READ_ONCE() -> ptep_get() 2) Convert set_pte_at() -> set_ptes() 3) All the "New layer" renames and addition of the trivial wrappers Yep that makes sense. I'll start prepping that today. I'll hold off reposting until I have your comments on 19-25. I'm also hoping that David will

[PATCH v2 09/10] mm/mmu_gather: improve cond_resched() handling with large folios and expensive page freeing

2024-02-09 Thread David Hildenbrand
It's a pain that we have to handle cond_resched() in tlb_batch_pages_flush() manually and cannot simply handle it in release_pages() -- release_pages() can be called from atomic context. Well, in a perfect world we wouldn't have to make our code more at all. With page poisoning and init_on_free,

[PATCH v2 10/10] mm/memory: optimize unmap/zap with PTE-mapped THP

2024-02-09 Thread David Hildenbrand
Similar to how we optimized fork(), let's implement PTE batching when consecutive (present) PTEs map consecutive pages of the same large folio. Most infrastructure we need for batching (mmu gather, rmap) is already there. We only have to add get_and_clear_full_ptes() and clear_full_ptes().

[PATCH v2 08/10] mm/mmu_gather: add __tlb_remove_folio_pages()

2024-02-09 Thread David Hildenbrand
Add __tlb_remove_folio_pages(), which will remove multiple consecutive pages that belong to the same large folio, instead of only a single page. We'll be using this function when optimizing unmapping/zapping of large folios that are mapped by PTEs. We're using the remaining spare bit in an

[PATCH v2 07/10] mm/mmu_gather: add tlb_remove_tlb_entries()

2024-02-09 Thread David Hildenbrand
Let's add a helper that lets us batch-process multiple consecutive PTEs. Note that the loop will get optimized out on all architectures except on powerpc. We have to add an early define of __tlb_remove_tlb_entry() on ppc to make the compiler happy (and avoid making tlb_remove_tlb_entries() a

[PATCH v2 06/10] mm/mmu_gather: define ENCODED_PAGE_FLAG_DELAY_RMAP

2024-02-09 Thread David Hildenbrand
Nowadays, encoded pages are only used in mmu_gather handling. Let's update the documentation, and define ENCODED_PAGE_BIT_DELAY_RMAP. While at it, rename ENCODE_PAGE_BITS to ENCODED_PAGE_BITS. If encoded page pointers would ever be used in other context again, we'd likely want to change the

[PATCH v2 05/10] mm/mmu_gather: pass "delay_rmap" instead of encoded page to __tlb_remove_page_size()

2024-02-09 Thread David Hildenbrand
We have two bits available in the encoded page pointer to store additional information. Currently, we use one bit to request delay of the rmap removal until after a TLB flush. We want to make use of the remaining bit internally for batching of multiple pages of the same folio, specifying that the

[PATCH v2 04/10] mm/memory: factor out zapping folio pte into zap_present_folio_pte()

2024-02-09 Thread David Hildenbrand
Let's prepare for further changes by factoring it out into a separate function. Reviewed-by: Ryan Roberts Signed-off-by: David Hildenbrand --- mm/memory.c | 53 - 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/mm/memory.c

[PATCH v2 03/10] mm/memory: further separate anon and pagecache folio handling in zap_present_pte()

2024-02-09 Thread David Hildenbrand
We don't need up-to-date accessed-dirty information for anon folios and can simply work with the ptent we already have. Also, we know the RSS counter we want to update. We can safely move arch_check_zapped_pte() + tlb_remove_tlb_entry() + zap_install_uffd_wp_if_needed() after updating the folio

[PATCH v2 02/10] mm/memory: handle !page case in zap_present_pte() separately

2024-02-09 Thread David Hildenbrand
We don't need uptodate accessed/dirty bits, so in theory we could replace ptep_get_and_clear_full() by an optimized ptep_clear_full() function. Let's rely on the provided pte. Further, there is no scenario where we would have to insert uffd-wp markers when zapping something that is not a normal

[PATCH v2 01/10] mm/memory: factor out zapping of present pte into zap_present_pte()

2024-02-09 Thread David Hildenbrand
Let's prepare for further changes by factoring out processing of present PTEs. Signed-off-by: David Hildenbrand --- mm/memory.c | 94 ++--- 1 file changed, 53 insertions(+), 41 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index

[PATCH v2 00/10] mm/memory: optimize unmap/zap with PTE-mapped THP

2024-02-09 Thread David Hildenbrand
This series is based on [1]. Similar to what we did with fork(), let's implement PTE batching during unmap/zap when processing PTE-mapped THPs. We collect consecutive PTEs that map consecutive pages of the same large folio, making sure that the other PTE bits are compatible, and (a) adjust the

Re: [PATCH v3 4/6] bitmap: Introduce bitmap_off()

2024-02-09 Thread Jakub Kicinski
On Tue, 6 Feb 2024 15:07:14 +0100 Herve Codina wrote: > The bitmap_onto() function translates one bitmap relative to another but > no function are present to perform the reverse translation. > > Introduce bitmap_off() to fill this hole. Argh, Yury is not even CCed on this? I was about to ping

Re: [PATCH v1] spi: spi-ppc4xx: include missing platform_device.h

2024-02-09 Thread Mark Brown
On Fri, 09 Feb 2024 15:59:07 +0100, Christian Lamparter wrote: > the driver currently fails to compile on 6.8-rc3 due to: > | spi-ppc4xx.c: In function ‘spi_ppc4xx_of_probe’: > | @346:36: error: invalid use of undefined type ‘struct platform_device’ > | 346 | struct device_node *np =

Re: [PATCH v2] drivers/ps3: select VIDEO to provide cmdline functions

2024-02-09 Thread Thomas Zimmermann
Hi Am 09.02.24 um 06:15 schrieb Michael Ellerman: Thomas Zimmermann writes: Am 07.02.24 um 17:13 schrieb Randy Dunlap: When VIDEO is not set, there is a build error. Fix that by selecting VIDEO for PS3_PS3AV. ERROR: modpost: ".video_get_options" [drivers/ps3/ps3av_mod.ko] undefined! Fixes:

Re: [kvm-unit-tests PATCH v4 6/8] migration: Add quiet migration support

2024-02-09 Thread Thomas Huth
On 09/02/2024 10.11, Nicholas Piggin wrote: Console output required to support migration becomes quite noisy when doing lots of migrations. Provide a migrate_quiet() call that suppresses console output and doesn't log a message. Signed-off-by: Nicholas Piggin --- lib/migrate.c | 11

Re: [kvm-unit-tests PATCH v4 4/8] migration: Support multiple migrations

2024-02-09 Thread Thomas Huth
On 09/02/2024 10.11, Nicholas Piggin wrote: Support multiple migrations by flipping dest file/socket variables to source after the migration is complete, ready to start again. A new destination is created if the test outputs the migrate line again. Test cases may now switch to calling migrate()

Re: [PATCH v4 00/10] devm_led_classdev_register() usage problem

2024-02-09 Thread Andy Shevchenko
On Thu, Dec 14, 2023 at 08:36:04PM +0300, George Stark wrote: > This patch series fixes the problem of devm_led_classdev_register misusing. > > The basic problem is described in [1]. Shortly when > devm_led_classdev_register() > is used then led_classdev_unregister() called after driver's

Re: [PATCH v4 00/10] devm_led_classdev_register() usage problem

2024-02-09 Thread Andy Shevchenko
On Thu, Dec 21, 2023 at 03:11:11PM +, Lee Jones wrote: > On Thu, 14 Dec 2023, George Stark wrote: > > > This patch series fixes the problem of devm_led_classdev_register misusing. > > > > The basic problem is described in [1]. Shortly when > > devm_led_classdev_register() > > is used then

Re: [RFC PATCH 5/5] powerpc/smp: Remap boot CPU onto core 0 if >= nr_cpu_ids

2024-02-09 Thread Jiri Bohac
On Tue, Jan 02, 2024 at 10:16:04AM +0530, Aneesh Kumar K.V wrote: > Michael Ellerman writes: > > > > > #ifdef CONFIG_PPC64 > > int boot_cpu_hwid = -1; > > @@ -492,12 +493,26 @@ void __init smp_setup_cpu_maps(void) > > avail = !of_property_match_string(dn, > >

Re: [kvm-unit-tests PATCH v4 2/8] arch-run: Clean up initrd cleanup

2024-02-09 Thread Thomas Huth
On 09/02/2024 10.11, Nicholas Piggin wrote: Rather than put a big script into the trap handler, have it call a function. Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/arch-run.bash

[PATCH v1] spi: spi-ppc4xx: include missing platform_device.h

2024-02-09 Thread Christian Lamparter
the driver currently fails to compile on 6.8-rc3 due to: | spi-ppc4xx.c: In function ‘spi_ppc4xx_of_probe’: | @346:36: error: invalid use of undefined type ‘struct platform_device’ | 346 | struct device_node *np = op->dev.of_node; | |^~ | ... (more

[kvm-unit-tests PATCH v4 8/8] migration: add a migration selftest

2024-02-09 Thread Nicholas Piggin
Add a selftest for migration support in guest library and test harness code. It performs migrations in a tight loop to irritate races and bugs in the test harness code. Include the test in arm, s390, powerpc. Acked-by: Claudio Imbrenda (s390x) Reviewed-by: Thomas Huth Signed-off-by: Nicholas

[kvm-unit-tests PATCH v4 7/8] Add common/ directory for architecture-independent tests

2024-02-09 Thread Nicholas Piggin
x86/sieve.c is used by s390x, arm, and riscv via symbolic link. Make a new directory common/ for architecture-independent tests and move sieve.c here. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- arm/sieve.c| 2 +- common/sieve.c | 51

[kvm-unit-tests PATCH v4 6/8] migration: Add quiet migration support

2024-02-09 Thread Nicholas Piggin
Console output required to support migration becomes quite noisy when doing lots of migrations. Provide a migrate_quiet() call that suppresses console output and doesn't log a message. Signed-off-by: Nicholas Piggin --- lib/migrate.c | 11 +++ lib/migrate.h | 1 +

[kvm-unit-tests PATCH v4 5/8] arch-run: rename migration variables

2024-02-09 Thread Nicholas Piggin
Using 1 and 2 for source and destination is confusing, particularly now with multiple migrations that flip between them. Do a rename pass to 'src' and 'dst' to tidy things up. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 111

[kvm-unit-tests PATCH v4 4/8] migration: Support multiple migrations

2024-02-09 Thread Nicholas Piggin
Support multiple migrations by flipping dest file/socket variables to source after the migration is complete, ready to start again. A new destination is created if the test outputs the migrate line again. Test cases may now switch to calling migrate() one or more times. Signed-off-by: Nicholas

[kvm-unit-tests PATCH v4 3/8] migration: use a more robust way to wait for background job

2024-02-09 Thread Nicholas Piggin
Starting a pipeline of jobs in the background does not seem to have a simple way to reliably find the pid of a particular process in the pipeline (because not all processes are started when the shell continues to execute). The way PID of QEMU is derived can result in a failure waiting on a PID

[kvm-unit-tests PATCH v4 2/8] arch-run: Clean up initrd cleanup

2024-02-09 Thread Nicholas Piggin
Rather than put a big script into the trap handler, have it call a function. Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 11d47a85..c1dd67ab 100644

[kvm-unit-tests PATCH v4 1/8] arch-run: Fix TRAP handler recursion to remove temporary files properly

2024-02-09 Thread Nicholas Piggin
Migration files were not being removed when the QEMU process is interrupted (e.g., with ^C). This is becaus the SIGINT propagates to the bash TRAP handler, which recursively TRAPs due to the 'kill 0' in the handler. This eventually crashes bash. This can be observed by interrupting a long-running

[kvm-unit-tests PATCH v4 0/8] Multi-migration support

2024-02-09 Thread Nicholas Piggin
Thanks for the detailed reviews. Hopefully this is the last one... Since v3: - Addressed Thomas's review comments: - Patch 2 initrd cleanup unset the old variable in the correct place. - Patch 4 multi migration removed the extra wait for "Now migrate the VM" message, and updated comments around

Re: [PATCH v5 00/25] Transparent Contiguous PTEs for User Mappings

2024-02-09 Thread Ryan Roberts
On 08/02/2024 17:34, Mark Rutland wrote: > On Fri, Feb 02, 2024 at 08:07:31AM +, Ryan Roberts wrote: >> Hi All, > > Hi Ryan, > > I assume this is the same as your 'features/granule_perf/contpte-lkml_v' > branch > on https://gitlab.arm.com/linux-arm/linux-rr/ Yep - great detective work!

Re: [kvm-unit-tests PATCH v3 4/8] migration: Support multiple migrations

2024-02-09 Thread Thomas Huth
On 09/02/2024 09.39, Nicholas Piggin wrote: On Fri Feb 9, 2024 at 6:19 PM AEST, Thomas Huth wrote: On 09/02/2024 08.01, Nicholas Piggin wrote: Support multiple migrations by flipping dest file/socket variables to source after the migration is complete, ready to start again. A new destination

Re: [kvm-unit-tests PATCH v3 4/8] migration: Support multiple migrations

2024-02-09 Thread Nicholas Piggin
On Fri Feb 9, 2024 at 6:19 PM AEST, Thomas Huth wrote: > On 09/02/2024 08.01, Nicholas Piggin wrote: > > Support multiple migrations by flipping dest file/socket variables to > > source after the migration is complete, ready to start again. A new > > destination is created if the test outputs the

Re: [kvm-unit-tests PATCH v3 8/8] migration: add a migration selftest

2024-02-09 Thread Thomas Huth
On 09/02/2024 08.01, Nicholas Piggin wrote: Add a selftest for migration support in guest library and test harness code. It performs migrations a tight loop to irritate races and bugs in "*in* a tight loop" ? the test harness code. Include the test in arm, s390, powerpc. Acked-by: Claudio

Re: [kvm-unit-tests PATCH v3 7/8] Add common/ directory for architecture-independent tests

2024-02-09 Thread Thomas Huth
On 09/02/2024 08.01, Nicholas Piggin wrote: x86/sieve.c is used by s390x, arm, and riscv via symbolic link. Make a new directory common/ for architecture-independent tests and move sieve.c here. Signed-off-by: Nicholas Piggin --- arm/sieve.c| 2 +- common/sieve.c | 51

Re: [kvm-unit-tests PATCH v3 5/8] arch-run: rename migration variables

2024-02-09 Thread Thomas Huth
On 09/02/2024 08.01, Nicholas Piggin wrote: Using 1 and 2 for source and destination is confusing, particularly now with multiple migrations that flip between them. Do a rename pass to tidy things up. Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 115

Re: [kvm-unit-tests PATCH v3 2/8] arch-run: Clean up initrd cleanup

2024-02-09 Thread Nicholas Piggin
On Fri Feb 9, 2024 at 5:32 PM AEST, Thomas Huth wrote: > On 09/02/2024 08.01, Nicholas Piggin wrote: > > Rather than put a big script into the trap handler, have it call > > a function. > > > > Signed-off-by: Nicholas Piggin > > --- > > scripts/arch-run.bash | 13 - > > 1 file

Re: [kvm-unit-tests PATCH v3 4/8] migration: Support multiple migrations

2024-02-09 Thread Thomas Huth
On 09/02/2024 08.01, Nicholas Piggin wrote: Support multiple migrations by flipping dest file/socket variables to source after the migration is complete, ready to start again. A new destination is created if the test outputs the migrate line again. Test cases may now switch to calling migrate()

[PATCH] powerpc/ftrace: Ignore ftrace locations in exit text sections

2024-02-09 Thread Naveen N Rao
Michael reported that we are seeing ftrace bug on bootup when KASAN is enabled, and if we are using -fpatchable-function-entry: ftrace: allocating 47780 entries in 18 pages ftrace-powerpc: 0xc20b3d5c: No module provided for non-kernel address [ ftrace bug

Re: [kvm-unit-tests PATCH v3 6/8] migration: Add quiet migration support

2024-02-09 Thread Thomas Huth
On 09/02/2024 08.01, Nicholas Piggin wrote: Console output required to support migration becomes quite noisy when doing lots of migrations. Provide a migrate_quiet() call that suppresses console output and doesn't log a message. Signed-off-by: Nicholas Piggin --- lib/migrate.c | 12