Re: i386 nmi_watchdog: Merge check_nmi_watchdog fixes from x86_64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 18 Oct 2005, Eric W. Biederman wrote:

> Andy Isaacson <[email protected]> writes:
> 
> > +static __init void nmi_cpu_busy(void *data)
> > +{
> > +	volatile int *endflag = data;
> > +	local_irq_enable();
> > +	while (*endflag == 0)
> > +		barrier();
> > +}
> >  static int __init check_nmi_watchdog(void)
> >  {
> > +	volatile int endflag = 0;
> > ...
> > +	if (nmi_watchdog == NMI_LOCAL_APIC)
> > +		smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
> > ...
> > +	endflag = 1;
> > 	printk("OK.\n");
> >         if (nmi_watchdog == NMI_LOCAL_APIC)
> > 		nmi_hz = 1;
> > +       kfree(prev_nmi_count);
> > 	return 0;
> > }
> 
> Probably a counter, to ensure the code exits.  The code prints

Why not just use the 'wait' variable to smp_call_function to at least 
ensure that the lifetime of endflag isn't exceeded? Something like;

static __init void nmi_cpu_busy(void *data)
{
	volatile int *endflag = data;
	local_irq_enable();
	while (*endflag == 0) {
		cpu_relax();
		rmb();
	}
}

static int __init check_nmi_watchdog(void)
{
	volatile int endflag = 0;
...
	if (nmi_watchdog == NMI_LOCAL_APIC)
		smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 1);
...
	endflag = 1;
	wmb();

Thanks,
	Zwane
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux