hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/s390/kernel/vtime.c
....@@ -37,7 +37,7 @@
3737 {
3838 u64 timer;
3939
40
- asm volatile("stpt %0" : "=m" (timer));
40
+ asm volatile("stpt %0" : "=Q" (timer));
4141 return timer;
4242 }
4343
....@@ -48,7 +48,7 @@
4848 asm volatile(
4949 " stpt %0\n" /* Store current cpu timer value */
5050 " spt %1" /* Set new value imm. afterwards */
51
- : "=m" (timer) : "m" (expires));
51
+ : "=Q" (timer) : "Q" (expires));
5252 S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer;
5353 S390_lowcore.last_update_timer = expires;
5454 }
....@@ -69,7 +69,7 @@
6969 u64 delta, fac, mult, div;
7070 int i;
7171
72
- stcctm5(smp_cpu_mtid + 1, cycles_new);
72
+ stcctm(MT_DIAG, smp_cpu_mtid + 1, cycles_new);
7373 cycles_old = this_cpu_ptr(mt_cycles);
7474 fac = 1;
7575 mult = div = 0;
....@@ -124,7 +124,7 @@
124124 */
125125 static int do_account_vtime(struct task_struct *tsk)
126126 {
127
- u64 timer, clock, user, guest, system, hardirq, softirq, steal;
127
+ u64 timer, clock, user, guest, system, hardirq, softirq;
128128
129129 timer = S390_lowcore.last_update_timer;
130130 clock = S390_lowcore.last_update_clock;
....@@ -135,8 +135,9 @@
135135 #else
136136 " stck %1" /* Store current tod clock value */
137137 #endif
138
- : "=m" (S390_lowcore.last_update_timer),
139
- "=m" (S390_lowcore.last_update_clock));
138
+ : "=Q" (S390_lowcore.last_update_timer),
139
+ "=Q" (S390_lowcore.last_update_clock)
140
+ : : "cc");
140141 clock = S390_lowcore.last_update_clock - clock;
141142 timer -= S390_lowcore.last_update_timer;
142143
....@@ -182,12 +183,6 @@
182183 if (softirq)
183184 account_system_index_scaled(tsk, softirq, CPUTIME_SOFTIRQ);
184185
185
- steal = S390_lowcore.steal_timer;
186
- if ((s64) steal > 0) {
187
- S390_lowcore.steal_timer = 0;
188
- account_steal_time(cputime_to_nsecs(steal));
189
- }
190
-
191186 return virt_timer_forward(user + guest + system + hardirq + softirq);
192187 }
193188
....@@ -213,8 +208,19 @@
213208 */
214209 void vtime_flush(struct task_struct *tsk)
215210 {
211
+ u64 steal, avg_steal;
212
+
216213 if (do_account_vtime(tsk))
217214 virt_timer_expire();
215
+
216
+ steal = S390_lowcore.steal_timer;
217
+ avg_steal = S390_lowcore.avg_steal_timer / 2;
218
+ if ((s64) steal > 0) {
219
+ S390_lowcore.steal_timer = 0;
220
+ account_steal_time(cputime_to_nsecs(steal));
221
+ avg_steal += steal;
222
+ }
223
+ S390_lowcore.avg_steal_timer = avg_steal;
218224 }
219225
220226 /*
....@@ -242,9 +248,9 @@
242248 }
243249 EXPORT_SYMBOL_GPL(vtime_account_irq_enter);
244250
245
-void vtime_account_system(struct task_struct *tsk)
251
+void vtime_account_kernel(struct task_struct *tsk)
246252 __attribute__((alias("vtime_account_irq_enter")));
247
-EXPORT_SYMBOL_GPL(vtime_account_system);
253
+EXPORT_SYMBOL_GPL(vtime_account_kernel);
248254
249255 /*
250256 * Sorted add to a list. List is linear searched until first bigger
....@@ -432,6 +438,6 @@
432438 __this_cpu_write(mt_scaling_jiffies, jiffies);
433439 __this_cpu_write(mt_scaling_mult, 1);
434440 __this_cpu_write(mt_scaling_div, 1);
435
- stcctm5(smp_cpu_mtid + 1, this_cpu_ptr(mt_cycles));
441
+ stcctm(MT_DIAG, smp_cpu_mtid + 1, this_cpu_ptr(mt_cycles));
436442 }
437443 }