mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Rusty Russell <rusty@rustcorp.com.au>,
	David Howells <dhowells@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [RFC PATCH] Fix: module signature vs tracepoints: add new TAINT_UNSIGNED_MODULE
Date: Mon, 24 Feb 2014 10:54:54 -0500	[thread overview]
Message-ID: <20140224105454.3e1981ba@gandalf.local.home> (raw)
In-Reply-To: <1828346046.24803.1392349744601.JavaMail.zimbra@efficios.com>

On Fri, 14 Feb 2014 03:49:04 +0000 (UTC)
Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
> >  
> >  	mutex_lock(&tracepoints_mutex);
> >  	old = tracepoint_add_probe(name, probe, data);
> > @@ -388,9 +393,15 @@ int tracepoint_probe_register(const char *name, void
> > *probe, void *data)
> >  		return PTR_ERR(old);
> >  	}
> >  	tracepoint_update_probes();		/* may update entry */
> > +	entry = get_tracepoint(name);
> > +	/* Make sure the entry was enabled */
> > +	if (!entry || !entry->enabled) {
> > +		tracepoint_entry_remove_probe(entry, probe, data);
> 
> I'm OK with returning some kind of feedback about whether the tracepoint is
> enabled or not, but there is one use-case I care about this change breaks:
> registering a tracepoint probe for a module that is not yet loaded. The change
> you propose here removes the probe if no tracepoint is found when the probe is
> registered.

The thing is, there's no in-tree user of that interface.

I was thinking of adding a tracepoint_probe_register_future() that
wouldn't remove the probe, but this storing of a tracepoint that does
not exist (and may never exist), is IMHO a broken design.

The real answer to this is to enabled the tracepoints on module load,
with a module parameter. We've talked about this before, and I also
think there's some patches out there that do this. (I remember creating
something myself). I'll have to go dig them out and we can work to get
them in 3.15.

> 
> Another way to do this, without requiring changes to the existing
> tracepoint_probe_register() API, is to simply add e.g. (better function
> names welcome):
> 
> int tracepoint_has_callsites(const char *name)
> {
>     struct tracepoint_entry *entry;
>     int ret = 0;
> 
>     mutex_lock(&tracepoints_mutex);
>     entry = get_tracepoint(name);
>     if (entry && entry->refcount) {
>         ret = 1;
>     }
>     mutex_unlock(&tracepoints_mutex);
>     return ret;
> }

No, I'm not about to change the interface for something that is broken.
tracepoint_probe_register() should fail if it does not register a
tracepoint. It should not store it off for later. I'm not aware of any
other "register" function in the kernel that does such a thing. Is
there one that you know of?

> 
> So tools which care about providing feedback to their users about the
> fact that tracepoint callsites are not there can call this new function.
> The advantage is that it would not change the return values of the existing
> API. Also, it would be weird to have tracepoint_probe_register() return
> an error value but leave the tracepoint in a registered state. Moving this
> into a separate query function seems more consistent IMHO.

Again, the existing API is not a user interface. It is free to change,
and this change wont break any existing in-tree uses. In fact, the fact
that you had this stupid way of doing it, *broke* the in-tree users!
That is, no error messages were ever displayed when the probe was not
registered. This is why I consider this a broken design.

If you want LTTng to enable tracepoints before loading, then have your
module save off these these tracepoints and register a handler to
be called when a module is loaded and enable them yourself.

For now, I'm going to push this in, and also mark it for stable.

-- Steve

  reply	other threads:[~2014-02-24 15:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10 23:23 Mathieu Desnoyers
2014-02-11  7:27 ` Ingo Molnar
2014-02-12  4:45   ` Steven Rostedt
2014-02-12  5:51     ` Mathieu Desnoyers
2014-02-13  3:24     ` Rusty Russell
2014-02-13 21:11       ` Steven Rostedt
2014-02-13 21:24         ` Steven Rostedt
2014-02-14  3:32           ` Mathieu Desnoyers
2014-02-14  0:51         ` Rusty Russell
2014-02-16 23:58           ` Mathieu Desnoyers
2014-02-20 15:30           ` Steven Rostedt
2014-02-20 23:09             ` Rusty Russell
2014-02-21  4:09               ` Steven Rostedt
2014-02-21  8:10                 ` Johannes Berg
2014-02-26  2:51                   ` Rusty Russell
2014-02-26 12:55                     ` Mathieu Desnoyers
2014-02-13 15:10     ` Mathieu Desnoyers
2014-02-13 15:28       ` Steven Rostedt
2014-02-13 15:36         ` Frank Ch. Eigler
2014-02-13 15:44           ` Steven Rostedt
2014-02-13 21:42             ` Arend van Spriel
2014-02-13 15:41         ` Mathieu Desnoyers
2014-02-13 20:45           ` Steven Rostedt
2014-02-14  3:49             ` Mathieu Desnoyers
2014-02-24 15:54               ` Steven Rostedt [this message]
2014-02-24 16:55                 ` Mathieu Desnoyers
2014-02-24 17:39                   ` Steven Rostedt
2014-02-24 17:58                     ` Mathieu Desnoyers
2014-02-24 18:25                       ` Steven Rostedt
2014-02-26 19:55                       ` Steven Rostedt
2014-02-26  2:53                     ` Rusty Russell
2014-02-26 20:13                       ` Steven Rostedt
2014-02-24 18:32                 ` Mathieu Desnoyers
2014-02-24 19:10                   ` Steven Rostedt
2014-02-26 14:23                     ` Mathieu Desnoyers
2014-02-26 15:05                       ` Steven Rostedt

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=20140224105454.3e1981ba@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®