Whamcloud - gitweb
LU-4454 libcfs: warn if all HTs in a core are gone
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-cpu.c
index b685296..d0524da 100644 (file)
@@ -993,7 +993,8 @@ cfs_cpt_table_create_pattern(char *pattern)
 static int
 cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
 {
 static int
 cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
 {
-       unsigned int  cpu = (unsigned long)hcpu;
+       unsigned int cpu = (unsigned long)hcpu;
+       bool         warn;
 
        switch (action) {
        case CPU_DEAD:
 
        switch (action) {
        case CPU_DEAD:
@@ -1004,9 +1005,21 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
                cpt_data.cpt_version++;
                spin_unlock(&cpt_data.cpt_lock);
        default:
                cpt_data.cpt_version++;
                spin_unlock(&cpt_data.cpt_lock);
        default:
-               CWARN("Lustre: can't support CPU hotplug well now, "
-                     "performance and stability could be impacted"
-                     "[CPU %u notify: %lx]\n", cpu, action);
+               if (action != CPU_DEAD && action != CPU_DEAD_FROZEN) {
+                       CDEBUG(D_INFO, "CPU changed [cpu %u action %lx]\n",
+                              cpu, action);
+                       break;
+               }
+
+               down(&cpt_data.cpt_mutex);
+               /* if all HTs in a core are offline, it may break affinity */
+               cfs_cpu_ht_siblings(cpu, cpt_data.cpt_cpumask);
+               warn = any_online_cpu(*cpt_data.cpt_cpumask) >= nr_cpu_ids;
+               up(&cpt_data.cpt_mutex);
+               CDEBUG(warn ? D_WARNING : D_INFO,
+                      "Lustre: can't support CPU plug-out well now, "
+                      "performance and stability could be impacted"
+                      "[CPU %u action: %lx]\n", cpu, action);
        }
 
        return NOTIFY_OK;
        }
 
        return NOTIFY_OK;