Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1256751

[PATCH 1/2] clocksource: replace cycle_last validation with an equal way

From Yang Yingliang <yangyingliang@huawei.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] clocksource: replace cycle_last validation with an equal way
Date 2015-10-27 14:30 +0100
Message-ID <qocu6-5HZ-11@gated-at.bofh.it> (permalink)
References <qocu6-5HZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Mask the cycle values before subtraction. So we can use this
validation while the clocksource mask is not 64-bits.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/time/timekeeping_internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/timekeeping_internal.h b/kernel/time/timekeeping_internal.h
index 4ea005a..984f02e 100644
--- a/kernel/time/timekeeping_internal.h
+++ b/kernel/time/timekeeping_internal.h
@@ -15,7 +15,7 @@ extern void tk_debug_account_sleep_time(struct timespec64 *t);
 #ifdef CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE
 static inline cycle_t clocksource_delta(cycle_t now, cycle_t last, cycle_t mask)
 {
-	cycle_t ret = (now - last) & mask;
+	cycle_t ret = (now & mask) - (last & mask);
 
 	return (s64) ret > 0 ? ret : 0;
 }
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] validate the delta of cycle_now and cycle_last on arm64 Yang Yingliang <yangyingliang@huawei.com> - 2015-10-27 14:30 +0100
  [PATCH 2/2] arm64: validate the delta of cycle_now and cycle_last Yang Yingliang <yangyingliang@huawei.com> - 2015-10-27 14:30 +0100
    Re: [PATCH 2/2] arm64: validate the delta of cycle_now and cycle_last Mark Rutland <mark.rutland@arm.com> - 2015-10-27 15:10 +0100
      Re: [PATCH 2/2] arm64: validate the delta of cycle_now and cycle_last Ding Tianhong <dingtianhong@huawei.com> - 2015-10-28 02:40 +0100
      Re: [PATCH 2/2] arm64: validate the delta of cycle_now and cycle_last Yang Yingliang <yangyingliang@huawei.com> - 2015-10-29 08:40 +0100
        Re: [PATCH 2/2] arm64: validate the delta of cycle_now and cycle_last Yang Yingliang <yangyingliang@huawei.com> - 2015-10-29 09:40 +0100
  [PATCH 1/2] clocksource: replace cycle_last validation with an equal way Yang Yingliang <yangyingliang@huawei.com> - 2015-10-27 14:30 +0100
    Re: [PATCH 1/2] clocksource: replace cycle_last validation with an  equal way Thomas Gleixner <tglx@linutronix.de> - 2015-10-30 16:00 +0100
      Re: [PATCH 1/2] clocksource: replace cycle_last validation with an  equal way Yang Yingliang <yangyingliang@huawei.com> - 2015-10-31 11:10 +0100
      [PATCH resend] clocksource: modify the cycle_last validation to fit  for non-64bit clocksourece mask Yang Yingliang <yangyingliang@huawei.com> - 2015-10-31 11:30 +0100

csiph-web