Messages in this thread | | | Date | Tue, 10 Oct 2017 13:08:41 -0700 | From | "Luck, Tony" <> | Subject | Re: 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
| |