Re: [PATCH] tracing: Have trace_event_file have ref counters

2023-11-01 Thread Steven Rostedt
On Wed, 1 Nov 2023 22:32:54 -0400 Steven Rostedt wrote: > > Ouch! I thought the file descriptor has been hold by the opened process. > > Well, the struct *filp is, but not the filp->private that points to the > struct trace_event_file *file. That was supposed to be "struct file *filp" --

Re: [PATCH] tracing: Have trace_event_file have ref counters

2023-11-01 Thread Steven Rostedt
On Thu, 2 Nov 2023 11:14:33 +0900 Masami Hiramatsu (Google) wrote: > > > > What happens here is that the kprobe event creates a trace_event_file > > "file" descriptor that represents the file in tracefs to the event. It > > maintains state of the event (is it enabled for the given instance?). >

Re: [PATCH] tracing: Have trace_event_file have ref counters

2023-11-01 Thread Google
On Tue, 31 Oct 2023 12:24:53 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The following can crash the kernel: > > # cd /sys/kernel/tracing > # echo 'p:sched schedule' > kprobe_events > # exec 5>>events/kprobes/sched/enable > # > kprobe_events > # exec 5>&- > > The

Re: [PATCH v6 7/8] eventfs: Remove special processing of dput() of events directory

2023-11-01 Thread Google
On Wed, 01 Nov 2023 13:25:48 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The top level events directory is no longer special with regards to how it > should be delete. Remove the extra processing for it in > eventfs_set_ei_status_free(). > Looks good to me. Reviewed-by:

Re: [PATCH v8 2/3] mm/memory_hotplug: split memmap_on_memory requests across memblocks

2023-11-01 Thread Verma, Vishal L
On Thu, 2023-11-02 at 09:16 +0800, Huang, Ying wrote: > Vishal Verma writes: > [..] > > + > > +static int create_altmaps_and_memory_blocks(int nid, struct memory_group > > *group, > > +   u64 start, u64 size) > > +{ > > +   unsigned long memblock_size

Re: [PATCH v8 2/3] mm/memory_hotplug: split memmap_on_memory requests across memblocks

2023-11-01 Thread Huang, Ying
Vishal Verma writes: > The MHP_MEMMAP_ON_MEMORY flag for hotplugged memory is restricted to > 'memblock_size' chunks of memory being added. Adding a larger span of > memory precludes memmap_on_memory semantics. > > For users of hotplug such as kmem, large amounts of memory might get > added from

[GIT PULL] NVDIMM for 6.7

2023-11-01 Thread Ira Weiny
Hi Linus, please pull from: git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git tags/libnvdimm-for-6.7 ... to get updates to the nvdimm tree. They are a mix of bug fixes and updates to interfaces used by nvdimm. Bug fixes include: Fix a sleep during spinlock in

Re: [PATCH v6 5/8] eventfs: Hold eventfs_mutex when calling callback functions

2023-11-01 Thread Google
On Wed, 01 Nov 2023 13:25:46 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The callback function that is used to create inodes and dentries is not > protected by anything and the data that is passed to it could become > stale. After eventfs_remove_dir() is called by the

Re: [PATCH v5 4/7] eventfs: Save ownership and mode

2023-11-01 Thread Steven Rostedt
On Thu, 2 Nov 2023 08:43:32 +0900 Masami Hiramatsu (Google) wrote: > On Tue, 31 Oct 2023 18:33:30 -0400 > Steven Rostedt wrote: > > > From: "Steven Rostedt (Google)" > > > > Now that inodes and dentries are created on the fly, they are also > > reclaimed on memory pressure. Since the

Re: [PATCH v5 4/7] eventfs: Save ownership and mode

2023-11-01 Thread Google
On Tue, 31 Oct 2023 18:33:30 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > Now that inodes and dentries are created on the fly, they are also > reclaimed on memory pressure. Since the ownership and file mode are saved > in the inode, if they are freed, any changes to the

[PATCH v8 0/3] mm: use memmap_on_memory semantics for dax/kmem

2023-11-01 Thread Vishal Verma
The dax/kmem driver can potentially hot-add large amounts of memory originating from CXL memory expanders, or NVDIMMs, or other 'device memories'. There is a chance there isn't enough regular system memory available to fit the memmap for this new memory. It's therefore desirable, if all other

[PATCH v8 2/3] mm/memory_hotplug: split memmap_on_memory requests across memblocks

2023-11-01 Thread Vishal Verma
The MHP_MEMMAP_ON_MEMORY flag for hotplugged memory is restricted to 'memblock_size' chunks of memory being added. Adding a larger span of memory precludes memmap_on_memory semantics. For users of hotplug such as kmem, large amounts of memory might get added from the CXL subsystem. In some cases,

[PATCH v8 3/3] dax/kmem: allow kmem to add memory with memmap_on_memory

2023-11-01 Thread Vishal Verma
Large amounts of memory managed by the kmem driver may come in via CXL, and it is often desirable to have the memmap for this memory on the new memory itself. Enroll kmem-managed memory for memmap_on_memory semantics if the dax region originates via CXL. For non-CXL dax regions, retain the

[PATCH v8 1/3] mm/memory_hotplug: replace an open-coded kmemdup() in add_memory_resource()

2023-11-01 Thread Vishal Verma
A review of the memmap_on_memory modifications to add_memory_resource() revealed an instance of an open-coded kmemdup(). Replace it with kmemdup(). Cc: Andrew Morton Cc: David Hildenbrand Cc: Michal Hocko Cc: Oscar Salvador Cc: Dan Williams Reported-by: Dan Williams Reviewed-by: David

[GIT PULL] Modules changes for v6.7-rc1

2023-11-01 Thread Luis Chamberlain
The following changes since commit 7d461b291e65938f15f56fe58da2303b07578a76: Merge tag 'drm-next-2023-10-31-1' of git://anongit.freedesktop.org/drm/drm (2023-11-01 06:28:35 -1000) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/

Re: [PATCH] eventfs: Fix kerneldoc of eventfs_remove_rec()

2023-11-01 Thread Steven Rostedt
On Mon, 30 Oct 2023 21:57:13 +0530 Mukesh Ojha wrote: > On 10/30/2023 9:45 PM, Steven Rostedt wrote: > > From: "Steven Rostedt (Google)" > > > > The eventfs_remove_rec() had some missing parameters in the kerneldoc > > comment above it. Also, rephrase the description a bit more to have a bit >

Re: [QUESTION] ftrace_test_recursion_trylock behaviour

2023-11-01 Thread Steven Rostedt
On Wed, 1 Nov 2023 18:32:14 +0100 Jiri Olsa wrote: > hi, > I'm doing some testing on top of fprobes and noticed that the > ftrace_test_recursion_trylock allows caller from the same context > going through twice. > > The change below adds extra fprobe on stack_trace_print, which is > called

[QUESTION] ftrace_test_recursion_trylock behaviour

2023-11-01 Thread Jiri Olsa
hi, I'm doing some testing on top of fprobes and noticed that the ftrace_test_recursion_trylock allows caller from the same context going through twice. The change below adds extra fprobe on stack_trace_print, which is called within the sample_entry_handler and I can see it being executed with

[PATCH v6 8/8] eventfs: Use simple_recursive_removal() to clean up dentries

2023-11-01 Thread Steven Rostedt
From: "Steven Rostedt (Google)" Looking at how dentry is removed via the tracefs system, I found that eventfs does not do everything that it did under tracefs. The tracefs removal of a dentry calls simple_recursive_removal() that does a lot more than a simple d_invalidate(). As it should be a

[PATCH v6 4/8] eventfs: Save ownership and mode

2023-11-01 Thread Steven Rostedt
From: "Steven Rostedt (Google)" Now that inodes and dentries are created on the fly, they are also reclaimed on memory pressure. Since the ownership and file mode are saved in the inode, if they are freed, any changes to the ownership and mode will be lost. To counter this, if the user changes

[PATCH v6 5/8] eventfs: Hold eventfs_mutex when calling callback functions

2023-11-01 Thread Steven Rostedt
From: "Steven Rostedt (Google)" The callback function that is used to create inodes and dentries is not protected by anything and the data that is passed to it could become stale. After eventfs_remove_dir() is called by the tracing system, it is free to remove the events that are associated to

[PATCH v6 6/8] eventfs: Delete eventfs_inode when the last dentry is freed

2023-11-01 Thread Steven Rostedt
From: "Steven Rostedt (Google)" There exists a race between holding a reference of an eventfs_inode dentry and the freeing of the eventfs_inode. If user space has a dentry held long enough, it may still be able to access the dentry's eventfs_inode after it has been freed. To prevent this, have

[PATCH v6 3/8] eventfs: Test for ei->is_freed when accessing ei->dentry

2023-11-01 Thread Steven Rostedt
From: "Steven Rostedt (Google)" The eventfs_inode (ei) is protected by SRCU, but the ei->dentry is not. It is protected by the eventfs_mutex. Anytime the eventfs_mutex is released, and access to the ei->dentry needs to be done, it should first check if ei->is_freed is set under the

[PATCH v6 2/8] eventfs: Have a free_ei() that just frees the eventfs_inode

2023-11-01 Thread Steven Rostedt
From: "Steven Rostedt (Google)" As the eventfs_inode is freed in two different locations, make a helper function free_ei() to make sure all the allocated fields of the eventfs_inode is freed. This requires renaming the existing free_ei() which is called by the srcu handler to free_rcu_ei() and

[PATCH v6 1/8] eventfs: Remove "is_freed" union with rcu head

2023-11-01 Thread Steven Rostedt
From: "Steven Rostedt (Google)" The eventfs_inode->is_freed was a union with the rcu_head with the assumption that when it was on the srcu list the head would contain a pointer which would make "is_freed" true. But that was a wrong assumption as the rcu head is a single link list where the last

[PATCH v6 7/8] eventfs: Remove special processing of dput() of events directory

2023-11-01 Thread Steven Rostedt
From: "Steven Rostedt (Google)" The top level events directory is no longer special with regards to how it should be delete. Remove the extra processing for it in eventfs_set_ei_status_free(). Cc: Ajay Kaher Signed-off-by: Steven Rostedt (Google) --- Changes since v5:

[PATCH v6 0/8] eventfs: Fixing dynamic creation

2023-11-01 Thread Steven Rostedt
Changes since v5: https://lore.kernel.org/all/20231031223326.794680...@goodmis.org/ This was originally based on: [PATCH] eventfs: Process deletion of dentry more thoroughly https://lore.kernel.org/linux-trace-kernel/20231031144703.71eef...@gandalf.local.home/ But Al Viro asked why I do

stable-rc: 5.15 - all builds failed - ld.lld: error: undefined symbol: kallsyms_on_each_symbol

2023-11-01 Thread Naresh Kamboju
Hi Greg, I see the following build warning / errors everywhere on stable-rc 5.15 branch. ld.lld: error: undefined symbol: kallsyms_on_each_symbol >>> referenced by trace_kprobe.c >>> trace/trace_kprobe.o:(create_local_trace_kprobe) in archive >>> kernel/built-in.a >>> referenced

Re: stable-rc: 5.4 - all builds failed - ld.lld: error: undefined symbol: kallsyms_on_each_symbol

2023-11-01 Thread Naresh Kamboju
On Wed, 1 Nov 2023 at 20:38, Naresh Kamboju wrote: > > Hi Greg, > > I see the following build warning / errors everywhere on stable-rc 5.4 branch. I am sorry, It is on stable-rc 5.15. > > ld.lld: error: undefined symbol: kallsyms_on_each_symbol > >>> referenced by trace_kprobe.c > >>>

stable-rc: 5.4 - all builds failed - ld.lld: error: undefined symbol: kallsyms_on_each_symbol

2023-11-01 Thread Naresh Kamboju
Hi Greg, I see the following build warning / errors everywhere on stable-rc 5.4 branch. ld.lld: error: undefined symbol: kallsyms_on_each_symbol >>> referenced by trace_kprobe.c >>> trace/trace_kprobe.o:(create_local_trace_kprobe) in archive >>> kernel/built-in.a >>> referenced by

Re: [PATCH] eventfs: Process deletion of dentry more thoroughly

2023-11-01 Thread Steven Rostedt
On Wed, 1 Nov 2023 00:16:59 -0400 Steven Rostedt wrote: > On Wed, 1 Nov 2023 02:25:53 + > Al Viro wrote: > > > Umm... Is there any reason not to use simple_recursive_removal() there? > > Hmm, I may be able to (I'm still a newbie with understanding of the vfs). > > I did it this way

Re: [PATCH v2 2/3] remoteproc: qcom: pas: make region assign more generic

2023-11-01 Thread Mukesh Ojha
On 10/31/2023 10:36 PM, Neil Armstrong wrote: Hi, On 30/10/2023 14:10, Mukesh Ojha wrote: On 10/30/2023 3:33 PM, Neil Armstrong wrote: The current memory region assign only supports a single memory region. But new platforms introduces more regions to make the memory requirements more

Re: [PATCH v5 2/7] eventfs: Have a free_ei() that just frees the eventfs_inode

2023-11-01 Thread Google
On Tue, 31 Oct 2023 18:33:28 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > As the eventfs_inode is freed in two different locations, make a helper > function free_ei() to make sure all the allocated fields of the > eventfs_inode is freed. > > This requires renaming the

Re: [PATCH v5 1/7] eventfs: Remove "is_freed" union with rcu head

2023-11-01 Thread Google
On Tue, 31 Oct 2023 18:33:27 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The eventfs_inode->is_freed was a union with the rcu_head with the > assumption that when it was on the srcu list the head would contain a > pointer which would make "is_freed" true. But that was a

Re: [PATCH v3] seq_buf: Introduce DECLARE_SEQ_BUF and seq_buf_str()

2023-11-01 Thread Christophe JAILLET
Le 27/10/2023 à 17:56, Kees Cook a écrit : Solve two ergonomic issues with struct seq_buf; 1) Too much boilerplate is required to initialize: struct seq_buf s; char buf[32]; seq_buf_init(s, buf, sizeof(buf)); Instead, we can build this directly on the stack. Provide