public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>, lkml <linux-kernel@vger.kernel.org>,
	        systemtap <systemtap@sources.redhat.com>,
	        DLE <dle-develop@lists.sourceforge.net>,
	        Oleg Nesterov <oleg@redhat.com>
Subject: Re: [PATCH -tip 3/3] Add get_signal tracepoint
Date: Mon, 16 Nov 2009 23:01:00 -0000	[thread overview]
Message-ID: <20091116230037.23EEB1A2@magilla.sf.frob.com> (raw)
In-Reply-To: Masami Hiramatsu's message of  Monday, 16 November 2009 17:39:49 -0500 <4B01D4B5.1050909@redhat.com>

> Hmm, actually, trace_signal_send() doesn't record the return value.

Is that because it's called before the action really happens?
Is it important that it be called beforehand?  If it's called
afterwards, it's easy to pass the return value.

> So, what about trace_signal_overflow() for RT-signals and
> trace_signal_loss_info() for non-RT?

Really you can distinguish those just by looking at sig and info, so
perhaps a single tracepoint is enough.  I guess it really depends on what
filtering you would want and how inconvenient it is to have to apply that
filtering.  Having these two distinct tracepoints lets you trivially trace
only "silent information loss" without seeing the events where userland
gets full information (if applications are paying attention).

If you want to have a full suite of tracepoints where each one covers one
unambiguous corner of the semantics, then there are more than these just
for sending.  e.g. see below.

Thanks,
Roland


--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -838,8 +841,10 @@ static int __send_signal(int sig, struct
 
 	assert_spin_locked(&t->sighand->siglock);
 
-	if (!prepare_signal(sig, t, from_ancestor_ns))
+	if (!prepare_signal(sig, t, from_ancestor_ns)) {
+		trace_signal_generate_ignored(sig, group, info);
 		return 0;
+	}
 
 	pending = group ? &t->signal->shared_pending : &t->pending;
 	/*
@@ -847,8 +852,10 @@ static int __send_signal(int sig, struct
 	 * exactly one non-rt signal, so that we can get more
 	 * detailed information about the cause of the signal.
 	 */
-	if (legacy_queue(pending, sig))
+	if (legacy_queue(pending, sig)) {
+		trace_signal_generate_dropped_duplicate(sig, group, info);
 		return 0;
+	}
 	/*
 	 * fast-pathed signals for kernel-internal things like SIGSTOP
 	 * or SIGKILL.
@@ -896,12 +903,22 @@ static int __send_signal(int sig, struct
 			break;
 		}
 	} else if (!is_si_special(info)) {
-		if (sig >= SIGRTMIN && info->si_code != SI_USER)
-		/*
-		 * Queue overflow, abort.  We may abort if the signal was rt
-		 * and sent by user using something other than kill().
-		 */
+		if (sig >= SIGRTMIN && info->si_code != SI_USER) {
+			/*
+			 * Queue overflow, abort.  We may abort if the
+			 * signal was rt and sent by user using something
+			 * other than kill().
+			 */
+			trace_signal_generate_overflow_fail(sig, group, info);
 			return -EAGAIN;
+		} else {
+			/*
+			 * This is a silent loss of information.  We still
+			 * send the signal, but the *info bits are lost.
+			 */
+			trace_signal_generate_overflow_lose_info(sig, group,
+								 info);
+		}
 	}
 
 out_set:

  reply	other threads:[~2009-11-16 23:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13 22:52 [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency Masami Hiramatsu
2009-11-13 22:52 ` [PATCH -tip 2/3] Add coredump tracepoint Masami Hiramatsu
2009-11-13 23:39   ` Roland McGrath
2009-11-14  0:00     ` Masami Hiramatsu
2009-11-14  0:02     ` Ingo Molnar
2009-11-14  0:06       ` Roland McGrath
2009-11-14  0:14         ` Ingo Molnar
2009-11-14  1:49           ` Roland McGrath
2009-11-14  0:26         ` Masami Hiramatsu
2009-11-13 22:52 ` [PATCH -tip 3/3] Add get_signal tracepoint Masami Hiramatsu
2009-11-13 23:53   ` Roland McGrath
2009-11-14  0:12     ` Ingo Molnar
2009-11-16 21:52       ` Masami Hiramatsu
2009-11-16 22:11         ` Roland McGrath
2009-11-16 22:40           ` Masami Hiramatsu
2009-11-16 23:01             ` Roland McGrath [this message]
2009-11-16 23:46               ` Masami Hiramatsu
2009-11-17  6:03         ` Ingo Molnar
2009-11-17 15:25           ` Masami Hiramatsu
2009-11-14  0:29     ` Masami Hiramatsu
2009-11-13 23:09 ` [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency Andrew Morton
2009-11-13 23:25   ` Ingo Molnar
2009-11-13 23:45     ` Masami Hiramatsu
2009-11-13 23:16 ` Roland McGrath
2009-11-13 23:23   ` Ingo Molnar
2009-11-13 23:30     ` Roland McGrath

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=20091116230037.23EEB1A2@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=systemtap@sources.redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).