Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'rework/prb-fixes' into for-linus

+17 -14
+15 -12
kernel/printk/printk_ringbuffer.c
··· 14 14 * 15 15 * Data Structure 16 16 * -------------- 17 - * The printk_ringbuffer is made up of 3 internal ringbuffers: 17 + * The printk_ringbuffer is made up of 2 internal ringbuffers: 18 18 * 19 19 * desc_ring 20 20 * A ring of descriptors and their meta data (such as sequence number, ··· 224 224 * 225 225 * prb_rec_init_rd(&r, &info, &text_buf[0], sizeof(text_buf)); 226 226 * 227 - * prb_for_each_record(0, &test_rb, &seq, &r) { 227 + * prb_for_each_record(0, &test_rb, seq, &r) { 228 228 * if (info.seq != seq) 229 229 * pr_warn("lost %llu records\n", info.seq - seq); 230 230 * ··· 1302 1302 return NULL; 1303 1303 } 1304 1304 1305 - /* Sanity check. Data-less blocks were handled earlier. */ 1306 - if (WARN_ON_ONCE(!data_check_size(data_ring, *data_size) || !*data_size)) 1307 - return NULL; 1308 - 1309 1305 /* A valid data block will always be aligned to the ID size. */ 1310 1306 if (WARN_ON_ONCE(blk_lpos->begin != ALIGN(blk_lpos->begin, sizeof(db->id))) || 1311 1307 WARN_ON_ONCE(blk_lpos->next != ALIGN(blk_lpos->next, sizeof(db->id)))) { 1312 1308 return NULL; 1313 1309 } 1314 1310 1315 - /* A valid data block will always have at least an ID. */ 1316 - if (WARN_ON_ONCE(*data_size < sizeof(db->id))) 1311 + /* 1312 + * A regular data block will always have an ID and at least 1313 + * 1 byte of data. Data-less blocks were handled earlier. 1314 + */ 1315 + if (WARN_ON_ONCE(*data_size <= sizeof(db->id))) 1317 1316 return NULL; 1318 1317 1319 1318 /* Subtract block ID space from size to reflect data size. */ 1320 1319 *data_size -= sizeof(db->id); 1320 + 1321 + /* Sanity check the max size of the regular data block. */ 1322 + if (WARN_ON_ONCE(!data_check_size(data_ring, *data_size))) 1323 + return NULL; 1321 1324 1322 1325 return &db->data[0]; 1323 1326 } ··· 1368 1365 * 1369 1366 * WMB from _prb_commit:A to _prb_commit:B 1370 1367 * matching 1371 - * MB If desc_reopen_last:A to prb_reserve_in_last:A 1368 + * MB from desc_reopen_last:A to prb_reserve_in_last:A 1372 1369 */ 1373 1370 if (!atomic_long_try_cmpxchg(&d->state_var, &prev_state_val, 1374 1371 DESC_SV(id, desc_reserved))) { /* LMM(desc_reopen_last:A) */ ··· 1773 1770 * 1774 1771 * Relies on: 1775 1772 * 1776 - * MB _prb_commit:B to prb_commit:A 1773 + * MB from _prb_commit:B to prb_commit:A 1777 1774 * matching 1778 - * MB desc_reserve:D to desc_make_final:A 1775 + * MB from desc_reserve:D to desc_make_final:A 1779 1776 */ 1780 1777 if (!atomic_long_try_cmpxchg(&d->state_var, &prev_state_val, 1781 1778 DESC_SV(e->id, state_val))) { /* LMM(_prb_commit:B) */ ··· 2038 2035 * 2039 2036 * MB from desc_push_tail:B to desc_reserve:F 2040 2037 * matching 2041 - * RMB prb_first_seq:B to prb_first_seq:A 2038 + * RMB from prb_first_seq:B to prb_first_seq:A 2042 2039 */ 2043 2040 smp_rmb(); /* LMM(prb_first_seq:C) */ 2044 2041 }
+2 -2
kernel/printk/printk_ringbuffer.h
··· 127 127 }; 128 128 129 129 #define _DATA_SIZE(sz_bits) (1UL << (sz_bits)) 130 - #define _DESCS_COUNT(ct_bits) (1U << (ct_bits)) 130 + #define _DESCS_COUNT(ct_bits) (1UL << (ct_bits)) 131 131 #define DESC_SV_BITS BITS_PER_LONG 132 132 #define DESC_FLAGS_SHIFT (DESC_SV_BITS - 2) 133 133 #define DESC_FLAGS_MASK (3UL << DESC_FLAGS_SHIFT) ··· 388 388 * 389 389 * This is a macro for conveniently iterating over a ringbuffer. 390 390 * Note that @s may not be the sequence number of the record on each 391 - * iteration. For the sequence number, @r->info->seq should be checked. 391 + * iteration. For the sequence number, @i->seq should be checked. 392 392 * 393 393 * Context: Any context. 394 394 */