From: Liang Zhen Date: Wed, 8 Jan 2014 06:51:17 +0000 (+0800) Subject: LU-4454 libcfs: warn if all HTs in a core are gone X-Git-Tag: 2.5.55~49 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=0046eb8f66e906648dd0695fa7d6edfa6f301485;hp=035f3e4bf7532839dd88a4ae330fd67542e17cdd LU-4454 libcfs: warn if all HTs in a core are gone libcfs cpu partition can't support CPU hotplug, but it is safe when plug-in new CPU or enabling/disabling hyper-threading. It has potential risk only if plug-out CPU because it may break CPU affinity of Lustre threads. Current libcfs will print warning for all CPU notification, this patch changed this behavior and only output warning when we lost all HTs in a CPU core which may have broken affinity of Lustre threads. Signed-off-by: Liang Zhen Change-Id: I62267b62871c129beeb1593c4f69e7b81a79999d Reviewed-on: http://review.whamcloud.com/8770 Reviewed-by: Bobi Jam Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo --- diff --git a/libcfs/libcfs/linux/linux-cpu.c b/libcfs/libcfs/linux/linux-cpu.c index b685296..d0524da 100644 --- a/libcfs/libcfs/linux/linux-cpu.c +++ b/libcfs/libcfs/linux/linux-cpu.c @@ -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) { - unsigned int cpu = (unsigned long)hcpu; + unsigned int cpu = (unsigned long)hcpu; + bool warn; 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: - 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;