diff options
author | Andriy Gapon <avg@FreeBSD.org> | 2017-02-14 22:46:39 +0000 |
---|---|---|
committer | Andriy Gapon <avg@FreeBSD.org> | 2017-02-14 22:46:39 +0000 |
commit | 92b87cdb24225e3f072b35aa6a521dd9c7a3a2a9 (patch) | |
tree | d3f7bcdb36125cd8ca0ffc48b0ad1b00538c926d | |
parent | 3be5c621e64c4df3bbc3754c86b8485d8d3beb2d (diff) | |
download | src-92b87cdb24225e3f072b35aa6a521dd9c7a3a2a9.tar.gz src-92b87cdb24225e3f072b35aa6a521dd9c7a3a2a9.zip |
mca: use time_uptime instead of ticks for CMCI throttling
This solves several problems.
First of all, cmc_throttle is specified in seconds and there was no
conversion between ticks and seconds when they were mixed together.
Second, we avoid potential problems with ticks wrapping around.
Resolution of time_uptime should be sufficient for the throttling
purposes.
Discussed with: jhb
MFC after: 12 days
Notes
Notes:
svn path=/head/; revision=313752
-rw-r--r-- | sys/x86/x86/mca.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/x86/x86/mca.c b/sys/x86/x86/mca.c index 1f8bdf38ffcf..bece5d490051 100644 --- a/sys/x86/x86/mca.c +++ b/sys/x86/x86/mca.c @@ -533,7 +533,7 @@ cmci_update(enum scan_mode mode, int bank, int valid, struct mca_record *rec) cc = &cmc_state[PCPU_GET(cpuid)][bank]; ctl = rdmsr(MSR_MC_CTL2(bank)); count = (rec->mr_status & MC_STATUS_COR_COUNT) >> 38; - delta = (u_int)(ticks - cc->last_intr); + delta = (u_int)(time_uptime - cc->last_intr); /* * If an interrupt was received less than cmc_throttle seconds @@ -550,7 +550,7 @@ cmci_update(enum scan_mode mode, int bank, int valid, struct mca_record *rec) ctl |= limit; wrmsr(MSR_MC_CTL2(bank), ctl); } - cc->last_intr = ticks; + cc->last_intr = time_uptime; return; } @@ -857,7 +857,7 @@ cmci_resume(int i) return; cc = &cmc_state[PCPU_GET(cpuid)][i]; - cc->last_intr = -ticks; + cc->last_intr = 0; ctl = rdmsr(MSR_MC_CTL2(i)); ctl &= ~MC_CTL2_THRESHOLD; ctl |= MC_CTL2_CMCI_EN | 1; |