[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.1012161844140.12146@localhost6.localdomain6>
Date: Thu, 16 Dec 2010 18:48:12 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Richard Cochran <richardcochran@...il.com>
cc: linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
netdev@...r.kernel.org, Alan Cox <alan@...rguk.ukuu.org.uk>,
Arnd Bergmann <arnd@...db.de>,
Christoph Lameter <cl@...ux.com>,
David Miller <davem@...emloft.net>,
John Stultz <johnstul@...ibm.com>,
Krzysztof Halasa <khc@...waw.pl>,
Peter Zijlstra <peterz@...radead.org>,
Rodolfo Giometti <giometti@...ux.it>
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
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists