Re: [RFCv1 0/6] Page Detective

2024-11-20 Thread Andi Kleen
> - Quickly identify all user processes mapping a given page. Can be done with /proc/*/pagemap today. Maybe it's not "quick" because it won't use the rmap chains, but is that a serious issue? > - Determine if and where the kernel maps the page, which is also > important given the opportunity to r

Re: [PATCH v2] arm64: Allow CONFIG_AUTOFDO_CLANG to be selected

2024-11-20 Thread Kees Cook
On Mon, Nov 18, 2024 at 02:25:40PM -0800, Yabin Cui wrote: > Select ARCH_SUPPORTS_AUTOFDO_CLANG to allow AUTOFDO_CLANG to be > selected. > > On ARM64, ETM traces can be recorded and converted to AutoFDO profiles. > Experiments on Android show 4% improvement in cold app startup time > and 13% impro

Re: [RFCv1 0/6] Page Detective

2024-11-20 Thread Yosry Ahmed
On Wed, Nov 20, 2024 at 8:14 AM Pasha Tatashin wrote: > > On Tue, Nov 19, 2024 at 2:36 PM Yosry Ahmed wrote: > > > > On Tue, Nov 19, 2024 at 11:30 AM Pasha Tatashin > > wrote: > > > > > > On Tue, Nov 19, 2024 at 1:23 PM Roman Gushchin > > > wrote: > > > > > > > > On Tue, Nov 19, 2024 at 10:08:

Re: [RFC PATCH v3 11/15] context-tracking: Introduce work deferral infrastructure

2024-11-20 Thread Frederic Weisbecker
Le Wed, Nov 20, 2024 at 06:10:43PM +0100, Valentin Schneider a écrit : > On 20/11/24 15:23, Frederic Weisbecker wrote: > > > Ah but there is CT_STATE_GUEST and I see the last patch also applies that to > > CT_STATE_IDLE. > > > > So that could be: > > > > bool ct_set_cpu_work(unsigned int cpu, unsi

Re: [RFCv1 0/6] Page Detective

2024-11-20 Thread Pasha Tatashin
> > /* Use static buffer, for the caller is holding oom_lock. */ > > static char buf[PAGE_SIZE]; > > > > seq_buf_init(&s, buf, sizeof(buf)); > > memory_stat_format(memcg, &s); > > seq_buf_do_printk(&s, KERN_INFO); > > } > > > > This is a callosal

Re: [RFC PATCH v3 13/15] context_tracking,x86: Add infrastructure to defer kernel TLBI

2024-11-20 Thread Valentin Schneider
On 20/11/24 16:32, Peter Zijlstra wrote: > On Wed, Nov 20, 2024 at 04:22:16PM +0100, Peter Zijlstra wrote: >> On Tue, Nov 19, 2024 at 04:35:00PM +0100, Valentin Schneider wrote: >> >> > +void noinstr __flush_tlb_all_noinstr(void) >> > +{ >> > + /* >> > + * This is for invocation in early entry

Re: [RFCv1 0/6] Page Detective

2024-11-20 Thread Pasha Tatashin
On Wed, Nov 20, 2024 at 10:29 AM Andi Kleen wrote: > > Pasha Tatashin writes: > > > Page Detective is a new kernel debugging tool that provides detailed > > information about the usage and mapping of physical memory pages. > > > > It is often known that a particular page is corrupted, but it is h

Re: [RFC PATCH v3 09/15] objtool: Warn about non __ro_after_init static key usage in .noinstr

2024-11-20 Thread Josh Poimboeuf
On Tue, Nov 19, 2024 at 04:34:56PM +0100, Valentin Schneider wrote: > Later commits will disallow runtime-mutable text in .noinstr sections in > order to safely defer instruction patching IPIs. > > All static keys used in .noinstr sections have now been checked as being > either flagged as __ro_af

Re: [RFC PATCH v3 11/15] context-tracking: Introduce work deferral infrastructure

2024-11-20 Thread Valentin Schneider
On 20/11/24 15:23, Frederic Weisbecker wrote: > Ah but there is CT_STATE_GUEST and I see the last patch also applies that to > CT_STATE_IDLE. > > So that could be: > > bool ct_set_cpu_work(unsigned int cpu, unsigned int work) > { > struct context_tracking *ct = per_cpu_ptr(&context_tracking,

Re: [RFCv1 0/6] Page Detective

2024-11-20 Thread Pasha Tatashin
On Tue, Nov 19, 2024 at 2:36 PM Yosry Ahmed wrote: > > On Tue, Nov 19, 2024 at 11:30 AM Pasha Tatashin > wrote: > > > > On Tue, Nov 19, 2024 at 1:23 PM Roman Gushchin > > wrote: > > > > > > On Tue, Nov 19, 2024 at 10:08:36AM -0500, Pasha Tatashin wrote: > > > > On Mon, Nov 18, 2024 at 8:09 PM G

Re: [RFC PATCH v3 06/15] jump_label: Add forceful jump label type

2024-11-20 Thread Josh Poimboeuf
On Wed, Nov 20, 2024 at 03:57:46PM +0100, Peter Zijlstra wrote: > On Wed, Nov 20, 2024 at 03:56:49PM +0100, Peter Zijlstra wrote: > > > But I think we can make the fall-back safer, we can simply force the IPI > > when we poke at noinstr code -- then NOHZ_FULL gets to keep the pieces, > > but at le

Re: [PATCH v2] arm64: Allow CONFIG_AUTOFDO_CLANG to be selected

2024-11-20 Thread George Burgess
We've used ETM in ChromeOS for a while now. Hardware requirements make it unfortunately less ubiquitous than LBR, but: - we first launched it on 5.15, - it's still humming along nicely today on 6.6, so: Tested-by: George Burgess IV IIRC, with a baseline of "using x86_64 AFDO profiles on ARM kern

Re: [RFC PATCH v3 08/15] sched/clock, x86: Make __sched_clock_stable forceful

2024-11-20 Thread Valentin Schneider
On 20/11/24 15:59, Peter Zijlstra wrote: > On Tue, Nov 19, 2024 at 04:34:55PM +0100, Valentin Schneider wrote: >> Later commits will cause objtool to warn about non __ro_after_init static >> keys being used in .noinstr sections in order to safely defer instruction >> patching IPIs targeted at NOHZ_

Re: [RFC PATCH v3 06/15] jump_label: Add forceful jump label type

2024-11-20 Thread Valentin Schneider
On 19/11/24 15:39, Josh Poimboeuf wrote: > On Tue, Nov 19, 2024 at 04:34:53PM +0100, Valentin Schneider wrote: >> Later commits will cause objtool to warn about non __ro_after_init static >> keys being used in .noinstr sections in order to safely defer instruction >> patching IPIs targeted at NOHZ_

Re: [RFC PATCH v3 04/15] rcu: Add a small-width RCU watching counter debug option

2024-11-20 Thread Valentin Schneider
On 20/11/24 15:50, Peter Zijlstra wrote: > On Tue, Nov 19, 2024 at 04:34:51PM +0100, Valentin Schneider wrote: >> A later commit will reduce the size of the RCU watching counter to free up >> some bits for another purpose. Paul suggested adding a config option to >> test the extreme case where the

Re: [RFC PATCH v3 13/15] context_tracking,x86: Add infrastructure to defer kernel TLBI

2024-11-20 Thread Peter Zijlstra
On Tue, Nov 19, 2024 at 04:35:00PM +0100, Valentin Schneider wrote: > +void noinstr __flush_tlb_all_noinstr(void) > +{ > + /* > + * This is for invocation in early entry code that cannot be > + * instrumented. A RMW to CR4 works for most cases, but relies on > + * being able to

Re: [RFC PATCH v3 13/15] context_tracking,x86: Add infrastructure to defer kernel TLBI

2024-11-20 Thread Peter Zijlstra
On Wed, Nov 20, 2024 at 04:22:16PM +0100, Peter Zijlstra wrote: > On Tue, Nov 19, 2024 at 04:35:00PM +0100, Valentin Schneider wrote: > > > +void noinstr __flush_tlb_all_noinstr(void) > > +{ > > + /* > > +* This is for invocation in early entry code that cannot be > > +* instrumented. A

Re: [RFC PATCH v3 04/15] rcu: Add a small-width RCU watching counter debug option

2024-11-20 Thread Peter Zijlstra
On Tue, Nov 19, 2024 at 04:34:51PM +0100, Valentin Schneider wrote: > A later commit will reduce the size of the RCU watching counter to free up > some bits for another purpose. Paul suggested adding a config option to > test the extreme case where the counter is reduced to its minimum usable > wid

Re: [RFCv1 0/6] Page Detective

2024-11-20 Thread Andi Kleen
Pasha Tatashin writes: > Page Detective is a new kernel debugging tool that provides detailed > information about the usage and mapping of physical memory pages. > > It is often known that a particular page is corrupted, but it is hard to > extract more information about such a page from live sys

Re: [RFC PATCH v3 12/15] context_tracking,x86: Defer kernel text patching IPIs

2024-11-20 Thread Peter Zijlstra
On Tue, Nov 19, 2024 at 04:34:59PM +0100, Valentin Schneider wrote: > +static void __text_poke_sync(smp_cond_func_t cond_func) > +{ > + on_each_cpu_cond(cond_func, do_sync_core, NULL, 1); > +} > + > void text_poke_sync(void) > { > - on_each_cpu(do_sync_core, NULL, 1); > + __text_poke

Re: [RFC PATCH v3 08/15] sched/clock, x86: Make __sched_clock_stable forceful

2024-11-20 Thread Peter Zijlstra
On Tue, Nov 19, 2024 at 04:34:55PM +0100, Valentin Schneider wrote: > Later commits will cause objtool to warn about non __ro_after_init static > keys being used in .noinstr sections in order to safely defer instruction > patching IPIs targeted at NOHZ_FULL CPUs. > > __sched_clock_stable is used i

Re: [RFC PATCH v3 06/15] jump_label: Add forceful jump label type

2024-11-20 Thread Peter Zijlstra
On Wed, Nov 20, 2024 at 03:56:49PM +0100, Peter Zijlstra wrote: > But I think we can make the fall-back safer, we can simply force the IPI > when we poke at noinstr code -- then NOHZ_FULL gets to keep the pieces, > but at least we don't violate any correctness constraints. I should have read more

Re: [RFC PATCH v3 06/15] jump_label: Add forceful jump label type

2024-11-20 Thread Peter Zijlstra
On Tue, Nov 19, 2024 at 03:39:02PM -0800, Josh Poimboeuf wrote: > On Tue, Nov 19, 2024 at 04:34:53PM +0100, Valentin Schneider wrote: > > Later commits will cause objtool to warn about non __ro_after_init static > > keys being used in .noinstr sections in order to safely defer instruction > > patch

Re: [RFC PATCH v3 11/15] context-tracking: Introduce work deferral infrastructure

2024-11-20 Thread Frederic Weisbecker
Le Wed, Nov 20, 2024 at 11:54:36AM +0100, Frederic Weisbecker a écrit : > Le Tue, Nov 19, 2024 at 04:34:58PM +0100, Valentin Schneider a écrit : > > +bool ct_set_cpu_work(unsigned int cpu, unsigned int work) > > +{ > > + struct context_tracking *ct = per_cpu_ptr(&context_tracking, cpu); > > + u

Re: [RFC PATCH v3 11/15] context-tracking: Introduce work deferral infrastructure

2024-11-20 Thread Frederic Weisbecker
Le Tue, Nov 19, 2024 at 04:34:58PM +0100, Valentin Schneider a écrit : > +bool ct_set_cpu_work(unsigned int cpu, unsigned int work) > +{ > + struct context_tracking *ct = per_cpu_ptr(&context_tracking, cpu); > + unsigned int old; > + bool ret = false; > + > + preempt_disable(); > +

Re: [RFC PATCH v3 06/15] jump_label: Add forceful jump label type

2024-11-20 Thread Peter Zijlstra
On Tue, Nov 19, 2024 at 04:05:32PM -0800, Josh Poimboeuf wrote: > On Tue, Nov 19, 2024 at 04:34:53PM +0100, Valentin Schneider wrote: > > +++ b/include/linux/jump_label.h > > @@ -200,7 +200,8 @@ struct module; > > #define JUMP_TYPE_FALSE0UL > > #define JUMP_TYPE_TRUE 1UL >

Re: [PATCH v6 02/15] module: Introduce ksys_finit_module()

2024-11-20 Thread Roberto Sassu
On Wed, 2024-11-20 at 10:16 +0100, Roberto Sassu wrote: > On Tue, 2024-11-19 at 12:10 -0800, Luis Chamberlain wrote: > > On Tue, Nov 19, 2024 at 01:14:02PM +0100, Christoph Hellwig wrote: > > > On Tue, Nov 19, 2024 at 11:49:09AM +0100, Roberto Sassu wrote: > > > > From: Roberto Sassu > > > > > >

Re: [PATCH v6 02/15] module: Introduce ksys_finit_module()

2024-11-20 Thread Roberto Sassu
On Tue, 2024-11-19 at 12:10 -0800, Luis Chamberlain wrote: > On Tue, Nov 19, 2024 at 01:14:02PM +0100, Christoph Hellwig wrote: > > On Tue, Nov 19, 2024 at 11:49:09AM +0100, Roberto Sassu wrote: > > > From: Roberto Sassu > > > > > > Introduce ksys_finit_module() to let kernel components request a