Re: [PATCH 1/3] init: Declare rodata_enabled and mark_rodata_ro() at all time

2024-01-30 Thread Christophe Leroy
gt;> On Thu, Dec 21, 2023 at 10:02:46AM +0100, Christophe Leroy wrote: >>>>>> Declaring rodata_enabled and mark_rodata_ro() at all time >>>>>> helps removing related #ifdefery in C files. >>>>>> >>>>>> Signed-off-by: Christophe Leroy >

Re: [PATCH v1 9/9] mm/memory: optimize unmap/zap with PTE-mapped THP

2024-01-30 Thread Yin Fengwei
On 1/29/24 22:32, David Hildenbrand wrote: > +static inline pte_t get_and_clear_full_ptes(struct mm_struct *mm, > + unsigned long addr, pte_t *ptep, unsigned int nr, int full) > +{ > + pte_t pte, tmp_pte; > + > + pte = ptep_get_and_clear_full(mm, addr, ptep, full); > +

Re: [PATCH v2 1/4] PCI/AER: Store more information in aer_err_info

2024-01-30 Thread Kuppuswamy Sathyanarayanan
On 1/24/24 10:27 PM, Wang, Qingshun wrote: > When Advisory Non-Fatal errors are raised, both correctable and Maybe you can start with same info about what Advisory Non-FataL errors are and the specification reference. I know that you included it in cover letter. But it is good to include it in

Re: [PATCH v1 0/9] mm/memory: optimize unmap/zap with PTE-mapped THP

2024-01-30 Thread Yin Fengwei
On 1/29/24 22:32, David Hildenbrand wrote: > This series is based on [1] and must be applied on top of it. > 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

Re: [PATCH] dt-bindings: soc: fsl: narrow regex for unit address to hex numbers

2024-01-30 Thread Rob Herring
On Tue, 23 Jan 2024 09:35:05 +0100, Krzysztof Kozlowski wrote: > Regular expression used to match the unit address part should not allow > non-hex numbers. > > Signed-off-by: Krzysztof Kozlowski > --- > .../devicetree/bindings/soc/fsl/fsl,layerscape-dcfg.yaml| 2 +- >

Re: [PATCH 1/3] init: Declare rodata_enabled and mark_rodata_ro() at all time

2024-01-30 Thread Luis Chamberlain
Declaring rodata_enabled and mark_rodata_ro() at all time > >>>> helps removing related #ifdefery in C files. > >>>> > >>>> Signed-off-by: Christophe Leroy > >>> Very nice cleanup, thanks!, applied and pushed > >>> > >>>

Re: [PATCH 1/3] init: Declare rodata_enabled and mark_rodata_ro() at all time

2024-01-30 Thread Marek Szyprowski
> >>>> Signed-off-by: Christophe Leroy >>> Very nice cleanup, thanks!, applied and pushed >>> >>> Luis >> On next-20240130, which has your modules-next branch, and thus this >> series and the other "module: Use set_memory_rox()" seri

Re: [PATCH v10 6/6] arm64: introduce copy_mc_to_kernel() implementation

2024-01-30 Thread Tong Tiangen
在 2024/1/30 18:20, Mark Rutland 写道: On Mon, Jan 29, 2024 at 09:46:52PM +0800, Tong Tiangen wrote: The copy_mc_to_kernel() helper is memory copy implementation that handles source exceptions. It can be used in memory copy scenarios that tolerate hardware memory errors(e.g:

Re: [PATCH v10 5/6] arm64: support copy_mc_[user]_highpage()

2024-01-30 Thread Tong Tiangen
在 2024/1/30 18:31, Mark Rutland 写道: On Mon, Jan 29, 2024 at 09:46:51PM +0800, Tong Tiangen wrote: Currently, many scenarios that can tolerate memory errors when copying page have been supported in the kernel[1][2][3], all of which are implemented by copy_mc_[user]_highpage(). arm64 should

Re: [PATCH v10 3/6] arm64: add uaccess to machine check safe

2024-01-30 Thread Tong Tiangen
在 2024/1/30 20:01, Mark Rutland 写道: On Tue, Jan 30, 2024 at 07:14:35PM +0800, Tong Tiangen wrote: 在 2024/1/30 1:43, Mark Rutland 写道: On Mon, Jan 29, 2024 at 09:46:49PM +0800, Tong Tiangen wrote: Further, this change will also silently fixup unexpected kernel faults if we pass bad kernel

Re: [PATCH v10 2/6] arm64: add support for machine check error safe

2024-01-30 Thread Tong Tiangen
在 2024/1/30 21:07, Mark Rutland 写道: On Tue, Jan 30, 2024 at 06:57:24PM +0800, Tong Tiangen wrote: 在 2024/1/30 1:51, Mark Rutland 写道: On Mon, Jan 29, 2024 at 09:46:48PM +0800, Tong Tiangen wrote: diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 55f6455a8284..312932dc100b

Re: [PATCH v10 2/6] arm64: add support for machine check error safe

2024-01-30 Thread Mark Rutland
On Tue, Jan 30, 2024 at 06:57:24PM +0800, Tong Tiangen wrote: > 在 2024/1/30 1:51, Mark Rutland 写道: > > On Mon, Jan 29, 2024 at 09:46:48PM +0800, Tong Tiangen wrote: > > > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > > > index 55f6455a8284..312932dc100b 100644 > > > ---

Re: [PATCH v10 3/6] arm64: add uaccess to machine check safe

2024-01-30 Thread Mark Rutland
On Tue, Jan 30, 2024 at 07:14:35PM +0800, Tong Tiangen wrote: > 在 2024/1/30 1:43, Mark Rutland 写道: > > On Mon, Jan 29, 2024 at 09:46:49PM +0800, Tong Tiangen wrote: > > Further, this change will also silently fixup unexpected kernel faults if we > > pass bad kernel pointers to copy_{to,from}_user,

Re: [PATCH v10 3/6] arm64: add uaccess to machine check safe

2024-01-30 Thread Tong Tiangen
在 2024/1/30 1:43, Mark Rutland 写道: On Mon, Jan 29, 2024 at 09:46:49PM +0800, Tong Tiangen wrote: If user process access memory fails due to hardware memory error, only the relevant processes are affected, so it is more reasonable to kill the user process and isolate the corrupt page than to

Re: [PATCH 1/3] init: Declare rodata_enabled and mark_rodata_ro() at all time

2024-01-30 Thread Christophe Leroy
n wrote: >> On Thu, Dec 21, 2023 at 10:02:46AM +0100, Christophe Leroy wrote: >>> Declaring rodata_enabled and mark_rodata_ro() at all time >>> helps removing related #ifdefery in C files. >>> >>> Signed-off-by: Christophe Leroy >> >> Very nice

Re: [PATCH v10 2/6] arm64: add support for machine check error safe

2024-01-30 Thread Tong Tiangen
在 2024/1/30 1:51, Mark Rutland 写道: On Mon, Jan 29, 2024 at 09:46:48PM +0800, Tong Tiangen wrote: For the arm64 kernel, when it processes hardware memory errors for synchronize notifications(do_sea()), if the errors is consumed within the kernel, the current processing is panic. However, it

[PATCH v2 5/5] mm: ptdump: add check_wx_pages debugfs attribute

2024-01-30 Thread Christophe Leroy
Add a readable attribute in debugfs to trigger a W^X pages check at any time. To trigger the test, just read /sys/kernel/debug/check_wx_pages It will report FAILED if the test failed, SUCCESS otherwise. Detailed result is provided into dmesg. Signed-off-by: Christophe Leroy --- v2: Make it a

[PATCH v2 4/5] mm: ptdump: Have ptdump_check_wx() return bool

2024-01-30 Thread Christophe Leroy
Have ptdump_check_wx() return true when the check is successful or false otherwise. Signed-off-by: Christophe Leroy --- v2: New --- arch/arm64/mm/ptdump.c | 11 --- arch/powerpc/mm/ptdump/ptdump.c | 13 + arch/riscv/mm/ptdump.c | 11 ---

[PATCH v2 3/5] powerpc,s390: ptdump: Define ptdump_check_wx() regardless of CONFIG_DEBUG_WX

2024-01-30 Thread Christophe Leroy
Following patch will use ptdump_check_wx() regardless of CONFIG_DEBUG_WX, so define it at all times on powerpc and s390 just like other architectures. Though keep the WARN_ON_ONCE() only when CONFIG_DEBUG_WX is set. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/ptdump/ptdump.c | 7 +++

[PATCH v2 2/5] arm64, powerpc, riscv, s390, x86: ptdump: Refactor CONFIG_DEBUG_WX

2024-01-30 Thread Christophe Leroy
All architectures using the core ptdump functionality also implement CONFIG_DEBUG_WX, and they all do it more or less the same way, with a function called debug_checkwx() that is called by mark_rodata_ro(), which is a substitute to ptdump_check_wx() when CONFIG_DEBUG_WX is set and a no-op

[PATCH v2 1/5] arm: ptdump: Rename CONFIG_DEBUG_WX to CONFIG_ARM_DEBUG_WX

2024-01-30 Thread Christophe Leroy
CONFIG_DEBUG_WX is a core option defined in mm/Kconfig.debug To avoid any future conflict, rename ARM version into CONFIG_ARM_DEBUG_WX. Signed-off-by: Christophe Leroy --- v2: Fixed left-over debug_checkwx() in mark_rodata_ro() and updated defconfigs --- arch/arm/Kconfig.debug |

[PATCH v2 0/5] mm: ptdump: Refactor CONFIG_DEBUG_WX and check_wx_pages debugfs attribute

2024-01-30 Thread Christophe Leroy
Refer old discussion at https://lore.kernel.org/lkml/20200422152656.GF676@willie-the-truck/T/#m802eaf33efd6f8d575939d157301b35ac0d4a64f And https://github.com/KSPP/linux/issues/35 This series refactors CONFIG_DEBUG_WX for the 5 architectures implementing CONFIG_GENERIC_PTDUMP First rename stuff

Re: [PATCH v10 5/6] arm64: support copy_mc_[user]_highpage()

2024-01-30 Thread Mark Rutland
On Mon, Jan 29, 2024 at 09:46:51PM +0800, Tong Tiangen wrote: > Currently, many scenarios that can tolerate memory errors when copying page > have been supported in the kernel[1][2][3], all of which are implemented by > copy_mc_[user]_highpage(). arm64 should also support this mechanism. > > Due

Re: [PATCH v10 6/6] arm64: introduce copy_mc_to_kernel() implementation

2024-01-30 Thread Mark Rutland
On Mon, Jan 29, 2024 at 09:46:52PM +0800, Tong Tiangen wrote: > The copy_mc_to_kernel() helper is memory copy implementation that handles > source exceptions. It can be used in memory copy scenarios that tolerate > hardware memory errors(e.g: pmem_read/dax_copy_to_iter). > > Currnently, only x86

Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y

2024-01-30 Thread Jan Stancek
On Tue, Nov 21, 2023 at 10:51:34AM +1000, Nicholas Piggin wrote: On Tue Nov 21, 2023 at 9:23 AM AEST, Masahiro Yamada wrote: crtsavres.o is linked to modules. However, as explained in commit d0e628cd817f ("kbuild: doc: clarify the difference between extra-y and always-y"), 'make modules' does

Re: [PATCH v1 9/9] mm/memory: optimize unmap/zap with PTE-mapped THP

2024-01-30 Thread Ryan Roberts
On 29/01/2024 14:32, David Hildenbrand wrote: > 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

Re: [PATCH v1 8/9] mm/mmu_gather: add tlb_remove_tlb_entries()

2024-01-30 Thread Ryan Roberts
On 29/01/2024 14:32, David Hildenbrand wrote: > 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

Re: [PATCH v1 7/9] mm/mmu_gather: add __tlb_remove_folio_pages()

2024-01-30 Thread David Hildenbrand
On 30.01.24 10:21, Ryan Roberts wrote: On 29/01/2024 14:32, David Hildenbrand wrote: 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

Re: [PATCH v1 7/9] mm/mmu_gather: add __tlb_remove_folio_pages()

2024-01-30 Thread Ryan Roberts
On 29/01/2024 14:32, David Hildenbrand wrote: > 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

Re: [PATCH 1/3] init: Declare rodata_enabled and mark_rodata_ro() at all time

2024-01-30 Thread Chen-Yu Tsai
ed-off-by: Christophe Leroy > > Very nice cleanup, thanks!, applied and pushed > > Luis On next-20240130, which has your modules-next branch, and thus this series and the other "module: Use set_memory_rox()" series applied, my kernel crashes in some very weird way. Reverting yo

Re: [PATCH v1 9/9] mm/memory: optimize unmap/zap with PTE-mapped THP

2024-01-30 Thread David Hildenbrand
Re-reading the docs myself: +#ifndef get_and_clear_full_ptes +/** + * get_and_clear_full_ptes - Clear PTEs that map consecutive pages of the same + * folio, collecting dirty/accessed bits. + * @mm: Address space the pages are mapped into. + * @addr: Address the first

Re: [PATCH v1 6/9] mm/mmu_gather: define ENCODED_PAGE_FLAG_DELAY_RMAP

2024-01-30 Thread Ryan Roberts
On 29/01/2024 14:32, David Hildenbrand wrote: > 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

Re: [PATCH v1 1/9] mm/memory: factor out zapping of present pte into zap_present_pte()

2024-01-30 Thread David Hildenbrand
On 30.01.24 09:46, Ryan Roberts wrote: On 30/01/2024 08:41, David Hildenbrand wrote: On 30.01.24 09:13, Ryan Roberts wrote: On 29/01/2024 14:32, David Hildenbrand wrote: Let's prepare for further changes by factoring out processing of present PTEs. Signed-off-by: David Hildenbrand ---  

Re: [PATCH v1 4/9] mm/memory: factor out zapping folio pte into zap_present_folio_pte()

2024-01-30 Thread Ryan Roberts
On 29/01/2024 14:32, David Hildenbrand wrote: > Let's prepare for further changes by factoring it out into a separate > function. > > Signed-off-by: David Hildenbrand Reviewed-by: Ryan Roberts > --- > mm/memory.c | 53 - > 1 file changed,

Re: [PATCH v1 3/9] mm/memory: further separate anon and pagecache folio handling in zap_present_pte()

2024-01-30 Thread David Hildenbrand
On 30.01.24 09:45, Ryan Roberts wrote: On 30/01/2024 08:37, David Hildenbrand wrote: On 30.01.24 09:31, Ryan Roberts wrote: On 29/01/2024 14:32, David Hildenbrand wrote: We don't need up-to-date accessed-dirty information for anon folios and can simply work with the ptent we already have.

Re: [PATCH v1 1/9] mm/memory: factor out zapping of present pte into zap_present_pte()

2024-01-30 Thread Ryan Roberts
On 30/01/2024 08:41, David Hildenbrand wrote: > On 30.01.24 09:13, Ryan Roberts wrote: >> On 29/01/2024 14:32, David Hildenbrand wrote: >>> Let's prepare for further changes by factoring out processing of present >>> PTEs. >>> >>> Signed-off-by: David Hildenbrand >>> --- >>>   mm/memory.c | 92

Re: [PATCH v1 3/9] mm/memory: further separate anon and pagecache folio handling in zap_present_pte()

2024-01-30 Thread Ryan Roberts
On 30/01/2024 08:37, David Hildenbrand wrote: > On 30.01.24 09:31, Ryan Roberts wrote: >> On 29/01/2024 14:32, David Hildenbrand wrote: >>> 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 >>>

Re: [PATCH v1 5/9] mm/mmu_gather: pass "delay_rmap" instead of encoded page to __tlb_remove_page_size()

2024-01-30 Thread Ryan Roberts
On 29/01/2024 14:32, David Hildenbrand wrote: > 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

Re: [PATCH v1 1/9] mm/memory: factor out zapping of present pte into zap_present_pte()

2024-01-30 Thread David Hildenbrand
On 30.01.24 09:13, Ryan Roberts wrote: On 29/01/2024 14:32, David Hildenbrand wrote: Let's prepare for further changes by factoring out processing of present PTEs. Signed-off-by: David Hildenbrand --- mm/memory.c | 92 ++--- 1 file changed,

[PATCH v2 6/6] net: wan: fsl_qmc_hdlc: Add framer support

2024-01-30 Thread Herve Codina
Add framer support in the fsl_qmc_hdlc driver in order to be able to signal carrier changes to the network stack based on the framer status Also use this framer to provide information related to the E1/T1 line interface on IF_GET_IFACE and configure the line interface according to IF_IFACE_{E1,T1}

[PATCH v2 0/6] Add support for QMC HDLC

2024-01-30 Thread Herve Codina
Hi, This series introduces the QMC HDLC support. Patches were previously sent as part of a full feature series and were previously reviewed in that context: "Add support for QMC HDLC, framer infrastructure and PEF2256 framer" [1] In order to ease the merge, the full feature series has been

[PATCH v2 5/6] net: wan: fsl_qmc_hdlc: Add runtime timeslots changes support

2024-01-30 Thread Herve Codina
QMC channels support runtime timeslots changes but nothing is done at the QMC HDLC driver to handle these changes. Use existing IFACE ioctl in order to configure the timeslots to use. Signed-off-by: Herve Codina Reviewed-by: Christophe Leroy Acked-by: Jakub Kicinski ---

[PATCH v2 2/6] MAINTAINERS: Add the Freescale QMC HDLC driver entry

2024-01-30 Thread Herve Codina
After contributing the driver, add myself as the maintainer for the Freescale QMC HDLC driver. Signed-off-by: Herve Codina --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 8d1052fa6a69..15cd3a8e5866 100644 --- a/MAINTAINERS +++

[PATCH v2 3/6] bitmap: Make bitmap_onto() available to users

2024-01-30 Thread Herve Codina
Currently the bitmap_onto() is available only for CONFIG_NUMA=y case, while some users may benefit out of it and being independent to NUMA code. Make it available to users by moving out of ifdeffery and exporting for modules. Signed-off-by: Herve Codina --- lib/bitmap.c | 3 ++- 1 file

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

2024-01-30 Thread Herve Codina
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. Signed-off-by: Herve Codina --- include/linux/bitmap.h | 3 +++ lib/bitmap.c | 42

[PATCH v2 1/6] net: wan: Add support for QMC HDLC

2024-01-30 Thread Herve Codina
The QMC HDLC driver provides support for HDLC using the QMC (QUICC Multichannel Controller) to transfer the HDLC data. Signed-off-by: Herve Codina Reviewed-by: Christophe Leroy Acked-by: Jakub Kicinski --- drivers/net/wan/Kconfig| 12 + drivers/net/wan/Makefile | 1 +

Re: [PATCH v1 3/9] mm/memory: further separate anon and pagecache folio handling in zap_present_pte()

2024-01-30 Thread David Hildenbrand
On 30.01.24 09:31, Ryan Roberts wrote: On 29/01/2024 14:32, David Hildenbrand wrote: 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

Re: [PATCH v1 3/9] mm/memory: further separate anon and pagecache folio handling in zap_present_pte()

2024-01-30 Thread Ryan Roberts
On 29/01/2024 14:32, David Hildenbrand wrote: > 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() + >

Re: [PATCH v1 2/9] mm/memory: handle !page case in zap_present_pte() separately

2024-01-30 Thread Ryan Roberts
On 29/01/2024 14:32, David Hildenbrand wrote: > 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

Re: [PATCH v1 1/9] mm/memory: factor out zapping of present pte into zap_present_pte()

2024-01-30 Thread Ryan Roberts
On 29/01/2024 14:32, David Hildenbrand wrote: > Let's prepare for further changes by factoring out processing of present > PTEs. > > Signed-off-by: David Hildenbrand > --- > mm/memory.c | 92 ++--- > 1 file changed, 52 insertions(+), 40