From patchwork Wed Dec 11 19:11:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22253 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6847F202E6 for ; Wed, 11 Dec 2013 19:11:49 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id oz11sf14399303veb.4 for ; Wed, 11 Dec 2013 11:11:49 -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=ZEEzlNfo1GQZUwWeWPVJZXA7a6mIiQ+ZrVkXS2koi/8=; b=XM3BqxAGj9GXwou4pjoy+jEVywfqemYNAqEI3pIR7K9jRlx4tq+6IXKXXjoVj97o5g r9F1Er7b2KYaxPSoDsLn9/dfvg7lQFCaxH/0OIe8QSoARg5SNUE1b6FFvdfA3Pxbdz/5 u4vgkL9/Gwr3wmg3C6eLWqlDYqUvmVMsDeh91vi126oViql/BiAFz8fhgdwKXeHT5SuO tc2FYZZl6UkvRjXzinEL8d4LViFDX+1iZaYYhHBtBvtHjHjgTXBz4EOJtHA9uVBf7jMO x+SXTuiC5gpaGrwxmBIOOYpr6rXC/EDBBaw/xgXWqWfkldfhdR5NVQea5lTQgplMtGeS qLMw== X-Gm-Message-State: ALoCoQm9dxJjki9pN0GkyyCrunhGfWAHOviI0RZ70vmzgT8ulgWjhFzKwMOGUxSJlAO7ywLfKHuI X-Received: by 10.236.133.161 with SMTP id q21mr1063252yhi.18.1386789109087; Wed, 11 Dec 2013 11:11:49 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.88.68 with SMTP id be4ls190242qeb.46.gmail; Wed, 11 Dec 2013 11:11:49 -0800 (PST) X-Received: by 10.220.84.65 with SMTP id i1mr696807vcl.51.1386789108991; Wed, 11 Dec 2013 11:11:48 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id uw4si6746671vec.39.2013.12.11.11.11.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Dec 2013 11:11:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 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.47; Received: by mail-vb0-f47.google.com with SMTP id q12so1932527vbe.20 for ; Wed, 11 Dec 2013 11:11:48 -0800 (PST) X-Received: by 10.53.13.44 with SMTP id ev12mr1019167vdd.17.1386789108914; Wed, 11 Dec 2013 11:11:48 -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 u4csp296248vcz; Wed, 11 Dec 2013 11:11:47 -0800 (PST) X-Received: by 10.68.236.133 with SMTP id uu5mr3861705pbc.153.1386789106926; Wed, 11 Dec 2013 11:11:46 -0800 (PST) Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com [209.85.192.173]) by mx.google.com with ESMTPS id w3si14374226pbh.59.2013.12.11.11.11.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Dec 2013 11:11:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.173 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.173; Received: by mail-pd0-f173.google.com with SMTP id p10so10034699pdj.18 for ; Wed, 11 Dec 2013 11:11:46 -0800 (PST) X-Received: by 10.68.32.231 with SMTP id m7mr4129555pbi.22.1386789106485; Wed, 11 Dec 2013 11:11:46 -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 ki1sm34506989pbd.1.2013.12.11.11.11.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Dec 2013 11:11:45 -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 2/5] timekeeping: Fix potential lost pv notification of time change Date: Wed, 11 Dec 2013 11:11:35 -0800 Message-Id: <1386789098-17391-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386789098-17391-1-git-send-email-john.stultz@linaro.org> References: <1386789098-17391-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.47 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 6bad3d9..998ec751 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1295,7 +1295,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, unsigned int *action) { cycle_t interval = tk->cycle_interval << shift; u64 raw_nsecs; @@ -1309,7 +1309,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; @@ -1367,7 +1367,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); @@ -1402,7 +1402,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 */