Messages in this thread | | | Date | Thu, 16 Dec 2010 18:48:12 +0100 (CET) | From | Thomas Gleixner <> | Subject | Re: [PATCH V7 1/8] ntp: add ADJ_SETOFFSET mode bit |
| |
On Thu, 16 Dec 2010, Richard Cochran wrote: > + if (txc->modes & ADJ_SETOFFSET) { > + /* Validate the delta value. */ > + if (txc->time.tv_sec && txc->time.tv_usec < 0) > + return -EINVAL; > + > + if (txc->modes & ADJ_NANO) { > + struct timespec tmp; > + tmp.tv_sec = txc->time.tv_sec; > + tmp.tv_nsec = txc->time.tv_usec; > + delta = timespec_to_ktime(tmp); > + } else > + delta = timeval_to_ktime(txc->time); > + > + /* Adding the delta should be an "atomic" operation. */ > + local_irq_disable();
I really do not like that conditional irq_disable(), especially as we disable them further down again and we only safe the getnstimeofday() call in the non ADJSETOFFSET code path.
So we really better do that unconditionally before getnstimeofday() with an appropriate comment and change the write_seqlock_irq() to write_seqlock().
> + } > + > getnstimeofday(&ts); > > + if (txc->modes & ADJ_SETOFFSET) { > + kt = timespec_to_ktime(ts); > + kt = ktime_add(kt, delta); > + ts = ktime_to_timespec(kt); > + do_settimeofday(&ts); > + local_irq_enable(); > + } > + > write_seqlock_irq(&xtime_lock);
Thanks,
tglx >
| |