public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Richter <robert.richter@amd.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: oprofile-list <oprofile-list@lists.sourceforge.net>,
	Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
	Robert Richter <robert.richter@amd.com>
Subject: [PATCH 7/9] oprofile: remove nr_available_slots()
Date: Thu, 11 Dec 2008 17:42:01 +0100	[thread overview]
Message-ID: <1229013723-8191-8-git-send-email-robert.richter@amd.com> (raw)
In-Reply-To: <1229013723-8191-1-git-send-email-robert.richter@amd.com>

This function is no longer available after the port to the new ring
buffer. Its removal can lead to incomplete sampling sequences since
IBS samples and backtraces are transfered in multiple samples. Due to
a full buffer, samples could be lost any time. The userspace daemon
has to live with such incomplete sampling sequences as long as the
data within one sample is consistent.

This will be fixed by changing the internal buffer data there all data
of one IBS sample or a backtrace is packed in a single ring buffer
entry. This is possible since the new ring buffer supports variable
data size.

Signed-off-by: Robert Richter <robert.richter@amd.com>
---
 drivers/oprofile/cpu_buffer.c |   34 ----------------------------------
 1 files changed, 0 insertions(+), 34 deletions(-)

diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index eb280ec..7f7fc95 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -145,18 +145,6 @@ void end_cpu_work(void)
 	flush_scheduled_work();
 }
 
-/* compute number of available slots in cpu_buffer queue */
-static unsigned long nr_available_slots(struct oprofile_cpu_buffer const *b)
-{
-	unsigned long head = b->head_pos;
-	unsigned long tail = b->tail_pos;
-
-	if (tail > head)
-		return (tail - head) - 1;
-
-	return tail + (b->buffer_size - head) - 1;
-}
-
 static inline void
 add_sample(struct oprofile_cpu_buffer *cpu_buf,
 	   unsigned long pc, unsigned long event)
@@ -206,11 +194,6 @@ static int log_sample(struct oprofile_cpu_buffer *cpu_buf, unsigned long pc,
 		return 0;
 	}
 
-	if (nr_available_slots(cpu_buf) < 3) {
-		cpu_buf->sample_lost_overflow++;
-		return 0;
-	}
-
 	is_kernel = !!is_kernel;
 
 	task = current;
@@ -233,11 +216,6 @@ static int log_sample(struct oprofile_cpu_buffer *cpu_buf, unsigned long pc,
 
 static int oprofile_begin_trace(struct oprofile_cpu_buffer *cpu_buf)
 {
-	if (nr_available_slots(cpu_buf) < 4) {
-		cpu_buf->sample_lost_overflow++;
-		return 0;
-	}
-
 	add_code(cpu_buf, CPU_TRACE_BEGIN);
 	cpu_buf->tracing = 1;
 	return 1;
@@ -291,12 +269,6 @@ void oprofile_add_ibs_sample(struct pt_regs * const regs,
 
 	cpu_buf->sample_received++;
 
-	if (nr_available_slots(cpu_buf) < MAX_IBS_SAMPLE_SIZE) {
-		/* we can't backtrace since we lost the source of this event */
-		cpu_buf->sample_lost_overflow++;
-		return;
-	}
-
 	/* notice a switch from user->kernel or vice versa */
 	if (cpu_buf->last_is_kernel != is_kernel) {
 		cpu_buf->last_is_kernel = is_kernel;
@@ -342,12 +314,6 @@ void oprofile_add_trace(unsigned long pc)
 	if (!cpu_buf->tracing)
 		return;
 
-	if (nr_available_slots(cpu_buf) < 1) {
-		cpu_buf->tracing = 0;
-		cpu_buf->sample_lost_overflow++;
-		return;
-	}
-
 	/*
 	 * broken frame can give an eip with the same value as an
 	 * escape code, abort the trace if we get it
-- 
1.6.0.1



  parent reply	other threads:[~2008-12-11 16:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 16:41 [PATCH 0/9] oprofile: port to the new ring buffer Robert Richter
2008-12-11 16:41 ` [PATCH 1/9] oprofile: adding cpu buffer r/w access functions Robert Richter
2008-12-11 16:41 ` [PATCH 2/9] oprofile: adding cpu_buffer_write_commit() Robert Richter
2008-12-11 16:41 ` [PATCH 3/9] oprofile: adding cpu_buffer_entries() Robert Richter
2008-12-11 16:41 ` [PATCH 4/9] oprofile: moving cpu_buffer_reset() to cpu_buffer.h Robert Richter
2008-12-11 16:41 ` [PATCH 5/9] ring_buffer: add remaining cpu functions to ring_buffer.h Robert Richter
2008-12-11 19:23   ` Steven Rostedt
2008-12-11 16:42 ` [PATCH 6/9] oprofile: port to the new ring_buffer Robert Richter
2008-12-11 19:48   ` Steven Rostedt
2008-12-16 17:23     ` Robert Richter
2008-12-16 19:38       ` Steven Rostedt
2008-12-16  9:37   ` Andrew Morton
2008-12-11 16:42 ` Robert Richter [this message]
2008-12-11 16:42 ` [PATCH 8/9] oprofile: fix lost sample counter Robert Richter
2008-12-11 16:42 ` [PATCH 9/9] ring_buffer: adding EXPORT_SYMBOLs Robert Richter
2008-12-11 17:19 ` [PATCH 0/9] oprofile: port to the new ring buffer Steven Rostedt
2008-12-12  5:57 ` Ingo Molnar
2008-12-16 23:49 ` Andrew Morton
2008-12-17  5:03   ` Pekka Enberg
2008-12-22 23:53 ` Carl Love

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=1229013723-8191-8-git-send-email-robert.richter@amd.com \
    --to=robert.richter@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oprofile-list@lists.sourceforge.net \
    --cc=rostedt@goodmis.org \
    /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