ksoftirqd: Enable IRQs and call cond_resched() before poking RCU
[firefly-linux-kernel-4.4.55.git] / kernel / trace / ring_buffer.c
index 0bc181b0524caee6bfa703f087c65eb7d4ee66ab..ab21b8c665354a28656058b447ac8859a7c0cf37 100644 (file)
@@ -2650,7 +2650,7 @@ static DEFINE_PER_CPU(unsigned int, current_context);
 
 static __always_inline int trace_recursive_lock(void)
 {
-       unsigned int val = this_cpu_read(current_context);
+       unsigned int val = __this_cpu_read(current_context);
        int bit;
 
        if (in_interrupt()) {
@@ -2667,18 +2667,17 @@ static __always_inline int trace_recursive_lock(void)
                return 1;
 
        val |= (1 << bit);
-       this_cpu_write(current_context, val);
+       __this_cpu_write(current_context, val);
 
        return 0;
 }
 
 static __always_inline void trace_recursive_unlock(void)
 {
-       unsigned int val = this_cpu_read(current_context);
+       unsigned int val = __this_cpu_read(current_context);
 
-       val--;
-       val &= this_cpu_read(current_context);
-       this_cpu_write(current_context, val);
+       val &= val & (val - 1);
+       __this_cpu_write(current_context, val);
 }
 
 #else
@@ -3371,7 +3370,7 @@ static void rb_iter_reset(struct ring_buffer_iter *iter)
        iter->head = cpu_buffer->reader_page->read;
 
        iter->cache_reader_page = iter->head_page;
-       iter->cache_read = iter->head;
+       iter->cache_read = cpu_buffer->read;
 
        if (iter->head)
                iter->read_stamp = cpu_buffer->read_stamp;