From patchwork Tue Dec 10 05:09:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22200 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E0B0F23A4E for ; Tue, 10 Dec 2013 05:10:19 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id m10sf476936vbh.4 for ; Mon, 09 Dec 2013 21:10:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=gZfGe7bs/tC0CgPPMDHcZtC+MOIF8YZSM70X6cYktN0=; b=QiQzaxCs1P3fCci3HuFy7OWaKRBybNgahMp9PgKYbU2rgNvx/08/MuVqghyLnVTLrY MOZxps4Zgppafnsb2xFM7k/Wmo8QILoExIlBqI+9FZC9T6M5iXatVUgu8tB1KHrBUbl4 HJRU47SEEuMPeV8p89wdVVnPpLLRIjAdE2nZ9jUVaTE1n7tC+6k+GvYPOjf39kJu5D0I 4MQaAyB4y9hJfmTn3T4DmY57T/ibppuQZWwUlHrZZWHXo2epBs1pBcEHexrVrV4mvhlj 0W15N8JTS8qBmN9Nb3x3w9dYyDF8+GMQBdxBdf8SBawrfxD82zR92l2MfLz+50qdLB4t RbzQ== X-Gm-Message-State: ALoCoQmkL7HO3wMhVNd0oAc0iI24gbgNOFRi0bA6+xpdykdkWwCcUXby4v+6vXrTNoPZx+BmG4g2 X-Received: by 10.58.237.102 with SMTP id vb6mr8220281vec.31.1386652219745; Mon, 09 Dec 2013 21:10:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.129 with SMTP id h1ls2289907qez.15.gmail; Mon, 09 Dec 2013 21:10:19 -0800 (PST) X-Received: by 10.52.163.65 with SMTP id yg1mr1267222vdb.14.1386652219630; Mon, 09 Dec 2013 21:10:19 -0800 (PST) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id c8si4671414vcq.138.2013.12.09.21.10.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Dec 2013 21:10:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.45; Received: by mail-vb0-f45.google.com with SMTP id i12so200720vbh.4 for ; Mon, 09 Dec 2013 21:10:19 -0800 (PST) X-Received: by 10.52.165.240 with SMTP id zb16mr10662558vdb.19.1386652219547; Mon, 09 Dec 2013 21:10:19 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp160474vcz; Mon, 9 Dec 2013 21:10:19 -0800 (PST) X-Received: by 10.67.5.7 with SMTP id ci7mr25240925pad.99.1386652218607; Mon, 09 Dec 2013 21:10:18 -0800 (PST) Received: from mail-pb0-f49.google.com (mail-pb0-f49.google.com [209.85.160.49]) by mx.google.com with ESMTPS id do3si9297369pbc.292.2013.12.09.21.10.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Dec 2013 21:10:18 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.49 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.160.49; Received: by mail-pb0-f49.google.com with SMTP id jt11so6837124pbb.22 for ; Mon, 09 Dec 2013 21:10:18 -0800 (PST) X-Received: by 10.68.58.137 with SMTP id r9mr13394110pbq.148.1386652218170; Mon, 09 Dec 2013 21:10:18 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id dq3sm701959pbc.35.2013.12.09.21.10.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Dec 2013 21:10:17 -0800 (PST) From: John Stultz To: LKML Cc: John Stultz , Thomas Gleixner , Ingo Molnar , David Vrabel , Konrad Rzeszutek Wilk , Prarit Bhargava , Richard Cochran , , stable Subject: [RFC][PATCH 3/3] timekeeping: Fix potential lost pv notification of time change Date: Mon, 9 Dec 2013 21:09:57 -0800 Message-Id: <1386652197-7035-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386652197-7035-1-git-send-email-john.stultz@linaro.org> References: <1386652197-7035-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In 780427f0e11 (Indicate that clock was set in the pvclock gtod notifier), logic was added to pass a CLOCK_WAS_SET notification to the pvclock notifier chain. While that patch added a action flag returned from accumulate_nsecs_to_secs(), it only uses the returned value in one location, and not in the logarithmic accumulation. This means if a leap second triggered during the logarithmic accumulation (which is most likely where it would happen), the notification that the clock was set would not make it to the pv notifiers. This patch extends the logarithmic_accumulation pass down that action flag so proper notification will occur. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: David Vrabel Cc: Konrad Rzeszutek Wilk Cc: Prarit Bhargava Cc: Richard Cochran Cc: Cc: stable #3.11+ Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index c615e9d..e429229 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1297,7 +1297,7 @@ static inline unsigned int accumulate_nsecs_to_secs(struct timekeeper *tk) * Returns the unconsumed cycles. */ static cycle_t logarithmic_accumulation(struct timekeeper *tk, cycle_t offset, - u32 shift) + u32 shift, int *action) { cycle_t interval = tk->cycle_interval << shift; u64 raw_nsecs; @@ -1311,7 +1311,7 @@ static cycle_t logarithmic_accumulation(struct timekeeper *tk, cycle_t offset, tk->cycle_last += interval; tk->xtime_nsec += tk->xtime_interval << shift; - accumulate_nsecs_to_secs(tk); + *action |= accumulate_nsecs_to_secs(tk); /* Accumulate raw time */ raw_nsecs = (u64)tk->raw_interval << shift; @@ -1369,7 +1369,7 @@ static void update_wall_time(void) struct timekeeper *tk = &shadow_timekeeper; cycle_t offset; int shift = 0, maxshift; - unsigned int action; + unsigned int action = 0; unsigned long flags; raw_spin_lock_irqsave(&timekeeper_lock, flags); @@ -1404,7 +1404,7 @@ static void update_wall_time(void) maxshift = (64 - (ilog2(ntp_tick_length())+1)) - 1; shift = min(shift, maxshift); while (offset >= tk->cycle_interval) { - offset = logarithmic_accumulation(tk, offset, shift); + offset = logarithmic_accumulation(tk, offset, shift, &action); if (offset < tk->cycle_interval<cycle_last with the new value */