From: Huacai Chen <chenhc@lemote.com> To: Andy Lutomirski <luto@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de>, Vincenzo Frascino <vincenzo.frascino@arm.com>, chenhuacai@gmail.com, linux-kernel@vger.kernel.org, Huacai Chen <chenhc@lemote.com>, stable@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Paul Burton <paul.burton@mips.com>, linux-mips@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] timekeeping/vsyscall: Update vdso data unconditionally Date: Thu, 24 Oct 2019 11:28:29 +0800 [thread overview] Message-ID: <1571887709-11447-1-git-send-email-chenhc@lemote.com> (raw) In do_hres(), we currently use whether the return value of __arch_get_ hw_counter() is negative to indicate fallback, but MIPS returns 0 when clock_mode is invalid. It is sure that MIPS has a bug when clock_mode is invalid and should return ULL_MAX as ARM64 does (Vincenzo has already submitted a patch). But at the time we found another bug: currently update_vsyscall() and update_vsyscall_tz() rely on __arch_use_vsyscall() to update the vdso data, which causes __cvdso_clock_getres() and some other functions get wrong results when clock_mode is invalid. So, in this patch we update vdso data unconditionally. Fixes: 44f57d788e7deecb50 ("timekeeping: Provide a generic update_vsyscall() implementation") Cc: stable@vger.kernel.org Cc: Arnd Bergmann <arnd@arndb.de> Cc: Paul Burton <paul.burton@mips.com> Cc: linux-mips@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Huacai Chen <chenhc@lemote.com> --- kernel/time/vsyscall.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/time/vsyscall.c b/kernel/time/vsyscall.c index 4bc37ac..5ee0f77 100644 --- a/kernel/time/vsyscall.c +++ b/kernel/time/vsyscall.c @@ -110,8 +110,7 @@ void update_vsyscall(struct timekeeper *tk) nsec = nsec + tk->wall_to_monotonic.tv_nsec; vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec); - if (__arch_use_vsyscall(vdata)) - update_vdso_data(vdata, tk); + update_vdso_data(vdata, tk); __arch_update_vsyscall(vdata, tk); @@ -124,10 +123,8 @@ void update_vsyscall_tz(void) { struct vdso_data *vdata = __arch_get_k_vdso_data(); - if (__arch_use_vsyscall(vdata)) { - vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest; - vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime; - } + vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest; + vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime; __arch_sync_vdso_data(vdata); } -- 2.7.0
WARNING: multiple messages have this Message-ID (diff)
From: Huacai Chen <chenhc@lemote.com> To: Andy Lutomirski <luto@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de>, chenhuacai@gmail.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-mips@vger.kernel.org, Paul Burton <paul.burton@mips.com>, Huacai Chen <chenhc@lemote.com>, Thomas Gleixner <tglx@linutronix.de>, Vincenzo Frascino <vincenzo.frascino@arm.com>, linux-arm-kernel@lists.infradead.org Subject: [PATCH] timekeeping/vsyscall: Update vdso data unconditionally Date: Thu, 24 Oct 2019 11:28:29 +0800 [thread overview] Message-ID: <1571887709-11447-1-git-send-email-chenhc@lemote.com> (raw) In do_hres(), we currently use whether the return value of __arch_get_ hw_counter() is negative to indicate fallback, but MIPS returns 0 when clock_mode is invalid. It is sure that MIPS has a bug when clock_mode is invalid and should return ULL_MAX as ARM64 does (Vincenzo has already submitted a patch). But at the time we found another bug: currently update_vsyscall() and update_vsyscall_tz() rely on __arch_use_vsyscall() to update the vdso data, which causes __cvdso_clock_getres() and some other functions get wrong results when clock_mode is invalid. So, in this patch we update vdso data unconditionally. Fixes: 44f57d788e7deecb50 ("timekeeping: Provide a generic update_vsyscall() implementation") Cc: stable@vger.kernel.org Cc: Arnd Bergmann <arnd@arndb.de> Cc: Paul Burton <paul.burton@mips.com> Cc: linux-mips@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Huacai Chen <chenhc@lemote.com> --- kernel/time/vsyscall.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/time/vsyscall.c b/kernel/time/vsyscall.c index 4bc37ac..5ee0f77 100644 --- a/kernel/time/vsyscall.c +++ b/kernel/time/vsyscall.c @@ -110,8 +110,7 @@ void update_vsyscall(struct timekeeper *tk) nsec = nsec + tk->wall_to_monotonic.tv_nsec; vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec); - if (__arch_use_vsyscall(vdata)) - update_vdso_data(vdata, tk); + update_vdso_data(vdata, tk); __arch_update_vsyscall(vdata, tk); @@ -124,10 +123,8 @@ void update_vsyscall_tz(void) { struct vdso_data *vdata = __arch_get_k_vdso_data(); - if (__arch_use_vsyscall(vdata)) { - vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest; - vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime; - } + vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest; + vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime; __arch_sync_vdso_data(vdata); } -- 2.7.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-10-24 3:25 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-10-24 3:28 Huacai Chen [this message] 2019-10-24 3:28 ` [PATCH] timekeeping/vsyscall: Update vdso data unconditionally Huacai Chen 2019-11-04 22:10 ` [tip: timers/urgent] timekeeping/vsyscall: Update VDSO " tip-bot2 for Huacai Chen
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=1571887709-11447-1-git-send-email-chenhc@lemote.com \ --to=chenhc@lemote.com \ --cc=arnd@arndb.de \ --cc=chenhuacai@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mips@vger.kernel.org \ --cc=luto@kernel.org \ --cc=paul.burton@mips.com \ --cc=stable@vger.kernel.org \ --cc=tglx@linutronix.de \ --cc=vincenzo.frascino@arm.com \ /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: linkBe 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.