From patchwork Tue Dec 17 19:27:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22609 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4127B23FC6 for ; Tue, 17 Dec 2013 19:27:51 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id md12sf19632238pbc.0 for ; Tue, 17 Dec 2013 11:27:50 -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=1EXCVzsCECtzew4seGFPbnGoYl4hwgPg+YTrSiSosqQ=; b=iP57Sw7TTVhObmCpPZ2NJsD0/jDwmd/P1q0gn7YevhRK8wEmSwmrg0aPFm13r8a8L3 HmEVQGKCJvfauAw4XwF5F1Ud5UUcaBLuboRJZZlR/141C2yvxvVctvmu1r0zfb/il/MF f4l1p+TdFoZwmsKdr0IZkPjvFuTO+TIK3uT8X6509WRFCEkHgdz+jB+LJlflVsco3Bd6 rd2XDDlIv2zDhucFTs9VTN94FwnM3NO2LlIeFUqx4hw/GRo0F0pbF5rbFKfWHxPxQIpA 7mmoyaEiHtERhXt9k7Y8/ndwA2Un9nLch7pLYlzRDqh2iRc4UJxfJb3rPYzPhfZK3l22 DrWw== X-Gm-Message-State: ALoCoQkZ4c/KABxwpUgS3wOiOkfOrQkmbu+7+oHE7yfM4nYQQwDydSnd6nptU/icqhHarYoWQh0W X-Received: by 10.67.21.145 with SMTP id hk17mr12235218pad.35.1387308470423; Tue, 17 Dec 2013 11:27:50 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.59.49 with SMTP id w17ls2656061qeq.68.gmail; Tue, 17 Dec 2013 11:27:50 -0800 (PST) X-Received: by 10.52.230.102 with SMTP id sx6mr9545588vdc.15.1387308470230; Tue, 17 Dec 2013 11:27:50 -0800 (PST) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id ed9si5134103vcb.81.2013.12.17.11.27.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 11:27:50 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id ks9so4378038vcb.40 for ; Tue, 17 Dec 2013 11:27:50 -0800 (PST) X-Received: by 10.58.100.244 with SMTP id fb20mr11221627veb.6.1387308470128; Tue, 17 Dec 2013 11:27:50 -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.59.13.131 with SMTP id ey3csp190153ved; Tue, 17 Dec 2013 11:27:49 -0800 (PST) X-Received: by 10.67.1.70 with SMTP id be6mr29413365pad.9.1387308468455; Tue, 17 Dec 2013 11:27:48 -0800 (PST) Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by mx.google.com with ESMTPS id tr4si12447110pab.63.2013.12.17.11.27.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 11:27:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.177 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.177; Received: by mail-pd0-f177.google.com with SMTP id q10so7156761pdj.22 for ; Tue, 17 Dec 2013 11:27:47 -0800 (PST) X-Received: by 10.67.30.70 with SMTP id kc6mr29472089pad.32.1387308467779; Tue, 17 Dec 2013 11:27:47 -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 yg3sm48436118pab.16.2013.12.17.11.27.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 11:27:46 -0800 (PST) From: John Stultz To: LKML Cc: John Stultz , Sasha Levin , Thomas Gleixner , Ingo Molnar , David Vrabel , Konrad Rzeszutek Wilk , Prarit Bhargava , Richard Cochran , , stable Subject: [PATCH 2/3] timekeeping: Fix potential lost pv notification of time change Date: Tue, 17 Dec 2013 11:27:36 -0800 Message-Id: <1387308457-25364-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1387308457-25364-1-git-send-email-john.stultz@linaro.org> References: <1387308457-25364-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.220.181 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: Sasha Levin 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 */