Merge tag 'x86-apic-2024-03-10' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / kernel / cpu.c
index 023ddf8d625a8ec1e888311a28f60bf0fcb95d1b..8f6affd051f77564f96ca4682a58d0c131f62c56 100644 (file)
@@ -54,7 +54,6 @@
  * @rollback:  Perform a rollback
  * @single:    Single callback invocation
  * @bringup:   Single callback bringup or teardown selector
- * @cpu:       CPU number
  * @node:      Remote CPU node; for multi-instance, do a
  *             single entry callback for install/remove
  * @last:      For multi-instance rollback, remember how far we got
@@ -1324,10 +1323,6 @@ static int take_cpu_down(void *_param)
         */
        cpuhp_invoke_callback_range_nofail(false, cpu, st, target);
 
-       /* Give up timekeeping duties */
-       tick_handover_do_timer();
-       /* Remove CPU from timer broadcasting */
-       tick_offline_cpu(cpu);
        /* Park the stopper thread */
        stop_machine_park(cpu);
        return 0;
@@ -1403,6 +1398,7 @@ void cpuhp_report_idle_dead(void)
        struct cpuhp_cpu_state *st = this_cpu_ptr(&cpuhp_state);
 
        BUG_ON(st->state != CPUHP_AP_OFFLINE);
+       tick_assert_timekeeping_handover();
        rcutree_report_cpu_dead();
        st->state = CPUHP_AP_IDLE_DEAD;
        /*
@@ -2205,7 +2201,11 @@ static struct cpuhp_step cpuhp_hp_states[] = {
                .startup.single         = NULL,
                .teardown.single        = hrtimers_cpu_dying,
        },
-
+       [CPUHP_AP_TICK_DYING] = {
+               .name                   = "tick:dying",
+               .startup.single         = NULL,
+               .teardown.single        = tick_cpu_dying,
+       },
        /* Entry state on starting. Interrupts enabled from here on. Transient
         * state for synchronsization */
        [CPUHP_AP_ONLINE] = {
@@ -3005,7 +3005,7 @@ static ssize_t control_show(struct device *dev,
                return sysfs_emit(buf, "%d\n", cpu_smt_num_threads);
 #endif
 
-       return snprintf(buf, PAGE_SIZE - 2, "%s\n", state);
+       return sysfs_emit(buf, "%s\n", state);
 }
 
 static ssize_t control_store(struct device *dev, struct device_attribute *attr,
@@ -3018,7 +3018,7 @@ static DEVICE_ATTR_RW(control);
 static ssize_t active_show(struct device *dev,
                           struct device_attribute *attr, char *buf)
 {
-       return snprintf(buf, PAGE_SIZE - 2, "%d\n", sched_smt_active());
+       return sysfs_emit(buf, "%d\n", sched_smt_active());
 }
 static DEVICE_ATTR_RO(active);
 
@@ -3107,10 +3107,10 @@ const DECLARE_BITMAP(cpu_all_bits, NR_CPUS) = CPU_BITS_ALL;
 EXPORT_SYMBOL(cpu_all_bits);
 
 #ifdef CONFIG_INIT_ALL_POSSIBLE
-struct cpumask __cpu_possible_mask __read_mostly
+struct cpumask __cpu_possible_mask __ro_after_init
        = {CPU_BITS_ALL};
 #else
-struct cpumask __cpu_possible_mask __read_mostly;
+struct cpumask __cpu_possible_mask __ro_after_init;
 #endif
 EXPORT_SYMBOL(__cpu_possible_mask);