mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 05:17:10 +09:00
Merge tag 'v4.9.331' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable into odroidg12-4.9.y
This is the 4.9.331 stable release Change-Id: Ibfb959b1064dcc7143b46f098df672e79d32feaf
This commit is contained in:
@@ -32,6 +32,13 @@
|
||||
|
||||
#define GCOV_TAG_FUNCTION_LENGTH 3
|
||||
|
||||
/* Since GCC 12.1 sizes are in BYTES and not in WORDS (4B). */
|
||||
#if (__GNUC__ >= 12)
|
||||
#define GCOV_UNIT_SIZE 4
|
||||
#else
|
||||
#define GCOV_UNIT_SIZE 1
|
||||
#endif
|
||||
|
||||
static struct gcov_info *gcov_info_head;
|
||||
|
||||
/**
|
||||
@@ -438,12 +445,18 @@ static size_t convert_to_gcda(char *buffer, struct gcov_info *info)
|
||||
pos += store_gcov_u32(buffer, pos, info->version);
|
||||
pos += store_gcov_u32(buffer, pos, info->stamp);
|
||||
|
||||
#if (__GNUC__ >= 12)
|
||||
/* Use zero as checksum of the compilation unit. */
|
||||
pos += store_gcov_u32(buffer, pos, 0);
|
||||
#endif
|
||||
|
||||
for (fi_idx = 0; fi_idx < info->n_functions; fi_idx++) {
|
||||
fi_ptr = info->functions[fi_idx];
|
||||
|
||||
/* Function record. */
|
||||
pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION);
|
||||
pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH);
|
||||
pos += store_gcov_u32(buffer, pos,
|
||||
GCOV_TAG_FUNCTION_LENGTH * GCOV_UNIT_SIZE);
|
||||
pos += store_gcov_u32(buffer, pos, fi_ptr->ident);
|
||||
pos += store_gcov_u32(buffer, pos, fi_ptr->lineno_checksum);
|
||||
pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum);
|
||||
@@ -457,7 +470,8 @@ static size_t convert_to_gcda(char *buffer, struct gcov_info *info)
|
||||
/* Counter record. */
|
||||
pos += store_gcov_u32(buffer, pos,
|
||||
GCOV_TAG_FOR_COUNTER(ct_idx));
|
||||
pos += store_gcov_u32(buffer, pos, ci_ptr->num * 2);
|
||||
pos += store_gcov_u32(buffer, pos,
|
||||
ci_ptr->num * 2 * GCOV_UNIT_SIZE);
|
||||
|
||||
for (cv_idx = 0; cv_idx < ci_ptr->num; cv_idx++) {
|
||||
pos += store_gcov_u64(buffer, pos,
|
||||
|
||||
@@ -513,8 +513,9 @@ static void rb_wake_up_waiters(struct irq_work *work)
|
||||
struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work);
|
||||
|
||||
wake_up_all(&rbwork->waiters);
|
||||
if (rbwork->wakeup_full) {
|
||||
if (rbwork->full_waiters_pending || rbwork->wakeup_full) {
|
||||
rbwork->wakeup_full = false;
|
||||
rbwork->full_waiters_pending = false;
|
||||
wake_up_all(&rbwork->full_waiters);
|
||||
}
|
||||
}
|
||||
@@ -2121,6 +2122,9 @@ rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer,
|
||||
/* Mark the rest of the page with padding */
|
||||
rb_event_set_padding(event);
|
||||
|
||||
/* Make sure the padding is visible before the write update */
|
||||
smp_wmb();
|
||||
|
||||
/* Set the write back to the previous setting */
|
||||
local_sub(length, &tail_page->write);
|
||||
return;
|
||||
@@ -2132,6 +2136,9 @@ rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer,
|
||||
/* time delta must be non zero */
|
||||
event->time_delta = 1;
|
||||
|
||||
/* Make sure the padding is visible before the tail_page->write update */
|
||||
smp_wmb();
|
||||
|
||||
/* Set write to end of buffer */
|
||||
length = (tail + length) - BUF_PAGE_SIZE;
|
||||
local_sub(length, &tail_page->write);
|
||||
@@ -3723,6 +3730,33 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
|
||||
arch_spin_unlock(&cpu_buffer->lock);
|
||||
local_irq_restore(flags);
|
||||
|
||||
/*
|
||||
* The writer has preempt disable, wait for it. But not forever
|
||||
* Although, 1 second is pretty much "forever"
|
||||
*/
|
||||
#define USECS_WAIT 1000000
|
||||
for (nr_loops = 0; nr_loops < USECS_WAIT; nr_loops++) {
|
||||
/* If the write is past the end of page, a writer is still updating it */
|
||||
if (likely(!reader || rb_page_write(reader) <= BUF_PAGE_SIZE))
|
||||
break;
|
||||
|
||||
udelay(1);
|
||||
|
||||
/* Get the latest version of the reader write value */
|
||||
smp_rmb();
|
||||
}
|
||||
|
||||
/* The writer is not moving forward? Something is wrong */
|
||||
if (RB_WARN_ON(cpu_buffer, nr_loops == USECS_WAIT))
|
||||
reader = NULL;
|
||||
|
||||
/*
|
||||
* Make sure we see any padding after the write update
|
||||
* (see rb_reset_tail())
|
||||
*/
|
||||
smp_rmb();
|
||||
|
||||
|
||||
return reader;
|
||||
}
|
||||
|
||||
@@ -4623,7 +4657,15 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
|
||||
unsigned int pos = 0;
|
||||
unsigned int size;
|
||||
|
||||
if (full)
|
||||
/*
|
||||
* If a full page is expected, this can still be returned
|
||||
* if there's been a previous partial read and the
|
||||
* rest of the page can be read and the commit page is off
|
||||
* the reader page.
|
||||
*/
|
||||
if (full &&
|
||||
(!read || (len < (commit - read)) ||
|
||||
cpu_buffer->reader_page == cpu_buffer->commit_page))
|
||||
goto out_unlock;
|
||||
|
||||
if (len > (commit - read))
|
||||
|
||||
Reference in New Issue
Block a user