[coreboot-gerrit] New patch to review for coreboot: lib/timestamp.c: only log "Timestamp table full" once

Ben Gardner (gardner.ben@gmail.com) gerrit at coreboot.org
Fri Nov 20 18:23:16 CET 2015


Ben Gardner (gardner.ben at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12506

-gerrit

commit b8f7d25bd5dd6f55bb5019dcd27f6b7edbe6d563
Author: Ben Gardner <gardner.ben at gmail.com>
Date:   Fri Nov 20 11:22:09 2015 -0600

    lib/timestamp.c: only log "Timestamp table full" once
    
    If the timestamp table gets corrupted (separate issue), the
    timestamp_sync_cache_to_cbmem() function may add a large number of bogus
    timestamp entries.
    
    This causes a flood of "ERROR: Timestamp table full".  With logs going
    to a serial console, this renders the system essentially unbootable.
    
    There really isn't a need to log that more than once, so log it when the
    last slot in the timestamp table is filled.
    
    Change-Id: I05d131183afceca31f4dac91c5edc95cfb1e443f
    Signed-off-by: Ben Gardner <gardner.ben at gmail.com>
---
 src/lib/timestamp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index e07fd4b..130b189 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -152,14 +152,17 @@ static void timestamp_add_table_entry(struct timestamp_table *ts_table,
 {
 	struct timestamp_entry *tse;
 
-	if (ts_table->num_entries == ts_table->max_entries) {
-		printk(BIOS_ERR, "ERROR: Timestamp table full\n");
+	if (ts_table->num_entries >= ts_table->max_entries) {
 		return;
 	}
 
 	tse = &ts_table->entries[ts_table->num_entries++];
 	tse->entry_id = id;
 	tse->entry_stamp = ts_time - ts_table->base_time;
+
+	if (ts_table->num_entries == ts_table->max_entries) {
+		printk(BIOS_ERR, "ERROR: Timestamp table full\n");
+	}
 }
 
 void timestamp_add(enum timestamp_id id, uint64_t ts_time)



More information about the coreboot-gerrit mailing list