diff for duplicates of <1526268071.30369.20.camel@neuling.org> diff --git a/a/1.txt b/N1/1.txt index 4eb01ac..2ebc5be 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -2,7 +2,7 @@ Thanks for posting this... A couple of comments below. On Fri, 2018-05-11 at 16:47 +0530, Gautham R. Shenoy wrote: > From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> ->=20 +> > A pair of IBM POWER9 SMT4 cores can be fused together to form a > big-core with 8 SMT threads. This can be discovered via the > "ibm,thread-groups" CPU property in the device tree which will @@ -11,25 +11,24 @@ On Fri, 2018-05-11 at 16:47 +0530, Gautham R. Shenoy wrote: > threads, then the core is a big-core. The thread-ids of the threads of > the big-core can be obtained by interleaving the thread-ids of the > thread-groups (component small core). ->=20 +> > Eg: Threads in the pair of component SMT4 cores of an interleaved > big-core are numbered {0,2,4,6} and {1,3,5,7} respectively. ->=20 +> > This patch introduces a function to check if a given device tree node > corresponding to a CPU node represents an interleaved big-core. ->=20 +> > This function is invoked during the boot-up to detect the presence of > interleaved big-cores. The presence of such an interleaved big-core is > recorded in a global variable for later use. ->=20 +> > Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com> > --- > arch/powerpc/include/asm/cputhreads.h | 8 +++-- -> arch/powerpc/kernel/setup-common.c | 63 +++++++++++++++++++++++++++++= -++++- +> arch/powerpc/kernel/setup-common.c | 63 +++++++++++++++++++++++++++++++++- > - > 2 files changed, 66 insertions(+), 5 deletions(-) ->=20 +> > diff --git a/arch/powerpc/include/asm/cputhreads.h > b/arch/powerpc/include/asm/cputhreads.h > index d71a909..b706f0a 100644 @@ -51,16 +50,15 @@ On Fri, 2018-05-11 at 16:47 +0530, Gautham R. Shenoy wrote: > +#define has_interleaved_big_core 0 > #define threads_core_mask (*get_cpu_mask(0)) > #endif -> =20 -> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/set= -up- +> +> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup- > common.c > index 0af5c11..884dff2 100644 > --- a/arch/powerpc/kernel/setup-common.c > +++ b/arch/powerpc/kernel/setup-common.c > @@ -408,10 +408,12 @@ void __init check_for_initrd(void) > #ifdef CONFIG_SMP -> =20 +> > int threads_per_core, threads_per_subcore, threads_shift; > +bool has_interleaved_big_core; > cpumask_t threads_core_mask; @@ -69,15 +67,14 @@ up- > EXPORT_SYMBOL_GPL(threads_shift); > +EXPORT_SYMBOL_GPL(has_interleaved_big_core); > EXPORT_SYMBOL_GPL(threads_core_mask); -> =20 +> > static void __init cpu_init_thread_core_maps(int tpc) -> @@ -436,8 +438,56 @@ static void __init cpu_init_thread_core_maps(int tpc= -) +> @@ -436,8 +438,56 @@ static void __init cpu_init_thread_core_maps(int tpc) > printk(KERN_DEBUG " (thread shift is %d)\n", threads_shift); > } -> =20 +> > - -> u32 *cpu_to_phys_id =3D NULL; +> u32 *cpu_to_phys_id = NULL; > +/* > + * check_for_interleaved_big_core - Checks if the core represented by > + * dn is a big-core whose threads are interleavings of the @@ -88,15 +85,14 @@ up- > + * Returns true if the core is a interleaved big-core. > + * Returns false otherwise. > + */ -> +static inline bool check_for_interleaved_big_core(struct device_node *dn= -) +> +static inline bool check_for_interleaved_big_core(struct device_node *dn) > +{ > + int len, nr_groups, threads_per_group; > + const __be32 *thread_groups; > + __be32 *thread_list, *first_cpu_idx; > + int cur_cpu, next_cpu, i, j; > + -> + thread_groups =3D of_get_property(dn, "ibm,thread-groups", &len); +> + thread_groups = of_get_property(dn, "ibm,thread-groups", &len); > + if (!thread_groups) > + return false; @@ -107,12 +103,12 @@ If we get configured with an SMT2 big-core (ie. two interleaved SMT1 normal cores), will this code also work there? > + -> + nr_groups =3D be32_to_cpu(*(thread_groups + 1)); -> + if (nr_groups <=3D 1) +> + nr_groups = be32_to_cpu(*(thread_groups + 1)); +> + if (nr_groups <= 1) > + return false; > + -> + threads_per_group =3D be32_to_cpu(*(thread_groups + 2)); -> + thread_list =3D (__be32 *)thread_groups + 3; +> + threads_per_group = be32_to_cpu(*(thread_groups + 2)); +> + thread_list = (__be32 *)thread_groups + 3; > + > + /* > + * In case of an interleaved big-core, the thread-ids of the @@ -123,34 +119,33 @@ cores), will this code also work there? > + * threads of the two component small cores will be > + * {0, 2, 4, 6} and {1, 3, 5, 7}. > + */ -> + for (i =3D 0; i < nr_groups; i++) { -> + first_cpu_idx =3D thread_list + i * threads_per_group; +> + for (i = 0; i < nr_groups; i++) { +> + first_cpu_idx = thread_list + i * threads_per_group; > + -> + for (j =3D 0; j < threads_per_group - 1; j++) { -> + cur_cpu =3D be32_to_cpu(*(first_cpu_idx + j)); -> + next_cpu =3D be32_to_cpu(*(first_cpu_idx + j + 1)); -> + if (next_cpu !=3D cur_cpu + nr_groups) +> + for (j = 0; j < threads_per_group - 1; j++) { +> + cur_cpu = be32_to_cpu(*(first_cpu_idx + j)); +> + next_cpu = be32_to_cpu(*(first_cpu_idx + j + 1)); +> + if (next_cpu != cur_cpu + nr_groups) > + return false; > + } > + } > + return true; > +} -> =20 +> > /** > * setup_cpu_maps - initialize the following cpu maps: > @@ -565,7 +615,16 @@ void __init smp_setup_cpu_maps(void) -> vdso_data->processorCount =3D num_present_cpus(); +> vdso_data->processorCount = num_present_cpus(); > #endif /* CONFIG_PPC64 */ -> =20 -> - /* Initialize CPU <=3D> thread mapping/ -> + dn =3D of_find_node_by_type(NULL, "cpu"); +> +> - /* Initialize CPU <=> thread mapping/ +> + dn = of_find_node_by_type(NULL, "cpu"); > + if (dn) { > + if (check_for_interleaved_big_core(dn)) { -> + has_interleaved_big_core =3D true; +> + has_interleaved_big_core = true; > + pr_info("Detected interleaved big-cores\n"); -Is there a runtime way to check this also? If the dmesg buffer overflows, = -we +Is there a runtime way to check this also? If the dmesg buffer overflows, we lose this. Mikey @@ -159,7 +154,7 @@ Mikey > + of_node_put(dn); > + } > + -> + /* Initialize CPU <=3D> thread mapping/ +> + /* Initialize CPU <=> thread mapping/ > * > * WARNING: We assume that the number of threads is the same for > * every CPU in the system. If that is not the case, then some code diff --git a/a/content_digest b/N1/content_digest index 40ae5d3..18c7586 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -20,7 +20,7 @@ "\n" "On Fri, 2018-05-11 at 16:47 +0530, Gautham R. Shenoy wrote:\n" "> From: \"Gautham R. Shenoy\" <ego@linux.vnet.ibm.com>\n" - ">=20\n" + "> \n" "> A pair of IBM POWER9 SMT4 cores can be fused together to form a\n" "> big-core with 8 SMT threads. This can be discovered via the\n" "> \"ibm,thread-groups\" CPU property in the device tree which will\n" @@ -29,25 +29,24 @@ "> threads, then the core is a big-core. The thread-ids of the threads of\n" "> the big-core can be obtained by interleaving the thread-ids of the\n" "> thread-groups (component small core).\n" - ">=20\n" + "> \n" "> Eg: Threads in the pair of component SMT4 cores of an interleaved\n" "> big-core are numbered {0,2,4,6} and {1,3,5,7} respectively.\n" - ">=20\n" + "> \n" "> This patch introduces a function to check if a given device tree node\n" "> corresponding to a CPU node represents an interleaved big-core.\n" - ">=20\n" + "> \n" "> This function is invoked during the boot-up to detect the presence of\n" "> interleaved big-cores. The presence of such an interleaved big-core is\n" "> recorded in a global variable for later use.\n" - ">=20\n" + "> \n" "> Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>\n" "> ---\n" "> arch/powerpc/include/asm/cputhreads.h | 8 +++--\n" - "> arch/powerpc/kernel/setup-common.c | 63 +++++++++++++++++++++++++++++=\n" - "++++-\n" + "> arch/powerpc/kernel/setup-common.c | 63 +++++++++++++++++++++++++++++++++-\n" "> -\n" "> 2 files changed, 66 insertions(+), 5 deletions(-)\n" - ">=20\n" + "> \n" "> diff --git a/arch/powerpc/include/asm/cputhreads.h\n" "> b/arch/powerpc/include/asm/cputhreads.h\n" "> index d71a909..b706f0a 100644\n" @@ -69,16 +68,15 @@ "> +#define has_interleaved_big_core\t0\n" "> #define threads_core_mask\t(*get_cpu_mask(0))\n" "> #endif\n" - "> =20\n" - "> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/set=\n" - "up-\n" + "> \n" + "> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-\n" "> common.c\n" "> index 0af5c11..884dff2 100644\n" "> --- a/arch/powerpc/kernel/setup-common.c\n" "> +++ b/arch/powerpc/kernel/setup-common.c\n" "> @@ -408,10 +408,12 @@ void __init check_for_initrd(void)\n" "> #ifdef CONFIG_SMP\n" - "> =20\n" + "> \n" "> int threads_per_core, threads_per_subcore, threads_shift;\n" "> +bool has_interleaved_big_core;\n" "> cpumask_t threads_core_mask;\n" @@ -87,15 +85,14 @@ "> EXPORT_SYMBOL_GPL(threads_shift);\n" "> +EXPORT_SYMBOL_GPL(has_interleaved_big_core);\n" "> EXPORT_SYMBOL_GPL(threads_core_mask);\n" - "> =20\n" + "> \n" "> static void __init cpu_init_thread_core_maps(int tpc)\n" - "> @@ -436,8 +438,56 @@ static void __init cpu_init_thread_core_maps(int tpc=\n" - ")\n" + "> @@ -436,8 +438,56 @@ static void __init cpu_init_thread_core_maps(int tpc)\n" "> \tprintk(KERN_DEBUG \" (thread shift is %d)\\n\", threads_shift);\n" "> }\n" - "> =20\n" + "> \n" "> -\n" - "> u32 *cpu_to_phys_id =3D NULL;\n" + "> u32 *cpu_to_phys_id = NULL;\n" "> +/*\n" "> + * check_for_interleaved_big_core - Checks if the core represented by\n" "> + *\t dn is a big-core whose threads are interleavings of the\n" @@ -106,15 +103,14 @@ "> + * Returns true if the core is a interleaved big-core.\n" "> + * Returns false otherwise.\n" "> + */\n" - "> +static inline bool check_for_interleaved_big_core(struct device_node *dn=\n" - ")\n" + "> +static inline bool check_for_interleaved_big_core(struct device_node *dn)\n" "> +{\n" "> +\tint len, nr_groups, threads_per_group;\n" "> +\tconst __be32 *thread_groups;\n" "> +\t__be32 *thread_list, *first_cpu_idx;\n" "> +\tint cur_cpu, next_cpu, i, j;\n" "> +\n" - "> +\tthread_groups =3D of_get_property(dn, \"ibm,thread-groups\", &len);\n" + "> +\tthread_groups = of_get_property(dn, \"ibm,thread-groups\", &len);\n" "> +\tif (!thread_groups)\n" "> +\t\treturn false;\n" "\n" @@ -125,12 +121,12 @@ "cores), will this code also work there?\n" "\n" "> +\n" - "> +\tnr_groups =3D be32_to_cpu(*(thread_groups + 1));\n" - "> +\tif (nr_groups <=3D 1)\n" + "> +\tnr_groups = be32_to_cpu(*(thread_groups + 1));\n" + "> +\tif (nr_groups <= 1)\n" "> +\t\treturn false;\n" "> +\n" - "> +\tthreads_per_group =3D be32_to_cpu(*(thread_groups + 2));\n" - "> +\tthread_list =3D (__be32 *)thread_groups + 3;\n" + "> +\tthreads_per_group = be32_to_cpu(*(thread_groups + 2));\n" + "> +\tthread_list = (__be32 *)thread_groups + 3;\n" "> +\n" "> +\t/*\n" "> +\t * In case of an interleaved big-core, the thread-ids of the\n" @@ -141,34 +137,33 @@ "> +\t * threads of the two component small cores will be\n" "> +\t * {0, 2, 4, 6} and {1, 3, 5, 7}.\n" "> +\t */\n" - "> +\tfor (i =3D 0; i < nr_groups; i++) {\n" - "> +\t\tfirst_cpu_idx =3D thread_list + i * threads_per_group;\n" + "> +\tfor (i = 0; i < nr_groups; i++) {\n" + "> +\t\tfirst_cpu_idx = thread_list + i * threads_per_group;\n" "> +\n" - "> +\t\tfor (j =3D 0; j < threads_per_group - 1; j++) {\n" - "> +\t\t\tcur_cpu =3D be32_to_cpu(*(first_cpu_idx + j));\n" - "> +\t\t\tnext_cpu =3D be32_to_cpu(*(first_cpu_idx + j + 1));\n" - "> +\t\t\tif (next_cpu !=3D cur_cpu + nr_groups)\n" + "> +\t\tfor (j = 0; j < threads_per_group - 1; j++) {\n" + "> +\t\t\tcur_cpu = be32_to_cpu(*(first_cpu_idx + j));\n" + "> +\t\t\tnext_cpu = be32_to_cpu(*(first_cpu_idx + j + 1));\n" + "> +\t\t\tif (next_cpu != cur_cpu + nr_groups)\n" "> +\t\t\t\treturn false;\n" "> +\t\t}\n" "> +\t}\n" "> +\treturn true;\n" "> +}\n" - "> =20\n" + "> \n" "> /**\n" "> * setup_cpu_maps - initialize the following cpu maps:\n" "> @@ -565,7 +615,16 @@ void __init smp_setup_cpu_maps(void)\n" - "> \tvdso_data->processorCount =3D num_present_cpus();\n" + "> \tvdso_data->processorCount = num_present_cpus();\n" "> #endif /* CONFIG_PPC64 */\n" - "> =20\n" - "> - /* Initialize CPU <=3D> thread mapping/\n" - "> +\tdn =3D of_find_node_by_type(NULL, \"cpu\");\n" + "> \n" + "> - /* Initialize CPU <=> thread mapping/\n" + "> +\tdn = of_find_node_by_type(NULL, \"cpu\");\n" "> +\tif (dn) {\n" "> +\t\tif (check_for_interleaved_big_core(dn)) {\n" - "> +\t\t\thas_interleaved_big_core =3D true;\n" + "> +\t\t\thas_interleaved_big_core = true;\n" "> +\t\t\tpr_info(\"Detected interleaved big-cores\\n\");\n" "\n" - "Is there a runtime way to check this also? If the dmesg buffer overflows, =\n" - "we\n" + "Is there a runtime way to check this also? If the dmesg buffer overflows, we\n" "lose this.\n" "\n" "Mikey\n" @@ -177,9 +172,9 @@ "> +\t\tof_node_put(dn);\n" "> +\t}\n" "> +\n" - "> +\t/* Initialize CPU <=3D> thread mapping/\n" + "> +\t/* Initialize CPU <=> thread mapping/\n" "> \t *\n" "> \t * WARNING: We assume that the number of threads is the same for\n" "> \t * every CPU in the system. If that is not the case, then some code" -b77b9eb87a1a7e71626ab116596af95118898634654bf86a24f405cf69c4cfd6 +fe451eff76eed8405de36767c7b7c045eabb312d1c8a6b0b2a832aa7e2f727be
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.