public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -tip] x86: cpu_debug.c prepare report if files are less or more then expected
@ 2009-04-14 12:17 Jaswinder Singh Rajput
  2009-04-14 13:46 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Jaswinder Singh Rajput @ 2009-04-14 12:17 UTC (permalink / raw)
  To: Ingo Molnar, x86 maintainers, LKML

This will prepare the report to update cpu_debug

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 arch/x86/include/asm/cpu_debug.h |    1 +
 arch/x86/kernel/cpu/cpu_debug.c  |   12 ++++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/cpu_debug.h b/arch/x86/include/asm/cpu_debug.h
index 2228020..b64da5d 100644
--- a/arch/x86/include/asm/cpu_debug.h
+++ b/arch/x86/include/asm/cpu_debug.h
@@ -187,6 +187,7 @@ enum cpu_processor_bit {
 #define	CPU_ALL			(CPU_INTEL_ALL | CPU_AMD_ALL)
 
 #define MAX_CPU_FILES		512
+#define MIN_CPU_FILES		10
 
 struct cpu_private {
 	unsigned		cpu;
diff --git a/arch/x86/kernel/cpu/cpu_debug.c b/arch/x86/kernel/cpu/cpu_debug.c
index 46e29ab..1c3ebd4 100644
--- a/arch/x86/kernel/cpu/cpu_debug.c
+++ b/arch/x86/kernel/cpu/cpu_debug.c
@@ -838,6 +838,14 @@ static int cpu_init_allreg(unsigned cpu, struct dentry *dentry)
 	return err;
 }
 
+/* Send Report to maintainer if files are less or more then expected */ 
+static void send_report(int files, struct cpuinfo_x86 *cpui)
+{
+	pr_info("Please report \"cpu_debug files %d for %x:%x:%x:%x\" to"
+		" jaswinderrajput@gmail.com\n", files, cpui->x86_vendor,
+		cpui->x86, cpui->x86_model, cpui->x86_mask);
+}
+
 static int cpu_init_cpu(void)
 {
 	struct dentry *cpu_dentry = NULL;
@@ -861,9 +869,13 @@ static int cpu_init_cpu(void)
 
 		pr_info("cpu%d(%d) debug files %d\n",
 			cpu, nr_cpu_ids, per_cpu(cpu_priv_count, cpu));
+		if ((per_cpu(cpu_priv_count, cpu) < MIN_CPU_FILES) && !cpu)
+			send_report(per_cpu(cpu_priv_count, cpu), cpui);
+
 		if (per_cpu(cpu_priv_count, cpu) > MAX_CPU_FILES) {
 			pr_err("Register files count %d exceeds limit %d\n",
 				per_cpu(cpu_priv_count, cpu), MAX_CPU_FILES);
+			send_report(per_cpu(cpu_priv_count, cpu), cpui);
 			per_cpu(cpu_priv_count, cpu) = MAX_CPU_FILES;
 			err = -ENFILE;
 		}
-- 
1.6.0.6




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -tip] x86: cpu_debug.c prepare report if files are less or more then expected
  2009-04-14 12:17 [PATCH -tip] x86: cpu_debug.c prepare report if files are less or more then expected Jaswinder Singh Rajput
@ 2009-04-14 13:46 ` Ingo Molnar
  2009-04-14 15:37   ` Jaswinder Singh Rajput
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2009-04-14 13:46 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: x86 maintainers, LKML


* Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:

> This will prepare the report to update cpu_debug
> 
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> ---
>  arch/x86/include/asm/cpu_debug.h |    1 +
>  arch/x86/kernel/cpu/cpu_debug.c  |   12 ++++++++++++
>  2 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/include/asm/cpu_debug.h b/arch/x86/include/asm/cpu_debug.h
> index 2228020..b64da5d 100644
> --- a/arch/x86/include/asm/cpu_debug.h
> +++ b/arch/x86/include/asm/cpu_debug.h
> @@ -187,6 +187,7 @@ enum cpu_processor_bit {
>  #define	CPU_ALL			(CPU_INTEL_ALL | CPU_AMD_ALL)
>  
>  #define MAX_CPU_FILES		512
> +#define MIN_CPU_FILES		10
>  
>  struct cpu_private {
>  	unsigned		cpu;
> diff --git a/arch/x86/kernel/cpu/cpu_debug.c b/arch/x86/kernel/cpu/cpu_debug.c
> index 46e29ab..1c3ebd4 100644
> --- a/arch/x86/kernel/cpu/cpu_debug.c
> +++ b/arch/x86/kernel/cpu/cpu_debug.c
> @@ -838,6 +838,14 @@ static int cpu_init_allreg(unsigned cpu, struct dentry *dentry)
>  	return err;
>  }
>  
> +/* Send Report to maintainer if files are less or more then expected */ 
> +static void send_report(int files, struct cpuinfo_x86 *cpui)
> +{
> +	pr_info("Please report \"cpu_debug files %d for %x:%x:%x:%x\" to"
> +		" jaswinderrajput@gmail.com\n", files, cpui->x86_vendor,
> +		cpui->x86, cpui->x86_model, cpui->x86_mask);

i'd rather see this reported to linux-kernel@vger.kernel.org, plus 
please use a WARN_ONCE() instead of a pr_info(). Hitting this is a 
bug we want to fix.

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -tip] x86: cpu_debug.c prepare report if files are less or more then expected
  2009-04-14 13:46 ` Ingo Molnar
@ 2009-04-14 15:37   ` Jaswinder Singh Rajput
  2009-04-14 16:10     ` Jaswinder Singh Rajput
  0 siblings, 1 reply; 4+ messages in thread
From: Jaswinder Singh Rajput @ 2009-04-14 15:37 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: x86 maintainers, LKML

On Tue, 2009-04-14 at 15:46 +0200, Ingo Molnar wrote:
> * Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:
> 
> > This will prepare the report to update cpu_debug
> > 
> > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > ---
> >  arch/x86/include/asm/cpu_debug.h |    1 +
> >  arch/x86/kernel/cpu/cpu_debug.c  |   12 ++++++++++++
> >  2 files changed, 13 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/x86/include/asm/cpu_debug.h b/arch/x86/include/asm/cpu_debug.h
> > index 2228020..b64da5d 100644
> > --- a/arch/x86/include/asm/cpu_debug.h
> > +++ b/arch/x86/include/asm/cpu_debug.h
> > @@ -187,6 +187,7 @@ enum cpu_processor_bit {
> >  #define	CPU_ALL			(CPU_INTEL_ALL | CPU_AMD_ALL)
> >  
> >  #define MAX_CPU_FILES		512
> > +#define MIN_CPU_FILES		10
> >  
> >  struct cpu_private {
> >  	unsigned		cpu;
> > diff --git a/arch/x86/kernel/cpu/cpu_debug.c b/arch/x86/kernel/cpu/cpu_debug.c
> > index 46e29ab..1c3ebd4 100644
> > --- a/arch/x86/kernel/cpu/cpu_debug.c
> > +++ b/arch/x86/kernel/cpu/cpu_debug.c
> > @@ -838,6 +838,14 @@ static int cpu_init_allreg(unsigned cpu, struct dentry *dentry)
> >  	return err;
> >  }
> >  
> > +/* Send Report to maintainer if files are less or more then expected */ 
> > +static void send_report(int files, struct cpuinfo_x86 *cpui)
> > +{
> > +	pr_info("Please report \"cpu_debug files %d for %x:%x:%x:%x\" to"
> > +		" jaswinderrajput@gmail.com\n", files, cpui->x86_vendor,
> > +		cpui->x86, cpui->x86_model, cpui->x86_mask);
> 
> i'd rather see this reported to linux-kernel@vger.kernel.org, plus 
> please use a WARN_ONCE() instead of a pr_info(). Hitting this is a 
> bug we want to fix.
> 

Subject: [PATCH] x86: cpu_debug.c prepare report if files are less or more then expected

This will prepare the report to update cpu_debug

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 arch/x86/include/asm/cpu_debug.h |    1 +
 arch/x86/kernel/cpu/cpu_debug.c  |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/cpu_debug.h b/arch/x86/include/asm/cpu_debug.h
index 2228020..b64da5d 100644
--- a/arch/x86/include/asm/cpu_debug.h
+++ b/arch/x86/include/asm/cpu_debug.h
@@ -187,6 +187,7 @@ enum cpu_processor_bit {
 #define	CPU_ALL			(CPU_INTEL_ALL | CPU_AMD_ALL)
 
 #define MAX_CPU_FILES		512
+#define MIN_CPU_FILES		10
 
 struct cpu_private {
 	unsigned		cpu;
diff --git a/arch/x86/kernel/cpu/cpu_debug.c b/arch/x86/kernel/cpu/cpu_debug.c
index 46e29ab..71e7f57 100644
--- a/arch/x86/kernel/cpu/cpu_debug.c
+++ b/arch/x86/kernel/cpu/cpu_debug.c
@@ -30,6 +30,8 @@
 #include <asm/apic.h>
 #include <asm/desc.h>
 
+#define EMAIL	"<linux-kernel@vger.kernel.org>, <jaswinderrajput@gmail.com>"
+
 static DEFINE_PER_CPU(struct cpu_cpuX_base, cpu_arr[CPU_REG_ALL_BIT]);
 static DEFINE_PER_CPU(struct cpu_private *, priv_arr[MAX_CPU_FILES]);
 static DEFINE_PER_CPU(unsigned, cpu_modelflag);
@@ -838,6 +840,14 @@ static int cpu_init_allreg(unsigned cpu, struct dentry *dentry)
 	return err;
 }
 
+/* Prepare report for LKML and maintainer if files count are inappropriate */
+static void send_report(int files, struct cpuinfo_x86 *cpui)
+{
+	WARN_ONCE(1, "Please report \"cpu_debug files %d for %x:%x:%x:%x\" to"
+		  " %s\n", files, cpui->x86_vendor, cpui->x86, cpui->x86_model,
+		  cpui->x86_mask, EMAIL);
+}
+
 static int cpu_init_cpu(void)
 {
 	struct dentry *cpu_dentry = NULL;
@@ -861,9 +871,13 @@ static int cpu_init_cpu(void)
 
 		pr_info("cpu%d(%d) debug files %d\n",
 			cpu, nr_cpu_ids, per_cpu(cpu_priv_count, cpu));
+		if ((per_cpu(cpu_priv_count, cpu) < MIN_CPU_FILES))
+			send_report(per_cpu(cpu_priv_count, cpu), cpui);
+
 		if (per_cpu(cpu_priv_count, cpu) > MAX_CPU_FILES) {
 			pr_err("Register files count %d exceeds limit %d\n",
 				per_cpu(cpu_priv_count, cpu), MAX_CPU_FILES);
+			send_report(per_cpu(cpu_priv_count, cpu), cpui);
 			per_cpu(cpu_priv_count, cpu) = MAX_CPU_FILES;
 			err = -ENFILE;
 		}
-- 
1.6.0.6




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -tip] x86: cpu_debug.c prepare report if files are less or more then expected
  2009-04-14 15:37   ` Jaswinder Singh Rajput
@ 2009-04-14 16:10     ` Jaswinder Singh Rajput
  0 siblings, 0 replies; 4+ messages in thread
From: Jaswinder Singh Rajput @ 2009-04-14 16:10 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: x86 maintainers, LKML

On Tue, 2009-04-14 at 21:07 +0530, Jaswinder Singh Rajput wrote:
> On Tue, 2009-04-14 at 15:46 +0200, Ingo Molnar wrote:
> > * Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:
> > 
> > > This will prepare the report to update cpu_debug
> > > 
> > > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > > ---
> > >  arch/x86/include/asm/cpu_debug.h |    1 +
> > >  arch/x86/kernel/cpu/cpu_debug.c  |   12 ++++++++++++
> > >  2 files changed, 13 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/arch/x86/include/asm/cpu_debug.h b/arch/x86/include/asm/cpu_debug.h
> > > index 2228020..b64da5d 100644
> > > --- a/arch/x86/include/asm/cpu_debug.h
> > > +++ b/arch/x86/include/asm/cpu_debug.h
> > > @@ -187,6 +187,7 @@ enum cpu_processor_bit {
> > >  #define	CPU_ALL			(CPU_INTEL_ALL | CPU_AMD_ALL)
> > >  
> > >  #define MAX_CPU_FILES		512
> > > +#define MIN_CPU_FILES		10
> > >  
> > >  struct cpu_private {
> > >  	unsigned		cpu;
> > > diff --git a/arch/x86/kernel/cpu/cpu_debug.c b/arch/x86/kernel/cpu/cpu_debug.c
> > > index 46e29ab..1c3ebd4 100644
> > > --- a/arch/x86/kernel/cpu/cpu_debug.c
> > > +++ b/arch/x86/kernel/cpu/cpu_debug.c
> > > @@ -838,6 +838,14 @@ static int cpu_init_allreg(unsigned cpu, struct dentry *dentry)
> > >  	return err;
> > >  }
> > >  
> > > +/* Send Report to maintainer if files are less or more then expected */ 
> > > +static void send_report(int files, struct cpuinfo_x86 *cpui)
> > > +{
> > > +	pr_info("Please report \"cpu_debug files %d for %x:%x:%x:%x\" to"
> > > +		" jaswinderrajput@gmail.com\n", files, cpui->x86_vendor,
> > > +		cpui->x86, cpui->x86_model, cpui->x86_mask);
> > 
> > i'd rather see this reported to linux-kernel@vger.kernel.org, plus 
> > please use a WARN_ONCE() instead of a pr_info(). Hitting this is a 
> > bug we want to fix.
> > 
> 
> Subject: [PATCH] x86: cpu_debug.c prepare report if files are less or more then expected
> 
> This will prepare the report to update cpu_debug
> 
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> ---

I send better version of this patch:
[PATCH -tip] x86: cpu_debug.c prepare report if files are inappropriate or CPU is not supported

Thanks,

--
JSR


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-14 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-14 12:17 [PATCH -tip] x86: cpu_debug.c prepare report if files are less or more then expected Jaswinder Singh Rajput
2009-04-14 13:46 ` Ingo Molnar
2009-04-14 15:37   ` Jaswinder Singh Rajput
2009-04-14 16:10     ` Jaswinder Singh Rajput

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox