Re: [PATCH 3/3] mm, arch: add generic implementation of pfn_valid() for FLATMEM

2023-01-25 Thread Arnd Bergmann
On Wed, Jan 25, 2023, at 20:07, Mike Rapoport wrote: > From: "Mike Rapoport (IBM)" > > Every architecture that supports FLATMEM memory model defines its own > version of pfn_valid() that essentially compares a pfn to max_mapnr. > > Use mips/powerpc version implemented as static inline as a generic

Re: [PATCH] powerpc/kasan/book3s_64: warn when running with hash MMU

2023-01-25 Thread Christophe Leroy
Le 11/10/2022 à 12:25, Christophe Leroy a écrit : Le 11/10/2022 à 12:00, Michael Ellerman a écrit : Nathan Lynch writes: Michael Ellerman writes: Christophe Leroy writes: + KASAN list Le 06/10/2022 à 06:10, Michael Ellerman a écrit : Nathan Lynch writes: kasan is known to crash at

[PATCH] kasan: Fix Oops due to missing calls to kasan_arch_is_ready()

2023-01-25 Thread Christophe Leroy
On powerpc64, you can build a kernel with KASAN as soon as you build it with RADIX MMU support. However if the CPU doesn't have RADIX MMU, KASAN isn't enabled at init and the following Oops is encountered. [0.00][T0] KASAN not enabled as it requires radix! [4.484295][ T26] B

Re: [PATCH] powerpc/vdso: Filter clang's auto var init zero enabler when linking

2023-01-25 Thread Masahiro Yamada
On Wed, Jan 25, 2023 at 1:20 AM Nathan Chancellor wrote: > > After commit 7bbf02b875b5 ("kbuild: Stop using '-Qunused-arguments' with > clang"), the PowerPC vDSO shows the following error with clang-13 and > older when CONFIG_INIT_STACK_ALL_ZERO is enabled: > > clang: error: argument unused duri

Re: [PATCH v2 05/14] powerpc: Remove linker flag from KBUILD_AFLAGS

2023-01-25 Thread Masahiro Yamada
On Thu, Jan 26, 2023 at 11:07 AM Nathan Chancellor wrote: > > On Thu, Jan 26, 2023 at 10:29:54AM +0900, Masahiro Yamada wrote: > > On Wed, Jan 25, 2023 at 1:11 PM Michael Ellerman > > wrote: > > > > > > Nathan Chancellor writes: > > > > When clang's -Qunused-arguments is dropped from KBUILD_CPP

Re: [PATCH v2 05/14] powerpc: Remove linker flag from KBUILD_AFLAGS

2023-01-25 Thread Nathan Chancellor
On Thu, Jan 26, 2023 at 10:29:54AM +0900, Masahiro Yamada wrote: > On Wed, Jan 25, 2023 at 1:11 PM Michael Ellerman wrote: > > > > Nathan Chancellor writes: > > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it > > > points out that KBUILD_AFLAGS contains a linker flag, which

Re: [PATCH 3/3] mm, arch: add generic implementation of pfn_valid() for FLATMEM

2023-01-25 Thread Andrew Morton
On Wed, 25 Jan 2023 21:07:57 +0200 Mike Rapoport wrote: > Every architecture that supports FLATMEM memory model defines its own > version of pfn_valid() that essentially compares a pfn to max_mapnr. > > Use mips/powerpc version implemented as static inline as a generic > implementation of pfn_va

Re: [PATCH v3 1/7] kernel/fork: convert vma assignment to a memcpy

2023-01-25 Thread Andrew Morton
On Wed, 25 Jan 2023 16:50:01 -0800 Suren Baghdasaryan wrote: > On Wed, Jan 25, 2023 at 4:22 PM Andrew Morton > wrote: > > > > On Wed, 25 Jan 2023 15:35:48 -0800 Suren Baghdasaryan > > wrote: > > > > > Convert vma assignment in vm_area_dup() to a memcpy() to prevent compiler > > > errors when

Re: [PATCH v2 05/14] powerpc: Remove linker flag from KBUILD_AFLAGS

2023-01-25 Thread Masahiro Yamada
On Wed, Jan 25, 2023 at 1:11 PM Michael Ellerman wrote: > > Nathan Chancellor writes: > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it > > points out that KBUILD_AFLAGS contains a linker flag, which will be > > used: > > Should that say "unused" ? Nathan, shall I fix it

[PATCH v4 12/12] perf pmu-events: Fix testing with JEVENTS_ARCH=all

2023-01-25 Thread Ian Rogers
The #slots literal will return NAN when not on ARM64 which causes a perf test failure when not on an ARM64 for a JEVENTS_ARCH=all build: .. 10.4: Parsing of PMU event table metrics with fake PMUs : FAILED! .. Add an is_test boolean so that the failure can be avoided when running as a t

[PATCH v4 11/12] perf jevents: Add model list option

2023-01-25 Thread Ian Rogers
This allows the set of generated jevents events and metrics be limited to a subset of the model names. Appropriate if trying to minimize the binary size where only a set of models are possible. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/Build | 3 ++- tools/perf/pmu-events/jevents

[PATCH v4 10/12] perf jevents: Generate metrics and events as separate tables

2023-01-25 Thread Ian Rogers
Turn a perf json event into an event, metric or both. This reduces the number of events needed to scan to find an event or metric. As events no longer need the relatively seldom used metric fields, 4 bytes is saved per event. This reduces the big C string's size by 335kb (14.8%) on x86. Note, for

[PATCH v4 09/12] perf pmu-events: Introduce pmu_metrics_table

2023-01-25 Thread Ian Rogers
Add a metrics table that is just a cast from pmu_events_table. This changes the APIs so that event and metric usage of the underlying table is different. For the no jevents case the tables are already separate, later changes will separate the tables for the jevents case. Signed-off-by: Ian Rogers

[PATCH v4 08/12] perf jevents: Combine table prefix and suffix writing

2023-01-25 Thread Ian Rogers
Combine into a single function to simplify, in a later change, writing metrics separately. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/jevents.py | 36 +--- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/tools/perf/pmu-events/jevents.py b/tool

[PATCH v4 07/12] perf stat: Remove evsel metric_name/expr

2023-01-25 Thread Ian Rogers
Metrics are their own unit and these variables held broken metrics previously and now just hold the value NULL. Remove code that used these variables. Reviewed-by: John Garry Signed-off-by: Ian Rogers --- tools/perf/builtin-stat.c | 1 - tools/perf/util/cgroup.c | 1 - tools/perf/u

[PATCH v4 06/12] perf pmu-events: Remove now unused event and metric variables

2023-01-25 Thread Ian Rogers
Previous changes separated the uses of pmu_event and pmu_metric, however, both structures contained all the variables of event and metric. This change removes the event variables from metric and the metric variables from event. Note, this change removes the setting of evsel's metric_name/expr as t

[PATCH v4 05/12] perf pmu-events: Separate the metrics from events for no jevents

2023-01-25 Thread Ian Rogers
Separate the event and metric table when building without jevents. Add find_core_metrics_table and perf_pmu__find_metrics_table while renaming existing utilities to be event specific, so that users can find the right table for their need. Reviewed-by: John Garry Signed-off-by: Ian Rogers --- to

[PATCH v4 04/12] perf pmu-events: Add separate metric from pmu_event

2023-01-25 Thread Ian Rogers
Create a new pmu_metric for the metric related variables from pmu_event but that is initially just a clone of pmu_event. Add iterators for pmu_metric and use in places that metrics are desired rather than events. Make the event iterator skip metric only events, and the metric iterator skip event on

[PATCH v4 03/12] perf jevents: Rewrite metrics in the same file with each other

2023-01-25 Thread Ian Rogers
Rewrite metrics within the same file in terms of each other. For example, on Power8 other_stall_cpi is rewritten from: "PM_CMPLU_STALL / PM_RUN_INST_CMPL - PM_CMPLU_STALL_BRU_CRU / PM_RUN_INST_CMPL - PM_CMPLU_STALL_FXU / PM_RUN_INST_CMPL - PM_CMPLU_STALL_VSU / PM_RUN_INST_CMPL - PM_CMPLU_STALL_L

[PATCH v4 02/12] perf jevents metric: Add ability to rewrite metrics in terms of others

2023-01-25 Thread Ian Rogers
Add RewriteMetricsInTermsOfOthers that iterates over pairs of names and expressions trying to replace an expression, within the current expression, with its name. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/metric.py | 73 +++- tools/perf/pmu-events/metric_te

[PATCH v4 01/12] perf jevents metric: Correct Function equality

2023-01-25 Thread Ian Rogers
rhs may not be defined, say for source_count, so add a guard. Reviewed-by: Kajol Jain Signed-off-by: Ian Rogers --- tools/perf/pmu-events/metric.py | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py index 47

[PATCH v4 00/12] jevents/pmu-events improvements

2023-01-25 Thread Ian Rogers
Add an optimization to jevents using the metric code, rewrite metrics in terms of each other in order to minimize size and improve readability. For example, on Power8 other_stall_cpi is rewritten from: "PM_CMPLU_STALL / PM_RUN_INST_CMPL - PM_CMPLU_STALL_BRU_CRU / PM_RUN_INST_CMPL - PM_CMPLU_STALL_

Re: [PATCH v3 2/7] mm: introduce vma->vm_flags wrapper functions

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 4:28 PM Andrew Morton wrote: > > On Wed, 25 Jan 2023 15:35:49 -0800 Suren Baghdasaryan > wrote: > > > --- a/include/linux/mm_types.h > > +++ b/include/linux/mm_types.h > > @@ -491,7 +491,15 @@ struct vm_area_struct { > >* See vmf_insert_mixed_prot() for discussion

Re: [PATCH v3 2/7] mm: introduce vma->vm_flags wrapper functions

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 4:24 PM Andrew Morton wrote: > > On Wed, 25 Jan 2023 15:35:49 -0800 Suren Baghdasaryan > wrote: > > > vm_flags are among VMA attributes which affect decisions like VMA merging > > and splitting. Therefore all vm_flags modifications are performed after > > taking exclusive

Re: [PATCH v3 1/7] kernel/fork: convert vma assignment to a memcpy

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 4:22 PM Andrew Morton wrote: > > On Wed, 25 Jan 2023 15:35:48 -0800 Suren Baghdasaryan > wrote: > > > Convert vma assignment in vm_area_dup() to a memcpy() to prevent compiler > > errors when we add a const modifier to vma->vm_flags. > > > > ... > > > > --- a/kernel/fork.

Re: [PATCH v3 2/7] mm: introduce vma->vm_flags wrapper functions

2023-01-25 Thread Andrew Morton
On Wed, 25 Jan 2023 15:35:49 -0800 Suren Baghdasaryan wrote: > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -491,7 +491,15 @@ struct vm_area_struct { >* See vmf_insert_mixed_prot() for discussion. >*/ > pgprot_t vm_page_prot; > - unsigned long vm_

Re: [PATCH v3 2/7] mm: introduce vma->vm_flags wrapper functions

2023-01-25 Thread Andrew Morton
On Wed, 25 Jan 2023 15:35:49 -0800 Suren Baghdasaryan wrote: > vm_flags are among VMA attributes which affect decisions like VMA merging > and splitting. Therefore all vm_flags modifications are performed after > taking exclusive mmap_lock to prevent vm_flags updates racing with such > operations

Re: [PATCH v3 1/7] kernel/fork: convert vma assignment to a memcpy

2023-01-25 Thread Andrew Morton
On Wed, 25 Jan 2023 15:35:48 -0800 Suren Baghdasaryan wrote: > Convert vma assignment in vm_area_dup() to a memcpy() to prevent compiler > errors when we add a const modifier to vma->vm_flags. > > ... > > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -482,7 +482,7 @@ struct vm_area_struct *vm_a

Re: [PATCH v9 08/10] arm64: dts: ls1088a: Add serdes bindings

2023-01-25 Thread Shawn Guo
On Thu, Dec 29, 2022 at 07:01:37PM -0500, Sean Anderson wrote: > This adds bindings for the SerDes devices. They are disabled by default > to prevent any breakage on existing boards. > > Signed-off-by: Sean Anderson > --- > > (no changes since v4) > > Changes in v4: > - Convert to new bindings

Re: [PATCH v9 06/10] arm64: dts: ls1046a: Add serdes bindings

2023-01-25 Thread Shawn Guo
On Thu, Dec 29, 2022 at 07:01:35PM -0500, Sean Anderson wrote: > This adds bindings for the SerDes devices. They are disabled by default s/bindings/descriptions? The term "bindings" generally means the schema/doc in Documentation/devicetree/bindings/. Shawn > to prevent any breakage on existing

Re: [PATCH v9 07/10] arm64: dts: ls1046ardb: Add serdes bindings

2023-01-25 Thread Shawn Guo
On Thu, Dec 29, 2022 at 07:01:36PM -0500, Sean Anderson wrote: > This adds appropriate bindings for the macs which use the SerDes. The > 156.25MHz fixed clock is a crystal. The 100MHz clocks (there are > actually 3) come from a Renesas 6V49205B at address 69 on i2c0. There is > no driver for this d

[PATCH v3 7/7] mm: export dump_mm()

2023-01-25 Thread Suren Baghdasaryan
mmap_assert_write_locked() is used in vm_flags modifiers. Because mmap_assert_write_locked() uses dump_mm() and vm_flags are sometimes modified from inside a module, it's necessary to export dump_mm() function. Signed-off-by: Suren Baghdasaryan Acked-by: Michal Hocko --- mm/debug.c | 1 + 1 fil

[PATCH v3 6/7] mm: introduce mod_vm_flags_nolock and use it in untrack_pfn

2023-01-25 Thread Suren Baghdasaryan
In cases when VMA flags are modified after VMA was isolated and mmap_lock was downgraded, flags modifications would result in an assertion because mmap write lock is not held. Introduce mod_vm_flags_nolock to be used in such situation, when VMA is not part of VMA tree and locking it is not required

[PATCH v3 5/7] mm: replace vma->vm_flags indirect modification in ksm_madvise

2023-01-25 Thread Suren Baghdasaryan
Replace indirect modifications to vma->vm_flags with calls to modifier functions to be able to track flag changes and to keep vma locking correctness. Signed-off-by: Suren Baghdasaryan Acked-by: Michal Hocko --- arch/powerpc/kvm/book3s_hv_uvmem.c | 5 - arch/s390/mm/gmap.c|

[PATCH v3 4/7] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-25 Thread Suren Baghdasaryan
Replace direct modifications to vma->vm_flags with calls to modifier functions to be able to track flag changes and to keep vma locking correctness. Signed-off-by: Suren Baghdasaryan Acked-by: Michal Hocko --- arch/arm/kernel/process.c | 2 +- arch/ia64/mm/init.c

[PATCH v3 3/7] mm: replace VM_LOCKED_CLEAR_MASK with VM_LOCKED_MASK

2023-01-25 Thread Suren Baghdasaryan
To simplify the usage of VM_LOCKED_CLEAR_MASK in clear_vm_flags(), replace it with VM_LOCKED_MASK bitmask and convert all users. Signed-off-by: Suren Baghdasaryan Acked-by: Michal Hocko --- include/linux/mm.h | 4 ++-- kernel/fork.c | 2 +- mm/hugetlb.c | 4 ++-- mm/mlock.c |

[PATCH v3 2/7] mm: introduce vma->vm_flags wrapper functions

2023-01-25 Thread Suren Baghdasaryan
vm_flags are among VMA attributes which affect decisions like VMA merging and splitting. Therefore all vm_flags modifications are performed after taking exclusive mmap_lock to prevent vm_flags updates racing with such operations. Introduce modifier functions for vm_flags to be used whenever flags a

[PATCH v3 1/7] kernel/fork: convert vma assignment to a memcpy

2023-01-25 Thread Suren Baghdasaryan
Convert vma assignment in vm_area_dup() to a memcpy() to prevent compiler errors when we add a const modifier to vma->vm_flags. Signed-off-by: Suren Baghdasaryan --- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/fork.c b/kernel/fork.c index 6683c1b0f460

[PATCH v3 0/7] introduce vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
This patchset was originally published as a part of per-VMA locking [1] and was split after suggestion that it's viable on its own and to facilitate the review process. It is now a preprequisite for the next version of per-VMA lock patchset, which reuses vm_flags modifier functions to lock the VMA

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 10:33 AM Matthew Wilcox wrote: > > On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > > +/* Use when VMA is not part of the VMA tree and needs no locking */ > > +static inline void init_vm_flags(struct vm_area_struct *vma, > > +

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 10:37 AM Matthew Wilcox wrote: > > On Wed, Jan 25, 2023 at 08:49:50AM -0800, Suren Baghdasaryan wrote: > > On Wed, Jan 25, 2023 at 1:10 AM Peter Zijlstra wrote: > > > > + /* > > > > + * Flags, see mm.h. > > > > + * WARNING! Do not modify directly. > > > > +

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Matthew Wilcox
On Wed, Jan 25, 2023 at 08:49:50AM -0800, Suren Baghdasaryan wrote: > On Wed, Jan 25, 2023 at 1:10 AM Peter Zijlstra wrote: > > > + /* > > > + * Flags, see mm.h. > > > + * WARNING! Do not modify directly. > > > + * Use {init|reset|set|clear|mod}_vm_flags() functions instead. > >

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Matthew Wilcox
On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > +/* Use when VMA is not part of the VMA tree and needs no locking */ > +static inline void init_vm_flags(struct vm_area_struct *vma, > + unsigned long flags) > +{ > + vma->vm_flags = flags; vm_fl

Re: [PATCH v2 4/6] mm: replace vma->vm_flags indirect modification in ksm_madvise

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 9:08 AM Michal Hocko wrote: > > On Wed 25-01-23 08:57:48, Suren Baghdasaryan wrote: > > On Wed, Jan 25, 2023 at 1:38 AM 'Michal Hocko' via kernel-team > > wrote: > > > > > > On Wed 25-01-23 00:38:49, Suren Baghdasaryan wrote: > > > > Replace indirect modifications to vma->

Re: [PATCH v2 4/6] mm: replace vma->vm_flags indirect modification in ksm_madvise

2023-01-25 Thread Michal Hocko
On Wed 25-01-23 08:57:48, Suren Baghdasaryan wrote: > On Wed, Jan 25, 2023 at 1:38 AM 'Michal Hocko' via kernel-team > wrote: > > > > On Wed 25-01-23 00:38:49, Suren Baghdasaryan wrote: > > > Replace indirect modifications to vma->vm_flags with calls to modifier > > > functions to be able to track

Re: [PATCH v2 5/6] mm: introduce mod_vm_flags_nolock and use it in untrack_pfn

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 1:42 AM Michal Hocko wrote: > > On Wed 25-01-23 00:38:50, Suren Baghdasaryan wrote: > > In cases when VMA flags are modified after VMA was isolated and mmap_lock > > was downgraded, flags modifications would result in an assertion because > > mmap write lock is not held. >

Re: [PATCH v2 4/6] mm: replace vma->vm_flags indirect modification in ksm_madvise

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 1:38 AM 'Michal Hocko' via kernel-team wrote: > > On Wed 25-01-23 00:38:49, Suren Baghdasaryan wrote: > > Replace indirect modifications to vma->vm_flags with calls to modifier > > functions to be able to track flag changes and to keep vma locking > > correctness. Add a BUG

Re: [PATCH v2 3/6] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 1:30 AM 'Michal Hocko' via kernel-team wrote: > > On Wed 25-01-23 00:38:48, Suren Baghdasaryan wrote: > > Replace direct modifications to vma->vm_flags with calls to modifier > > functions to be able to track flag changes and to keep vma locking > > correctness. > > Is this

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
On Wed, Jan 25, 2023 at 1:10 AM Peter Zijlstra wrote: > > On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > > index 2d6d790d9bed..6c7c70bf50dd 100644 > > --- a/include/linux/mm_types.h > > +++ b/include/linu

[PATCH 3/3] mm, arch: add generic implementation of pfn_valid() for FLATMEM

2023-01-25 Thread Mike Rapoport
From: "Mike Rapoport (IBM)" Every architecture that supports FLATMEM memory model defines its own version of pfn_valid() that essentially compares a pfn to max_mapnr. Use mips/powerpc version implemented as static inline as a generic implementation of pfn_valid() and drop its per-architecture de

[PATCH 2/3] mips: drop definition of pfn_valid() for DISCONTIGMEM

2023-01-25 Thread Mike Rapoport
From: "Mike Rapoport (IBM)" There is stale definition of pfn_valid() for DISCONTINGMEM memory model guarded !FLATMEM && !SPARSEMEM && NUMA ifdefery. Remove everything but definition of pfn_valid() for FLATMEM. Signed-off-by: Mike Rapoport (IBM) --- arch/mips/include/asm/page.h | 15 --

[PATCH 1/3] m68k: use asm-generic/memory_model.h for both MMU and !MMU

2023-01-25 Thread Mike Rapoport
From: "Mike Rapoport (IBM)" The MMU variant uses generic definitions of page_to_pfn() and pfn_to_page(), but !MMU defines them in include/asm/page_no.h for no good reason. Include asm-generic/memory_model.h in the common include/asm/page.h and drop redundant definitions. Signed-off-by: Mike Rap

[PATCH 0/3] mm, arch: add generic implementation of pfn_valid() for FLATMEM

2023-01-25 Thread Mike Rapoport
From: "Mike Rapoport (IBM)" Hi, Every architecture that supports FLATMEM memory model defines its own version of pfn_valid() that essentially compares a pfn to max_mapnr. Use mips/powerpc version implemented as static inline as a generic implementation of pfn_valid() and drop its per-architectu

Re: [PATCH 2/2] powerpc/module_64: Fix "expected nop" error on module re-patching

2023-01-25 Thread Song Liu
On Wed, Jan 25, 2023 at 10:53 AM Josh Poimboeuf wrote: > > On Wed, Jan 25, 2023 at 09:36:02AM -0800, Song Liu wrote: > > On Wed, Jan 25, 2023 at 8:46 AM Josh Poimboeuf wrote: > > > > > > On Tue, Jan 24, 2023 at 10:09:56PM -0800, Song Liu wrote: > > > > > @@ -514,9 +515,18 @@ static int restore_r2

Re: [PATCH 2/2] powerpc/module_64: Fix "expected nop" error on module re-patching

2023-01-25 Thread Josh Poimboeuf
On Wed, Jan 25, 2023 at 09:36:02AM -0800, Song Liu wrote: > On Wed, Jan 25, 2023 at 8:46 AM Josh Poimboeuf wrote: > > > > On Tue, Jan 24, 2023 at 10:09:56PM -0800, Song Liu wrote: > > > > @@ -514,9 +515,18 @@ static int restore_r2(const char *name, u32 > > > > *instruction, struct module *me) > >

Re: [PATCH 2/2] powerpc/module_64: Fix "expected nop" error on module re-patching

2023-01-25 Thread Song Liu
On Wed, Jan 25, 2023 at 8:46 AM Josh Poimboeuf wrote: > > On Tue, Jan 24, 2023 at 10:09:56PM -0800, Song Liu wrote: > > > @@ -514,9 +515,18 @@ static int restore_r2(const char *name, u32 > > > *instruction, struct module *me) > > > if (!instr_is_relative_link_branch(ppc_inst(*prev_insn)))

Re: [PATCH v3 11/11] perf jevents: Add model list option

2023-01-25 Thread John Garry
On 24/01/2023 06:33, Ian Rogers wrote: This allows the set of generated jevents events and metrics be limited to a subset of the model names. Appropriate if trying to minimize the binary size where only a set of models are possible. On ARM64 the --model selects the implementor rather than model.

Re: [PATCH v3 06/11] perf pmu-events: Remove now unused event and metric variables

2023-01-25 Thread John Garry
On 24/01/2023 06:33, Ian Rogers wrote: Previous changes separated the uses of pmu_event and pmu_metric, however, both structures contained all the variables of event and metric. This change removes the event variables from metric and the metric variables from event. Note, this change removes the

Re: [PATCH 2/2] powerpc/module_64: Fix "expected nop" error on module re-patching

2023-01-25 Thread Josh Poimboeuf
On Tue, Jan 24, 2023 at 10:09:56PM -0800, Song Liu wrote: > > @@ -514,9 +515,18 @@ static int restore_r2(const char *name, u32 > > *instruction, struct module *me) > > if (!instr_is_relative_link_branch(ppc_inst(*prev_insn))) > > return 0; > > > > - if (*instruction !

Re: [PATCH] tools/perf: Disable perf probe when libtraceevent is missing

2023-01-25 Thread Athira Rajeev
> On 20-Jan-2023, at 7:58 PM, Arnaldo Carvalho de Melo wrote: > > Em Fri, Jan 20, 2023 at 05:32:56PM +0530, Athira Rajeev escreveu: >> While parsing the tracepoint events in parse_events_add_tracepoint() >> function, code checks for HAVE_LIBTRACEEVENT support. This is needed >> since libtracee

Re: [RFC 0/3] Asynchronous EEH recovery

2023-01-25 Thread Christophe Leroy
Hi, Le 15/09/2022 à 12:15, Ganesh a écrit : > On 9/2/22 05:49, Jason Gunthorpe wrote: > >> On Tue, Aug 16, 2022 at 08:57:13AM +0530, Ganesh Goudar wrote: >>> Hi, >>> >>> EEH reocvery is currently serialized and these patches shorten >>> the time taken for EEH recovery by making the recovery to ru

Re: [PATCH 2/2] powerpc/module_64: Fix "expected nop" error on module re-patching

2023-01-25 Thread Petr Mladek
On Tue 2023-01-24 19:38:05, Josh Poimboeuf wrote: > When a module with a livepatched function is unloaded and then reloaded, > klp attempts to dynamically re-patch it. On ppc64, that fails with the > following error: > > module_64: livepatch_nfsd: Expected nop after call, got e8410018 at > e_s

Re: [PATCH 1/2] powerpc/module_64: Improve restore_r2() return semantics

2023-01-25 Thread Petr Mladek
On Tue 2023-01-24 19:38:04, Josh Poimboeuf wrote: > restore_r2() returns 1 on success, which is surprising for a non-boolean > function. Change it to return 0 on success and -errno on error to match > kernel coding convention. > > Signed-off-by: Josh Poimboeuf Looks good: Reviewed-by: Petr Mla

Re: [PATCH v4 02/24] powerpc/pseries: Fix alignment of PLPKS structures and buffers

2023-01-25 Thread Michael Ellerman
Andrew Donnellan writes: > A number of structures and buffers passed to PKS hcalls have alignment > requirements, which could on occasion cause problems: > > - Authorisation structures must be 16-byte aligned and must not cross a > page boundary > > - Label structures must not cross page boundar

Re: [PATCH v2 6/6] mm: export dump_mm()

2023-01-25 Thread Michal Hocko
On Wed 25-01-23 00:38:51, Suren Baghdasaryan wrote: > mmap_assert_write_locked() is used in vm_flags modifiers. Because > mmap_assert_write_locked() uses dump_mm() and vm_flags are sometimes > modified from from inside a module, it's necessary to export > dump_mm() function. > > Signed-off-by: Sur

Re: [PATCH v2 5/6] mm: introduce mod_vm_flags_nolock and use it in untrack_pfn

2023-01-25 Thread Michal Hocko
On Wed 25-01-23 00:38:50, Suren Baghdasaryan wrote: > In cases when VMA flags are modified after VMA was isolated and mmap_lock > was downgraded, flags modifications would result in an assertion because > mmap write lock is not held. > Introduce mod_vm_flags_nolock to be used in such situation. > P

Re: [PATCH v2 4/6] mm: replace vma->vm_flags indirect modification in ksm_madvise

2023-01-25 Thread Michal Hocko
On Wed 25-01-23 00:38:49, Suren Baghdasaryan wrote: > Replace indirect modifications to vma->vm_flags with calls to modifier > functions to be able to track flag changes and to keep vma locking > correctness. Add a BUG_ON check in ksm_madvise() to catch indirect > vm_flags modification attempts. T

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Peter Zijlstra
On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index 2d6d790d9bed..6c7c70bf50dd 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -491,7 +491,13 @@ struct vm_area_struct { >

Re: [PATCH v2 2/6] mm: replace VM_LOCKED_CLEAR_MASK with VM_LOCKED_MASK

2023-01-25 Thread Michal Hocko
On Wed 25-01-23 00:38:47, Suren Baghdasaryan wrote: > To simplify the usage of VM_LOCKED_CLEAR_MASK in clear_vm_flags(), > replace it with VM_LOCKED_MASK bitmask and convert all users. > > Signed-off-by: Suren Baghdasaryan Acked-by: Michal Hocko > --- > include/linux/mm.h | 4 ++-- > kernel/fo

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Michal Hocko
On Wed 25-01-23 00:38:46, Suren Baghdasaryan wrote: > vm_flags are among VMA attributes which affect decisions like VMA merging > and splitting. Therefore all vm_flags modifications are performed after > taking exclusive mmap_lock to prevent vm_flags updates racing with such > operations. Introduce

[PATCH v2 6/6] mm: export dump_mm()

2023-01-25 Thread Suren Baghdasaryan
mmap_assert_write_locked() is used in vm_flags modifiers. Because mmap_assert_write_locked() uses dump_mm() and vm_flags are sometimes modified from from inside a module, it's necessary to export dump_mm() function. Signed-off-by: Suren Baghdasaryan --- mm/debug.c | 1 + 1 file changed, 1 insert

[PATCH v2 5/6] mm: introduce mod_vm_flags_nolock and use it in untrack_pfn

2023-01-25 Thread Suren Baghdasaryan
In cases when VMA flags are modified after VMA was isolated and mmap_lock was downgraded, flags modifications would result in an assertion because mmap write lock is not held. Introduce mod_vm_flags_nolock to be used in such situation. Pass a hint to untrack_pfn to conditionally use mod_vm_flags_no

[PATCH v2 4/6] mm: replace vma->vm_flags indirect modification in ksm_madvise

2023-01-25 Thread Suren Baghdasaryan
Replace indirect modifications to vma->vm_flags with calls to modifier functions to be able to track flag changes and to keep vma locking correctness. Add a BUG_ON check in ksm_madvise() to catch indirect vm_flags modification attempts. Signed-off-by: Suren Baghdasaryan --- arch/powerpc/kvm/book

[PATCH v2 3/6] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-25 Thread Suren Baghdasaryan
Replace direct modifications to vma->vm_flags with calls to modifier functions to be able to track flag changes and to keep vma locking correctness. Signed-off-by: Suren Baghdasaryan --- arch/arm/kernel/process.c | 2 +- arch/ia64/mm/init.c

[PATCH v2 2/6] mm: replace VM_LOCKED_CLEAR_MASK with VM_LOCKED_MASK

2023-01-25 Thread Suren Baghdasaryan
To simplify the usage of VM_LOCKED_CLEAR_MASK in clear_vm_flags(), replace it with VM_LOCKED_MASK bitmask and convert all users. Signed-off-by: Suren Baghdasaryan --- include/linux/mm.h | 4 ++-- kernel/fork.c | 2 +- mm/hugetlb.c | 4 ++-- mm/mlock.c | 6 +++--- mm/mmap.c

[PATCH v2 0/6] introduce vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
This patchset was originally published as a part of per-VMA locking [1] and was split after suggestion that it's viable on its own and to facilitate the review process. It is now a preprequisite for the next version of per-VMA lock patchset, which reuses vm_flags modifier functions to lock the VMA

[PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Suren Baghdasaryan
vm_flags are among VMA attributes which affect decisions like VMA merging and splitting. Therefore all vm_flags modifications are performed after taking exclusive mmap_lock to prevent vm_flags updates racing with such operations. Introduce modifier functions for vm_flags to be used whenever flags a

Re: [PATCH] powerpc/tlb: Remove BUILD_BUG for book3s/32/tlbflush.h local_flush_tlb_page_psize

2023-01-25 Thread Michael Ellerman
Benjamin Gray writes: > Converts the BUILD_BUG to a WARN to allow building with a low/unoptimised > compiler. > > The original expectation was that a compiler would see that the only > usage of this function was in a function that is only called behind > radix-only guards. And it worked this way o

Re: [PATCH] powerpc/tlb: Remove BUILD_BUG for book3s/32/tlbflush.h local_flush_tlb_page_psize

2023-01-25 Thread Christophe Leroy
Le 24/01/2023 à 22:54, Benjamin Gray a écrit : > Converts the BUILD_BUG to a WARN to allow building with a low/unoptimised > compiler. No no no no. Please don't do that. That approach is used everywhere in the kernel, why should it be a problem only for local_flush_tlb_page_psize() and not eve

Re: [PATCH v2] ALSA: aoa: make remove callback of soundbus driver void returned

2023-01-25 Thread Takashi Iwai
On Fri, 06 Jan 2023 16:17:46 +0100, Dawei Li wrote: > > Since commit fc7a6209d571 ("bus: Make remove callback return void") > forces bus_type::remove be void-returned, it doesn't make much sense > for any bus based driver implementing remove callbalk to return > non-void to its caller. > > As suc

Re: arch/powerpc/kernel/head_85xx.o: warning: objtool: .head.text+0x1a6c: unannotated intra-function call

2023-01-25 Thread Michael Ellerman
"Naveen N. Rao" writes: > Sathvika Vasireddy wrote: >> > arch/powerpc/kvm/booke.o: warning: objtool: kvmppc_fill_pt_regs+0x30: > unannotated intra-function call >> >> As an attempt to fix it, I tried expanding ANNOTATE_INTRA_FUNCTION_CALL >> macro to indicate that the branch target is

Re: [PATCH v3] powerpc/boot: Don't always pass -mcpu=powerpc when building 32-bit uImage

2023-01-25 Thread Christophe Leroy
Le 22/01/2023 à 12:19, Pali Rohár a écrit : > On Saturday 24 December 2022 18:44:52 Pali Rohár wrote: >> On Thursday 08 December 2022 19:57:39 Christophe Leroy wrote: >>> Le 08/12/2022 à 20:16, Pali Rohár a écrit : On Sunday 28 August 2022 17:43:53 Christophe Leroy wrote: > Le 28/08/2022