hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/arch/x86/kernel/tsc.c
....@@ -131,7 +131,10 @@
131131 {
132132 unsigned long long ns_now;
133133 struct cyc2ns_data data;
134
+ unsigned long flags;
134135 struct cyc2ns *c2n;
136
+
137
+ flags = hard_cond_local_irq_save();
135138
136139 ns_now = cycles_2_ns(tsc_now);
137140
....@@ -163,6 +166,8 @@
163166 c2n->data[0] = data;
164167 raw_write_seqcount_latch(&c2n->seq);
165168 c2n->data[1] = data;
169
+
170
+ hard_cond_local_irq_restore(flags);
166171 }
167172
168173 static void set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long tsc_now)
....@@ -759,11 +764,11 @@
759764 * calibration, which will take at least 50ms, and
760765 * read the end value.
761766 */
762
- local_irq_save(flags);
767
+ flags = hard_local_irq_save();
763768 tsc1 = tsc_read_refs(&ref1, hpet);
764769 tsc_pit_khz = pit_calibrate_tsc(latch, ms, loopmin);
765770 tsc2 = tsc_read_refs(&ref2, hpet);
766
- local_irq_restore(flags);
771
+ hard_local_irq_restore(flags);
767772
768773 /* Pick the lowest PIT TSC calibration so far */
769774 tsc_pit_min = min(tsc_pit_min, tsc_pit_khz);
....@@ -872,9 +877,9 @@
872877 if (!fast_calibrate)
873878 fast_calibrate = cpu_khz_from_msr();
874879 if (!fast_calibrate) {
875
- local_irq_save(flags);
880
+ flags = hard_local_irq_save();
876881 fast_calibrate = quick_pit_calibrate();
877
- local_irq_restore(flags);
882
+ hard_local_irq_restore(flags);
878883 }
879884 return fast_calibrate;
880885 }
....@@ -942,7 +947,7 @@
942947 if (!sched_clock_stable())
943948 return;
944949
945
- local_irq_save(flags);
950
+ flags = hard_local_irq_save();
946951
947952 /*
948953 * We're coming out of suspend, there's no concurrency yet; don't
....@@ -960,7 +965,7 @@
960965 per_cpu(cyc2ns.data[1].cyc2ns_offset, cpu) = offset;
961966 }
962967
963
- local_irq_restore(flags);
968
+ hard_local_irq_restore(flags);
964969 }
965970
966971 #ifdef CONFIG_CPU_FREQ
....@@ -1411,6 +1416,8 @@
14111416 if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC_S3))
14121417 clocksource_tsc.flags |= CLOCK_SOURCE_SUSPEND_NONSTOP;
14131418
1419
+ clocksource_tsc.vdso_type = CLOCKSOURCE_VDSO_ARCHITECTED;
1420
+
14141421 /*
14151422 * When TSC frequency is known (retrieved via MSR or CPUID), we skip
14161423 * the refined calibration and directly register it as a clocksource.