clocksource: add kernel.clocksource_unstable_cnt to track tsc unstable

since we disable clocksource switch when tsc not stable, we need a
counter to track tsc unstable did happend.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
This commit is contained in:
Xiaoming Gao 2020-05-19 14:52:38 +08:00
parent 82ac1bb32d
commit 205fee4e55
2 changed files with 10 additions and 0 deletions

View File

@ -329,6 +329,7 @@ static int sysrq_use_leftctrl_sysctl_handler(struct ctl_table * table ,int write
extern int sysctl_min_epoll_wait_time;
extern int sysctl_clocksource_switch_unstable_cs;
extern int sysctl_clocksource_unstable_cnt;
static struct ctl_table kern_table[] = {
{
@ -1345,6 +1346,13 @@ static struct ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "clocksource_unstable_cnt",
.data = &sysctl_clocksource_unstable_cnt,
.maxlen = sizeof(int),
.mode = 0444,
.proc_handler = proc_dointvec,
},
{ }
};

View File

@ -37,6 +37,7 @@
#include "timekeeping_internal.h"
int sysctl_clocksource_switch_unstable_cs = 0;
int sysctl_clocksource_unstable_cnt = 0;
/**
* clocks_calc_mult_shift - calculate mult/shift factors for scaled math of clocks
@ -231,6 +232,7 @@ static void clocksource_watchdog(unsigned long data)
watchdog->name, wdnow, wdlast, watchdog->mask);
pr_warn(" '%s' cs_now: %llx cs_last: %llx mask: %llx\n",
cs->name, csnow, cslast, cs->mask);
sysctl_clocksource_unstable_cnt++;
if (sysctl_clocksource_switch_unstable_cs) {
__clocksource_unstable(cs);
continue;