Loading drivers/oprofile/buffer_sync.c +1 −0 Original line number Diff line number Diff line Loading @@ -548,6 +548,7 @@ void sync_buffer(int cpu) /* Remember, only we can modify tail_pos */ cpu_buffer_reset(cpu); #ifndef CONFIG_OPROFILE_IBS available = cpu_buffer_entries(cpu_buf); Loading drivers/oprofile/cpu_buffer.c +0 −12 Original line number Diff line number Diff line Loading @@ -124,18 +124,6 @@ void end_cpu_work(void) flush_scheduled_work(); } /* Resets the cpu buffer to a sane state. */ void cpu_buffer_reset(struct oprofile_cpu_buffer *cpu_buf) { /* * reset these to invalid values; the next sample collected * will populate the buffer with proper values to initialize * the buffer */ cpu_buf->last_is_kernel = -1; cpu_buf->last_task = NULL; } /* compute number of available slots in cpu_buffer queue */ static unsigned long nr_available_slots(struct oprofile_cpu_buffer const *b) { Loading drivers/oprofile/cpu_buffer.h +13 −15 Original line number Diff line number Diff line Loading @@ -50,7 +50,19 @@ struct oprofile_cpu_buffer { DECLARE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer); void cpu_buffer_reset(struct oprofile_cpu_buffer *cpu_buf); /* * Resets the cpu buffer to a sane state. * * reset these to invalid values; the next sample collected will * populate the buffer with proper values to initialize the buffer */ static inline void cpu_buffer_reset(int cpu) { struct oprofile_cpu_buffer *cpu_buf = &per_cpu(cpu_buffer, cpu); cpu_buf->last_is_kernel = -1; cpu_buf->last_task = NULL; } static inline struct op_sample *cpu_buffer_write_entry(struct oprofile_cpu_buffer *cpu_buf) Loading Loading @@ -88,20 +100,6 @@ unsigned long cpu_buffer_entries(struct oprofile_cpu_buffer *b) unsigned long head = b->head_pos; unsigned long tail = b->tail_pos; /* * Subtle. This resets the persistent last_task * and in_kernel values used for switching notes. * BUT, there is a small window between reading * head_pos, and this call, that means samples * can appear at the new head position, but not * be prefixed with the notes for switching * kernel mode or a task switch. This small hole * can lead to mis-attribution or samples where * we don't know if it's in the kernel or not, * at the start of an event buffer. */ cpu_buffer_reset(b); if (head >= tail) return head - tail; Loading Loading
drivers/oprofile/buffer_sync.c +1 −0 Original line number Diff line number Diff line Loading @@ -548,6 +548,7 @@ void sync_buffer(int cpu) /* Remember, only we can modify tail_pos */ cpu_buffer_reset(cpu); #ifndef CONFIG_OPROFILE_IBS available = cpu_buffer_entries(cpu_buf); Loading
drivers/oprofile/cpu_buffer.c +0 −12 Original line number Diff line number Diff line Loading @@ -124,18 +124,6 @@ void end_cpu_work(void) flush_scheduled_work(); } /* Resets the cpu buffer to a sane state. */ void cpu_buffer_reset(struct oprofile_cpu_buffer *cpu_buf) { /* * reset these to invalid values; the next sample collected * will populate the buffer with proper values to initialize * the buffer */ cpu_buf->last_is_kernel = -1; cpu_buf->last_task = NULL; } /* compute number of available slots in cpu_buffer queue */ static unsigned long nr_available_slots(struct oprofile_cpu_buffer const *b) { Loading
drivers/oprofile/cpu_buffer.h +13 −15 Original line number Diff line number Diff line Loading @@ -50,7 +50,19 @@ struct oprofile_cpu_buffer { DECLARE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer); void cpu_buffer_reset(struct oprofile_cpu_buffer *cpu_buf); /* * Resets the cpu buffer to a sane state. * * reset these to invalid values; the next sample collected will * populate the buffer with proper values to initialize the buffer */ static inline void cpu_buffer_reset(int cpu) { struct oprofile_cpu_buffer *cpu_buf = &per_cpu(cpu_buffer, cpu); cpu_buf->last_is_kernel = -1; cpu_buf->last_task = NULL; } static inline struct op_sample *cpu_buffer_write_entry(struct oprofile_cpu_buffer *cpu_buf) Loading Loading @@ -88,20 +100,6 @@ unsigned long cpu_buffer_entries(struct oprofile_cpu_buffer *b) unsigned long head = b->head_pos; unsigned long tail = b->tail_pos; /* * Subtle. This resets the persistent last_task * and in_kernel values used for switching notes. * BUT, there is a small window between reading * head_pos, and this call, that means samples * can appear at the new head position, but not * be prefixed with the notes for switching * kernel mode or a task switch. This small hole * can lead to mis-attribution or samples where * we don't know if it's in the kernel or not, * at the start of an event buffer. */ cpu_buffer_reset(b); if (head >= tail) return head - tail; Loading