All of lore.kernel.org
 help / color / mirror / Atom feed
From: akpm@linux-foundation.org
To: johnstul@us.ibm.com, tglx@linutronix.de, ziegler@uni-freiburg.de,
	zippel@linux-m68k.org, mm-commits@vger.kernel.org
Subject: - ntp-fix-adjtimex-freq-return-error.patch removed from -mm tree
Date: Wed, 20 Aug 2008 20:12:37 -0700	[thread overview]
Message-ID: <200808210312.m7L3CbMu013997@imap1.linux-foundation.org> (raw)


The patch titled
     ntp: fix adjtimex() freq return error
has been removed from the -mm tree.  Its filename was
     ntp-fix-adjtimex-freq-return-error.patch

This patch was dropped because an updated version will be merged

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: ntp: fix adjtimex() freq return error
From: john stultz <johnstul@us.ibm.com>

Martin Ziegler reported a bug in adjtimex(), where odd positive
frequencies are reduced by 1 while negative values are correct.

See http://bugzilla.kernel.org/show_bug.cgi?id=11370 for details

The issue was introduced in the following commit that increased time_freq
to a 64bit value and increased its resolution:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=074b3b87941c99bc0ce35385b5817924b1ed0c23;hp=eea83d896e318bda54be2d2770d2c5d6668d11db

The problem is how we convert from our internal high res value back to
userland.  Instead of dividing, we shift, then mult, then shift again,
causing the slight error seen in the bug.

I don't think adjtimex() is a terribly hot path, so this patch simply uses
div_s64() to convert back to the external resolution and removes the
unused shift defines to resolve the issue.

Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Reported-by: Martin Ziegler <ziegler@uni-freiburg.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable.kernel.org>		[2.6.25.x, 2.6.26.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/timex.h |    3 ---
 kernel/time/ntp.c     |    4 +---
 2 files changed, 1 insertion(+), 6 deletions(-)

diff -puN include/linux/timex.h~ntp-fix-adjtimex-freq-return-error include/linux/timex.h
--- a/include/linux/timex.h~ntp-fix-adjtimex-freq-return-error
+++ a/include/linux/timex.h
@@ -82,9 +82,6 @@
  */
 #define SHIFT_USEC 16		/* frequency offset scale (shift) */
 #define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
-#define PPM_SCALE_INV_SHIFT 20
-#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
-		       PPM_SCALE + 1)
 
 #define MAXPHASE 500000000l	/* max phase error (ns) */
 #define MAXFREQ 500000		/* max frequency error (ns/s) */
diff -puN kernel/time/ntp.c~ntp-fix-adjtimex-freq-return-error kernel/time/ntp.c
--- a/kernel/time/ntp.c~ntp-fix-adjtimex-freq-return-error
+++ a/kernel/time/ntp.c
@@ -402,9 +402,7 @@ int do_adjtimex(struct timex *txc)
 		if (!(time_status & STA_NANO))
 			txc->offset /= NSEC_PER_USEC;
 	}
-	txc->freq	   = shift_right((s32)(time_freq >> PPM_SCALE_INV_SHIFT) *
-					 (s64)PPM_SCALE_INV,
-					 NTP_SCALE_SHIFT);
+	txc->freq	   = div_s64(time_freq, PPM_SCALE);
 	txc->maxerror	   = time_maxerror;
 	txc->esterror	   = time_esterror;
 	txc->status	   = time_status;
_

Patches currently in -mm which might be from johnstul@us.ibm.com are

ntp-fix-adjtimex-freq-return-error.patch
timekeeping-fix-rounding-problem-during-clock-update.patch
ntp-fix-adj_offset_ss_read-bug-and-do_adjtimex-cleanup.patch
linux-timexh-cleanup-for-userspace.patch
clocksource-fix-a-print-format-error-in-the-acpi-pm-clocksource-driver-and-check-range.patch
clocksource-keep-track-of-original-clocksource-frequency.patch
clocksource-introduce-clocksource_forward_now.patch
clocksource-introduce-clock_monotonic_raw.patch


                 reply	other threads:[~2008-08-21  3:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200808210312.m7L3CbMu013997@imap1.linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=ziegler@uni-freiburg.de \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.