diff mbox

[v3,3/8] x86, cpu: provide a function topology_num_packages to enumerate #packages

Message ID 1473373615-51427-4-git-send-email-srinivas.pandruvada@linux.intel.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

srinivas pandruvada Sept. 8, 2016, 10:26 p.m. UTC
From: Tim Chen <tim.c.chen@linux.intel.com>

We compute the the number of active packages during boot and
topology update.  Provide a function to export this info for
functions that need this topology info.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 arch/x86/include/asm/topology.h | 1 +
 arch/x86/kernel/smpboot.c       | 5 +++++
 2 files changed, 6 insertions(+)

Comments

Thomas Gleixner Sept. 10, 2016, 1:28 p.m. UTC | #1
B1;2802;0cOn Thu, 8 Sep 2016, Srinivas Pandruvada wrote:

> From: Tim Chen <tim.c.chen@linux.intel.com>

$subject: x86, cpu: provide a function topology_num_packages  to enumerate #packages

- we switched to the prefix scheme 'x86/subsys'. Please use this.

- this is not related to x86/cpu. x86/topology is the proper prefix.

- Sentence after ':' starts with an uppercase letter.

- please make the subject line short and descriptive. 

  x86/topology: Provide topology_num_packages()

  is completely sufficient, because it's entirely clear that it is a
  function and the function name is self explaining.

> We compute the the number of active packages during boot and
> topology update.

We? We do not do anything..... and how is that information useful for the
reader?

> Provide a function to export this info for functions that need this
> topology info.

Well, it's obvious that a new function is going to be used by something
which needs it.

In changelogs/comments there is only one thing worse than superflous
informatioin: wrong information.

If you have nothing to say, then omit it instead of forcing the reader to
parse incoherent blurbs for nothing.

>  int topology_update_package_map(unsigned int apicid, unsigned int cpu);
> +extern int topology_num_packages(void);
>  extern int topology_phys_to_logical_pkg(unsigned int pkg);
>  #else
>  #define topology_max_packages()			(1)

stub function for the !SMP case is missing....

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tim Chen Sept. 12, 2016, 8:51 p.m. UTC | #2
On Sat, 2016-09-10 at 15:28 +0200, Thomas Gleixner wrote:
> B1;2802;0cOn Thu, 8 Sep 2016, Srinivas Pandruvada wrote:
> 
> > 
> > From: Tim Chen <tim.c.chen@linux.intel.com>
> $subject: x86, cpu: provide a function topology_num_packages  to enumerate #packages
> 
> - we switched to the prefix scheme 'x86/subsys'. Please use this.
> 
> - this is not related to x86/cpu. x86/topology is the proper prefix.
> 
> - Sentence after ':' starts with an uppercase letter.
> 
> - please make the subject line short and descriptive. 
> 
>   x86/topology: Provide topology_num_packages()
> 
>   is completely sufficient, because it's entirely clear that it is a
>   function and the function name is self explaining.

Will do.

> 
> > 
> > We compute the the number of active packages during boot and
> > topology update.
> We? We do not do anything..... and how is that information useful for the
> reader?
> 
> > 
> > Provide a function to export this info for functions that need this
> > topology info.
> Well, it's obvious that a new function is going to be used by something
> which needs it.
> 
> In changelogs/comments there is only one thing worse than superflous
> informatioin: wrong information.
> 
> If you have nothing to say, then omit it instead of forcing the reader to
> parse incoherent blurbs for nothing.
> 
> > 
> >  int topology_update_package_map(unsigned int apicid, unsigned int cpu);
> > +extern int topology_num_packages(void);
> >  extern int topology_phys_to_logical_pkg(unsigned int pkg);
> >  #else
> >  #define topology_max_packages()			(1)
> stub function for the !SMP case is missing....
> 
> Thanks,
> 
> 	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 98b669d..0bcf3b7 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -129,6 +129,7 @@  static inline int topology_max_smt_threads(void)
 }
 
 int topology_update_package_map(unsigned int apicid, unsigned int cpu);
+extern int topology_num_packages(void);
 extern int topology_phys_to_logical_pkg(unsigned int pkg);
 #else
 #define topology_max_packages()			(1)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 3782bd4..292df31 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -297,6 +297,11 @@  found:
 	return 0;
 }
 
+int topology_num_packages(void)
+{
+	return logical_packages;
+}
+
 /**
  * topology_phys_to_logical_pkg - Map a physical package id to a logical
  *