for (i = 0; i < next; i++) { if (!mcelog.entry[i].finished) continue; 
for (i = 0; i < next; i++) { unsigned long start = jiffies; while (!mcelog.entry[i].finished) { if (!time_before(jiffies, start + 2)) { memset(mcelog.entry + i,0, sizeof(struct mce)); continue; } cpu_relax(); } 
static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff_t *off){	unsigned long *cpu_tsc;	static DECLARE_MUTEX(mce_read_sem);	unsigned next;	char __user *buf = ubuf;	int i, err;	cpu_tsc = kmalloc(NR_CPUS * sizeof(long), GFP_KERNEL);	if (!cpu_tsc)		return -ENOMEM;	down(&mce_read_sem); 	next = rcu_dereference(mcelog.next);	/* Only supports full reads right now */	if (*off != 0 || usize < MCE_LOG_LEN*sizeof(struct mce)) { 		up(&mce_read_sem);		kfree(cpu_tsc);		return -EINVAL;	}	err = 0;	for (i = 0; i < next; i++) {		if (!mcelog.entry[i].finished)			continue;		smp_rmb();		err |= copy_to_user(buf, mcelog.entry + i, sizeof(struct mce));		buf += sizeof(struct mce); 	} 	memset(mcelog.entry, 0, next * sizeof(struct mce));	mcelog.next = 0;	synchronize_sched();	/* Collect entries that were still getting written before the synchronize. */	on_each_cpu(collect_tscs, cpu_tsc, 1, 1);	for (i = next; i < MCE_LOG_LEN; i++) { 		if (mcelog.entry[i].finished && 		    mcelog.entry[i].tsc < cpu_tsc[mcelog.entry[i].cpu]) {  			err |= copy_to_user(buf, mcelog.entry+i, sizeof(struct mce));			smp_rmb();			buf += sizeof(struct mce);			memset(&mcelog.entry[i], 0, sizeof(struct mce));		}	} 		up(&mce_read_sem);	kfree(cpu_tsc);	return err ? -EFAULT : buf - ubuf; }
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/673242c10d535bfe238d9d8e82ac93432d35b88e/mce.c/clean/arch/x86_64/kernel/mce.c