| .. | .. |
|---|
| 37 | 37 | { |
|---|
| 38 | 38 | u64 timer; |
|---|
| 39 | 39 | |
|---|
| 40 | | - asm volatile("stpt %0" : "=m" (timer)); |
|---|
| 40 | + asm volatile("stpt %0" : "=Q" (timer)); |
|---|
| 41 | 41 | return timer; |
|---|
| 42 | 42 | } |
|---|
| 43 | 43 | |
|---|
| .. | .. |
|---|
| 48 | 48 | asm volatile( |
|---|
| 49 | 49 | " stpt %0\n" /* Store current cpu timer value */ |
|---|
| 50 | 50 | " spt %1" /* Set new value imm. afterwards */ |
|---|
| 51 | | - : "=m" (timer) : "m" (expires)); |
|---|
| 51 | + : "=Q" (timer) : "Q" (expires)); |
|---|
| 52 | 52 | S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer; |
|---|
| 53 | 53 | S390_lowcore.last_update_timer = expires; |
|---|
| 54 | 54 | } |
|---|
| .. | .. |
|---|
| 69 | 69 | u64 delta, fac, mult, div; |
|---|
| 70 | 70 | int i; |
|---|
| 71 | 71 | |
|---|
| 72 | | - stcctm5(smp_cpu_mtid + 1, cycles_new); |
|---|
| 72 | + stcctm(MT_DIAG, smp_cpu_mtid + 1, cycles_new); |
|---|
| 73 | 73 | cycles_old = this_cpu_ptr(mt_cycles); |
|---|
| 74 | 74 | fac = 1; |
|---|
| 75 | 75 | mult = div = 0; |
|---|
| .. | .. |
|---|
| 124 | 124 | */ |
|---|
| 125 | 125 | static int do_account_vtime(struct task_struct *tsk) |
|---|
| 126 | 126 | { |
|---|
| 127 | | - u64 timer, clock, user, guest, system, hardirq, softirq, steal; |
|---|
| 127 | + u64 timer, clock, user, guest, system, hardirq, softirq; |
|---|
| 128 | 128 | |
|---|
| 129 | 129 | timer = S390_lowcore.last_update_timer; |
|---|
| 130 | 130 | clock = S390_lowcore.last_update_clock; |
|---|
| .. | .. |
|---|
| 135 | 135 | #else |
|---|
| 136 | 136 | " stck %1" /* Store current tod clock value */ |
|---|
| 137 | 137 | #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"); |
|---|
| 140 | 141 | clock = S390_lowcore.last_update_clock - clock; |
|---|
| 141 | 142 | timer -= S390_lowcore.last_update_timer; |
|---|
| 142 | 143 | |
|---|
| .. | .. |
|---|
| 182 | 183 | if (softirq) |
|---|
| 183 | 184 | account_system_index_scaled(tsk, softirq, CPUTIME_SOFTIRQ); |
|---|
| 184 | 185 | |
|---|
| 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 | | - |
|---|
| 191 | 186 | return virt_timer_forward(user + guest + system + hardirq + softirq); |
|---|
| 192 | 187 | } |
|---|
| 193 | 188 | |
|---|
| .. | .. |
|---|
| 213 | 208 | */ |
|---|
| 214 | 209 | void vtime_flush(struct task_struct *tsk) |
|---|
| 215 | 210 | { |
|---|
| 211 | + u64 steal, avg_steal; |
|---|
| 212 | + |
|---|
| 216 | 213 | if (do_account_vtime(tsk)) |
|---|
| 217 | 214 | 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; |
|---|
| 224 | +} |
|---|
| 225 | + |
|---|
| 226 | +static u64 vtime_delta(void) |
|---|
| 227 | +{ |
|---|
| 228 | + u64 timer = S390_lowcore.last_update_timer; |
|---|
| 229 | + |
|---|
| 230 | + S390_lowcore.last_update_timer = get_vtimer(); |
|---|
| 231 | + |
|---|
| 232 | + return timer - S390_lowcore.last_update_timer; |
|---|
| 218 | 233 | } |
|---|
| 219 | 234 | |
|---|
| 220 | 235 | /* |
|---|
| 221 | 236 | * Update process times based on virtual cpu times stored by entry.S |
|---|
| 222 | 237 | * to the lowcore fields user_timer, system_timer & steal_clock. |
|---|
| 223 | 238 | */ |
|---|
| 224 | | -void vtime_account_irq_enter(struct task_struct *tsk) |
|---|
| 239 | +void vtime_account_kernel(struct task_struct *tsk) |
|---|
| 225 | 240 | { |
|---|
| 226 | | - u64 timer; |
|---|
| 241 | + u64 delta = vtime_delta(); |
|---|
| 227 | 242 | |
|---|
| 228 | | - timer = S390_lowcore.last_update_timer; |
|---|
| 229 | | - S390_lowcore.last_update_timer = get_vtimer(); |
|---|
| 230 | | - timer -= S390_lowcore.last_update_timer; |
|---|
| 231 | | - |
|---|
| 232 | | - if ((tsk->flags & PF_VCPU) && (irq_count() == 0)) |
|---|
| 233 | | - S390_lowcore.guest_timer += timer; |
|---|
| 234 | | - else if (hardirq_count()) |
|---|
| 235 | | - S390_lowcore.hardirq_timer += timer; |
|---|
| 236 | | - else if (in_serving_softirq()) |
|---|
| 237 | | - S390_lowcore.softirq_timer += timer; |
|---|
| 243 | + if (tsk->flags & PF_VCPU) |
|---|
| 244 | + S390_lowcore.guest_timer += delta; |
|---|
| 238 | 245 | else |
|---|
| 239 | | - S390_lowcore.system_timer += timer; |
|---|
| 246 | + S390_lowcore.system_timer += delta; |
|---|
| 240 | 247 | |
|---|
| 241 | | - virt_timer_forward(timer); |
|---|
| 248 | + virt_timer_forward(delta); |
|---|
| 242 | 249 | } |
|---|
| 243 | | -EXPORT_SYMBOL_GPL(vtime_account_irq_enter); |
|---|
| 250 | +EXPORT_SYMBOL_GPL(vtime_account_kernel); |
|---|
| 244 | 251 | |
|---|
| 245 | | -void vtime_account_system(struct task_struct *tsk) |
|---|
| 246 | | -__attribute__((alias("vtime_account_irq_enter"))); |
|---|
| 247 | | -EXPORT_SYMBOL_GPL(vtime_account_system); |
|---|
| 252 | +void vtime_account_softirq(struct task_struct *tsk) |
|---|
| 253 | +{ |
|---|
| 254 | + u64 delta = vtime_delta(); |
|---|
| 255 | + |
|---|
| 256 | + S390_lowcore.softirq_timer += delta; |
|---|
| 257 | + |
|---|
| 258 | + virt_timer_forward(delta); |
|---|
| 259 | +} |
|---|
| 260 | + |
|---|
| 261 | +void vtime_account_hardirq(struct task_struct *tsk) |
|---|
| 262 | +{ |
|---|
| 263 | + u64 delta = vtime_delta(); |
|---|
| 264 | + |
|---|
| 265 | + S390_lowcore.hardirq_timer += delta; |
|---|
| 266 | + |
|---|
| 267 | + virt_timer_forward(delta); |
|---|
| 268 | +} |
|---|
| 248 | 269 | |
|---|
| 249 | 270 | /* |
|---|
| 250 | 271 | * Sorted add to a list. List is linear searched until first bigger |
|---|
| .. | .. |
|---|
| 432 | 453 | __this_cpu_write(mt_scaling_jiffies, jiffies); |
|---|
| 433 | 454 | __this_cpu_write(mt_scaling_mult, 1); |
|---|
| 434 | 455 | __this_cpu_write(mt_scaling_div, 1); |
|---|
| 435 | | - stcctm5(smp_cpu_mtid + 1, this_cpu_ptr(mt_cycles)); |
|---|
| 456 | + stcctm(MT_DIAG, smp_cpu_mtid + 1, this_cpu_ptr(mt_cycles)); |
|---|
| 436 | 457 | } |
|---|
| 437 | 458 | } |
|---|