lkml.org 
[lkml]   [2017]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: x86/mce: suspicious RCU usage in 4.13.4
>  	for (;;) {
> entry = mce_log_get_idx_check(mcelog.next);

Can't this get even simpler? Do we need the loop? The mutex
will now protect us while we check to see if there is a slot
to stash this new entry. Also just say:

entry = mcelog.next;

> for (;;) {
> @@ -66,10 +67,10 @@ static int dev_mce_log(struct notifier_block *nb, unsigned long val,
> * interesting ones:
> */
> if (entry >= MCE_LOG_LEN) {
> - set_bit(MCE_OVERFLOW,
> - (unsigned long *)&mcelog.flags);
> + set_bit(MCE_OVERFLOW, (unsigned long *)&mcelog.flags);

Need to mutex_unlock(&mce_chrdev_read_mutex); here.

> return NOTIFY_OK;
> }
> +
> /* Old left over entry. Skip: */
> if (mcelog.entry[entry].finished) {
> entry++;
> @@ -77,15 +78,13 @@ static int dev_mce_log(struct notifier_block *nb, unsigned long val,
> }
> break;
> }
> - smp_rmb();
> - next = entry + 1;
> - if (cmpxchg(&mcelog.next, entry, next) == entry)
> - break;

Ummm. Without this "break" how will we exit the loop (more fuel
for getting rid of the loop.

> + mcelog.next = entry + 1;
> }

-Tony

\
 
 \ /
  Last update: 2017-10-10 22:10    [W:0.074 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site