]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: enable cpu hotplug feature for UEK4
authorAllen Pais <allen.pais@oracle.com>
Mon, 14 Nov 2016 14:23:08 +0000 (19:53 +0530)
committerAllen Pais <allen.pais@oracle.com>
Sun, 22 Jan 2017 15:37:36 +0000 (21:07 +0530)
This patch provides users with an option to
disable/enable cpu at runtime by writing to
/sys/devices/system/cpu/cpuX/online field.

Eg:
$ echo [0/1] > /sys/devices/system/cpu/cpu2/online

Orabug: 24946811
Orabug: 22546196

Signed-off-by: Allen Pais <allen.pais@oracle.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
(cherry picked from commit a53c94ca8afc7a7603ff3c1154d81abb113a9e71)

arch/sparc/kernel/smp_64.c
arch/sparc/kernel/sysfs.c

index c7e13dcf49e767a210bd954d31c21e7f65303ca1..5f881980cb664c05fb0ec9e9068811ba22580f1f 100644 (file)
@@ -1321,6 +1321,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
                         */
                        if (tlb_type != hypervisor)
                                smp_synchronize_one_tick(cpu);
+                       smp_fill_in_sib_core_maps();
                        cpu_map_rebuild();
                        sparc64_update_numa_mask(cpu);
                }
@@ -1367,7 +1368,6 @@ void cpu_play_dead(void)
 int __cpu_disable(void)
 {
        int cpu = smp_processor_id();
-       cpuinfo_sparc *c;
        int i;
        cpumask_var_t mask;
 
@@ -1386,12 +1386,6 @@ int __cpu_disable(void)
                cpumask_clear_cpu(cpu, &per_cpu(cpu_sibling_map, i));
        cpumask_clear(&per_cpu(cpu_sibling_map, cpu));
 
-       c = &cpu_data(cpu);
-
-       c->sock_id = -1;
-       c->core_id = 0;
-       c->proc_id = -1;
-
        /*
         * Offline before fixup.
         * See irq_choose_cpu(), cpu_map_rebuild().
@@ -1429,7 +1423,7 @@ void __cpu_die(unsigned int cpu)
                do {
                        hv_err = sun4v_cpu_stop(cpu);
                        if (hv_err == HV_EOK) {
-                               set_cpu_present(cpu, false);
+                               set_cpu_online(cpu, false);
                                sun4v_free_mondo_queues(cpu);
                                break;
                        }
index f5043d3b046865e5bc136f6e02b7a9ba657941af..aac0e6ca2b1527baccb3e25f2335d25f2b0b6441 100644 (file)
@@ -477,6 +477,8 @@ static void unregister_cpu_online(unsigned int cpu)
        struct device *s = &c->dev;
        int i;
 
+       BUG_ON(!c->hotpluggable);
+
        unregister_mmu_stats(s);
        for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
                device_remove_file(s, &cpu_core_attrs[i]);
@@ -546,6 +548,7 @@ static int __init topology_init(void)
        for_each_possible_cpu(cpu) {
                struct cpu *c = &per_cpu(cpu_devices, cpu);
 
+               c->hotpluggable = 1;
                register_cpu(c, cpu);
                if (cpu_online(cpu))
                        register_cpu_online(cpu);