diff options
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r-- | kernel/trace/ring_buffer.c | 57 |
1 files changed, 19 insertions, 38 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index ff7027199a9a..afb04b9b818a 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -1689,22 +1689,14 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size, | |||
1689 | if (!cpu_buffer->nr_pages_to_update) | 1689 | if (!cpu_buffer->nr_pages_to_update) |
1690 | continue; | 1690 | continue; |
1691 | 1691 | ||
1692 | /* The update must run on the CPU that is being updated. */ | 1692 | /* Can't run something on an offline CPU. */ |
1693 | preempt_disable(); | 1693 | if (!cpu_online(cpu)) { |
1694 | if (cpu == smp_processor_id() || !cpu_online(cpu)) { | ||
1695 | rb_update_pages(cpu_buffer); | 1694 | rb_update_pages(cpu_buffer); |
1696 | cpu_buffer->nr_pages_to_update = 0; | 1695 | cpu_buffer->nr_pages_to_update = 0; |
1697 | } else { | 1696 | } else { |
1698 | /* | ||
1699 | * Can not disable preemption for schedule_work_on() | ||
1700 | * on PREEMPT_RT. | ||
1701 | */ | ||
1702 | preempt_enable(); | ||
1703 | schedule_work_on(cpu, | 1697 | schedule_work_on(cpu, |
1704 | &cpu_buffer->update_pages_work); | 1698 | &cpu_buffer->update_pages_work); |
1705 | preempt_disable(); | ||
1706 | } | 1699 | } |
1707 | preempt_enable(); | ||
1708 | } | 1700 | } |
1709 | 1701 | ||
1710 | /* wait for all the updates to complete */ | 1702 | /* wait for all the updates to complete */ |
@@ -1742,22 +1734,14 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size, | |||
1742 | 1734 | ||
1743 | get_online_cpus(); | 1735 | get_online_cpus(); |
1744 | 1736 | ||
1745 | preempt_disable(); | 1737 | /* Can't run something on an offline CPU. */ |
1746 | /* The update must run on the CPU that is being updated. */ | 1738 | if (!cpu_online(cpu_id)) |
1747 | if (cpu_id == smp_processor_id() || !cpu_online(cpu_id)) | ||
1748 | rb_update_pages(cpu_buffer); | 1739 | rb_update_pages(cpu_buffer); |
1749 | else { | 1740 | else { |
1750 | /* | ||
1751 | * Can not disable preemption for schedule_work_on() | ||
1752 | * on PREEMPT_RT. | ||
1753 | */ | ||
1754 | preempt_enable(); | ||
1755 | schedule_work_on(cpu_id, | 1741 | schedule_work_on(cpu_id, |
1756 | &cpu_buffer->update_pages_work); | 1742 | &cpu_buffer->update_pages_work); |
1757 | wait_for_completion(&cpu_buffer->update_done); | 1743 | wait_for_completion(&cpu_buffer->update_done); |
1758 | preempt_disable(); | ||
1759 | } | 1744 | } |
1760 | preempt_enable(); | ||
1761 | 1745 | ||
1762 | cpu_buffer->nr_pages_to_update = 0; | 1746 | cpu_buffer->nr_pages_to_update = 0; |
1763 | put_online_cpus(); | 1747 | put_online_cpus(); |
@@ -1984,7 +1968,7 @@ rb_add_time_stamp(struct ring_buffer_event *event, u64 delta) | |||
1984 | 1968 | ||
1985 | /** | 1969 | /** |
1986 | * rb_update_event - update event type and data | 1970 | * rb_update_event - update event type and data |
1987 | * @event: the even to update | 1971 | * @event: the event to update |
1988 | * @type: the type of event | 1972 | * @type: the type of event |
1989 | * @length: the size of the event field in the ring buffer | 1973 | * @length: the size of the event field in the ring buffer |
1990 | * | 1974 | * |
@@ -3357,21 +3341,16 @@ static void rb_iter_reset(struct ring_buffer_iter *iter) | |||
3357 | struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; | 3341 | struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; |
3358 | 3342 | ||
3359 | /* Iterator usage is expected to have record disabled */ | 3343 | /* Iterator usage is expected to have record disabled */ |
3360 | if (list_empty(&cpu_buffer->reader_page->list)) { | 3344 | iter->head_page = cpu_buffer->reader_page; |
3361 | iter->head_page = rb_set_head_page(cpu_buffer); | 3345 | iter->head = cpu_buffer->reader_page->read; |
3362 | if (unlikely(!iter->head_page)) | 3346 | |
3363 | return; | 3347 | iter->cache_reader_page = iter->head_page; |
3364 | iter->head = iter->head_page->read; | 3348 | iter->cache_read = iter->head; |
3365 | } else { | 3349 | |
3366 | iter->head_page = cpu_buffer->reader_page; | ||
3367 | iter->head = cpu_buffer->reader_page->read; | ||
3368 | } | ||
3369 | if (iter->head) | 3350 | if (iter->head) |
3370 | iter->read_stamp = cpu_buffer->read_stamp; | 3351 | iter->read_stamp = cpu_buffer->read_stamp; |
3371 | else | 3352 | else |
3372 | iter->read_stamp = iter->head_page->page->time_stamp; | 3353 | iter->read_stamp = iter->head_page->page->time_stamp; |
3373 | iter->cache_reader_page = cpu_buffer->reader_page; | ||
3374 | iter->cache_read = cpu_buffer->read; | ||
3375 | } | 3354 | } |
3376 | 3355 | ||
3377 | /** | 3356 | /** |
@@ -3764,18 +3743,20 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts) | |||
3764 | return NULL; | 3743 | return NULL; |
3765 | 3744 | ||
3766 | /* | 3745 | /* |
3767 | * We repeat when a time extend is encountered. | 3746 | * We repeat when a time extend is encountered or we hit |
3768 | * Since the time extend is always attached to a data event, | 3747 | * the end of the page. Since the time extend is always attached |
3769 | * we should never loop more than once. | 3748 | * to a data event, we should never loop more than three times. |
3770 | * (We never hit the following condition more than twice). | 3749 | * Once for going to next page, once on time extend, and |
3750 | * finally once to get the event. | ||
3751 | * (We never hit the following condition more than thrice). | ||
3771 | */ | 3752 | */ |
3772 | if (RB_WARN_ON(cpu_buffer, ++nr_loops > 2)) | 3753 | if (RB_WARN_ON(cpu_buffer, ++nr_loops > 3)) |
3773 | return NULL; | 3754 | return NULL; |
3774 | 3755 | ||
3775 | if (rb_per_cpu_empty(cpu_buffer)) | 3756 | if (rb_per_cpu_empty(cpu_buffer)) |
3776 | return NULL; | 3757 | return NULL; |
3777 | 3758 | ||
3778 | if (iter->head >= local_read(&iter->head_page->page->commit)) { | 3759 | if (iter->head >= rb_page_size(iter->head_page)) { |
3779 | rb_inc_iter(iter); | 3760 | rb_inc_iter(iter); |
3780 | goto again; | 3761 | goto again; |
3781 | } | 3762 | } |