All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Jarkko Sakkinen" <jarkko@kernel.org>, <linux-riscv@lists.infradead.org>
Cc: "Masami Hiramatsu" <mhiramat@kernel.org>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	<linux-kernel@vger.kernel.org>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	<linux-modules@vger.kernel.org>,
	"Naveen N . Rao" <naveen.n.rao@linux.ibm.com>,
	"Anil S Keshavamurthy" <anil.s.keshavamurthy@intel.com>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH v5 1/2] kprobes: textmem API
Date: Tue, 26 Mar 2024 00:16:46 +0200	[thread overview]
Message-ID: <D036FYBQUMIX.L5TL0SUCAO49@kernel.org> (raw)
In-Reply-To: <D036AJAEAOUF.34494O217N0RI@kernel.org>

On Tue Mar 26, 2024 at 12:09 AM EET, Jarkko Sakkinen wrote:
> On Mon Mar 25, 2024 at 11:55 PM EET, Jarkko Sakkinen wrote:
> > +#ifdef CONFIG_MODULES
> >  	if (register_module_notifier(&trace_kprobe_module_nb))
> >  		return -EINVAL;
> > +#endif /* CONFIG_MODULES */
>
> register_module_notifier() does have "dummy" version but what
> would I pass to it. It makes more mess than it cleans to declare
> also a "dummy" version of trace_kprobe_module_nb.
>
> The callback itself has too tight module subsystem bindings so
> that they could be simply flagged with IS_DEFINED() (or correct
> if I'm mistaken, this the conclusion I've ended up with).

One way to clean that up would be to create trace_kprobe_module.c and
move kernel module specific code over there and then change
kernel/trace/Makefile as follows:

ifeq ($(CONFIG_PERF_EVENTS),y)
obj-y += trace_kprobe.o
obj-$(CONFIG_MODULES) += trace_kprobe_module.o
endif

and define trace_kprobe_module_init() or similar to do all the dance
with notifiers etc.

This crossed my mind but did not want to do it without feedback.

BR, Jarkko

WARNING: multiple messages have this Message-ID (diff)
From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Jarkko Sakkinen" <jarkko@kernel.org>, <linux-riscv@lists.infradead.org>
Cc: "Masami Hiramatsu" <mhiramat@kernel.org>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	<linux-kernel@vger.kernel.org>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	<linux-modules@vger.kernel.org>,
	"Naveen N . Rao" <naveen.n.rao@linux.ibm.com>,
	"Anil S Keshavamurthy" <anil.s.keshavamurthy@intel.com>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH v5 1/2] kprobes: textmem API
Date: Tue, 26 Mar 2024 00:16:46 +0200	[thread overview]
Message-ID: <D036FYBQUMIX.L5TL0SUCAO49@kernel.org> (raw)
In-Reply-To: <D036AJAEAOUF.34494O217N0RI@kernel.org>

On Tue Mar 26, 2024 at 12:09 AM EET, Jarkko Sakkinen wrote:
> On Mon Mar 25, 2024 at 11:55 PM EET, Jarkko Sakkinen wrote:
> > +#ifdef CONFIG_MODULES
> >  	if (register_module_notifier(&trace_kprobe_module_nb))
> >  		return -EINVAL;
> > +#endif /* CONFIG_MODULES */
>
> register_module_notifier() does have "dummy" version but what
> would I pass to it. It makes more mess than it cleans to declare
> also a "dummy" version of trace_kprobe_module_nb.
>
> The callback itself has too tight module subsystem bindings so
> that they could be simply flagged with IS_DEFINED() (or correct
> if I'm mistaken, this the conclusion I've ended up with).

One way to clean that up would be to create trace_kprobe_module.c and
move kernel module specific code over there and then change
kernel/trace/Makefile as follows:

ifeq ($(CONFIG_PERF_EVENTS),y)
obj-y += trace_kprobe.o
obj-$(CONFIG_MODULES) += trace_kprobe_module.o
endif

and define trace_kprobe_module_init() or similar to do all the dance
with notifiers etc.

This crossed my mind but did not want to do it without feedback.

BR, Jarkko

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2024-03-25 22:16 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 21:55 [PATCH v5 1/2] kprobes: textmem API Jarkko Sakkinen
2024-03-25 21:55 ` Jarkko Sakkinen
2024-03-25 21:55 ` [PATCH v5 2/2] arch/riscv: Enable kprobes when CONFIG_MODULES=n Jarkko Sakkinen
2024-03-25 21:55   ` Jarkko Sakkinen
2024-03-26 13:57   ` Alexandre Ghiti
2024-03-26 13:57     ` Alexandre Ghiti
2024-03-26 16:49     ` Jarkko Sakkinen
2024-03-26 16:49       ` Jarkko Sakkinen
2024-03-26 16:54       ` Jarkko Sakkinen
2024-03-26 16:54         ` Jarkko Sakkinen
2024-03-26 19:03       ` Alexandre Ghiti
2024-03-26 19:03         ` Alexandre Ghiti
2024-03-25 22:06 ` [PATCH v5 1/2] kprobes: textmem API Jarkko Sakkinen
2024-03-25 22:06   ` Jarkko Sakkinen
2024-03-25 22:09 ` Jarkko Sakkinen
2024-03-25 22:09   ` Jarkko Sakkinen
2024-03-25 22:16   ` Jarkko Sakkinen [this message]
2024-03-25 22:16     ` Jarkko Sakkinen
2024-03-25 23:50   ` Masami Hiramatsu
2024-03-25 23:50     ` Masami Hiramatsu
2024-03-26  0:36     ` Jarkko Sakkinen
2024-03-26  0:36       ` Jarkko Sakkinen
2024-03-26  0:58 ` Masami Hiramatsu
2024-03-26  0:58   ` Masami Hiramatsu
2024-03-26  1:31   ` Jarkko Sakkinen
2024-03-26  1:31     ` Jarkko Sakkinen
2024-03-26  2:01     ` Jarkko Sakkinen
2024-03-26  2:01       ` Jarkko Sakkinen
2024-03-26 13:18       ` Jarkko Sakkinen
2024-03-26 13:18         ` Jarkko Sakkinen
2024-03-26 15:05         ` Masami Hiramatsu
2024-03-26 15:05           ` Masami Hiramatsu
2024-03-26 17:02           ` Jarkko Sakkinen
2024-03-26 17:02             ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D036FYBQUMIX.L5TL0SUCAO49@kernel.org \
    --to=jarkko@kernel.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mcgrof@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.