All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH] lmsensors: read cpu information fail on ppc
@ 2019-02-27  8:12 changqing.li
  2019-02-27 16:44 ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: changqing.li @ 2019-02-27  8:12 UTC (permalink / raw)
  To: openembedded-devel

From: Dengke Du <dengke.du@windriver.com>

The program sensors-detect in lmsensors can't read the cpu
information on ppc and arm arch, such as: fsl-t4xxx based on ppc.

This is because the program sensors-detect design for the x86 and
x86-64, but weak on ppc and arm.

So add the support for the ppc and arm, just add the correspond
field to read in sensors-detect.

Signed-off-by: Dengke Du <dengke.du@windriver.com>
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 ...fix-sensors-detect-can-t-read-the-cpu-inf.patch | 74 ++++++++++++++++++++++
 meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb  |  1 +
 2 files changed, 75 insertions(+)
 create mode 100644 meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch

diff --git a/meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch b/meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch
new file mode 100644
index 0000000..2d5709f
--- /dev/null
+++ b/meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch
@@ -0,0 +1,74 @@
+From dd9b40c54f160a44f1d78e5946d4cd00a8852802 Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Wed, 21 Sep 2016 03:17:32 -0400
+Subject: [PATCH] lm-sensors: fix sensors-detect can't read the cpu information
+ on fsl-t4xxx
+
+This is because two reasons:
+
+1. The sensors-detect program in lm-sensors depends on the file '/proc/cpuinfo',
+   different arch write different infomation to it. That program supports x86
+   and x86-64 well, but weak on ppc and arm.
+
+2. The sensors-detect program show the cpu information just design for intel's
+   cpu, when meets other arch, it can't output the correct information.
+
+So we need to add the ppc and arm support for this program:
+
+1. add the ppc cpu information field 'cpu' in initialize_cpu_list function.
+
+2. add the correspond case of ppc and arm when print cpu information in
+   print_cpu_info function.
+
+Upstream-Status: Pending
+
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+---
+ prog/detect/sensors-detect | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect
+index 5f62405..ae4def1 100755
+--- a/prog/detect/sensors-detect
++++ b/prog/detect/sensors-detect
+@@ -2833,6 +2833,7 @@ sub kernel_version_at_least
+ # model name and stepping, directly taken from /proc/cpuinfo.
+ use vars qw(@cpu);
+ 
++# The added field 'cpu' is for support the ppc.
+ sub initialize_cpu_list
+ {
+ 	local $_;
+@@ -2848,7 +2849,7 @@ sub initialize_cpu_list
+ 			};
+ 			next;
+ 		}
+-		if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level)\s*:\s*(.+)$/) {
++		if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level|cpu|revision)\s*:\s*(.+)$/) {
+ 			my $k = $1;
+ 			my $v = $2;
+ 			$v =~ s/\s+/ /g;	# Merge multiple spaces
+@@ -2861,12 +2862,20 @@ sub initialize_cpu_list
+ 	push @cpu, $entry if scalar keys(%{$entry}); # Last entry
+ }
+ 
++# The field 'model name' is for ARM.
++# The field 'cpu' is for ppc.
+ sub print_cpu_info
+ {
+ 	my $cpu = $cpu[0];
+ 	if ( $cpu->{'model name'} && $cpu->{'cpu family'} && $cpu->{model} && $cpu->{stepping} ) {
+ 		print "# Processor: $cpu->{'model name'} ($cpu->{'cpu family'}/$cpu->{model}/$cpu->{stepping})\n";
+ 	}
++	elsif ( $cpu->{'model name'} ) {
++		print "# Processor: $cpu->{'model name'}\n";
++	}
++	elsif ( $cpu->{'cpu'} && $cpu->{'revision'} ) {
++		print "# Processor: $cpu->{'cpu'} $cpu->{'revision'}\n";
++	}
+ 	else {
+ 		print "# Processor: There isn't enough cpu info for this arch!!!\n";
+ 	}
+-- 
+2.8.1
+
diff --git a/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb b/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb
index ffab5d6..4dbef73 100644
--- a/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb
+++ b/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb
@@ -12,6 +12,7 @@ SRC_URI = "https://github.com/groeck/lm-sensors/archive/V3-4-0.tar.gz \
            file://sensord.init \
            file://0001-lmsensors-sensors-detect-print-a-special-message-whe.patch \
            file://0001-prog-Do-not-limit-sys-io.h-header-include-to-just-gl.patch \
+           file://0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch \
 "
 SRC_URI[md5sum] = "1e9f117cbfa11be1955adc96df71eadb"
 SRC_URI[sha256sum] = "e334c1c2b06f7290e3e66bdae330a5d36054701ffd47a5dde7a06f9a7402cb4e"
-- 
2.7.4



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

* Re: [meta-oe][PATCH] lmsensors: read cpu information fail on ppc
  2019-02-27  8:12 [meta-oe][PATCH] lmsensors: read cpu information fail on ppc changqing.li
@ 2019-02-27 16:44 ` Khem Raj
  2019-02-28  2:33   ` Changqing Li
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2019-02-27 16:44 UTC (permalink / raw)
  To: Changqing Li; +Cc: openembeded-devel

On Wed, Feb 27, 2019 at 12:13 AM <changqing.li@windriver.com> wrote:
>
> From: Dengke Du <dengke.du@windriver.com>
>
> The program sensors-detect in lmsensors can't read the cpu
> information on ppc and arm arch, such as: fsl-t4xxx based on ppc.
>
> This is because the program sensors-detect design for the x86 and
> x86-64, but weak on ppc and arm.
>
> So add the support for the ppc and arm, just add the correspond
> field to read in sensors-detect.
>

the patch deserves to be upstreamed to lmsensors as well. Can you
try doing that on the side ?

> Signed-off-by: Dengke Du <dengke.du@windriver.com>
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>  ...fix-sensors-detect-can-t-read-the-cpu-inf.patch | 74 ++++++++++++++++++++++
>  meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb  |  1 +
>  2 files changed, 75 insertions(+)
>  create mode 100644 meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch
>
> diff --git a/meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch b/meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch
> new file mode 100644
> index 0000000..2d5709f
> --- /dev/null
> +++ b/meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch
> @@ -0,0 +1,74 @@
> +From dd9b40c54f160a44f1d78e5946d4cd00a8852802 Mon Sep 17 00:00:00 2001
> +From: Dengke Du <dengke.du@windriver.com>
> +Date: Wed, 21 Sep 2016 03:17:32 -0400
> +Subject: [PATCH] lm-sensors: fix sensors-detect can't read the cpu information
> + on fsl-t4xxx
> +
> +This is because two reasons:
> +
> +1. The sensors-detect program in lm-sensors depends on the file '/proc/cpuinfo',
> +   different arch write different infomation to it. That program supports x86
> +   and x86-64 well, but weak on ppc and arm.
> +
> +2. The sensors-detect program show the cpu information just design for intel's
> +   cpu, when meets other arch, it can't output the correct information.
> +
> +So we need to add the ppc and arm support for this program:
> +
> +1. add the ppc cpu information field 'cpu' in initialize_cpu_list function.
> +
> +2. add the correspond case of ppc and arm when print cpu information in
> +   print_cpu_info function.
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Dengke Du <dengke.du@windriver.com>
> +---
> + prog/detect/sensors-detect | 11 ++++++++++-
> + 1 file changed, 10 insertions(+), 1 deletion(-)
> +
> +diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect
> +index 5f62405..ae4def1 100755
> +--- a/prog/detect/sensors-detect
> ++++ b/prog/detect/sensors-detect
> +@@ -2833,6 +2833,7 @@ sub kernel_version_at_least
> + # model name and stepping, directly taken from /proc/cpuinfo.
> + use vars qw(@cpu);
> +
> ++# The added field 'cpu' is for support the ppc.
> + sub initialize_cpu_list
> + {
> +       local $_;
> +@@ -2848,7 +2849,7 @@ sub initialize_cpu_list
> +                       };
> +                       next;
> +               }
> +-              if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level)\s*:\s*(.+)$/) {
> ++              if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level|cpu|revision)\s*:\s*(.+)$/) {
> +                       my $k = $1;
> +                       my $v = $2;
> +                       $v =~ s/\s+/ /g;        # Merge multiple spaces
> +@@ -2861,12 +2862,20 @@ sub initialize_cpu_list
> +       push @cpu, $entry if scalar keys(%{$entry}); # Last entry
> + }
> +
> ++# The field 'model name' is for ARM.
> ++# The field 'cpu' is for ppc.
> + sub print_cpu_info
> + {
> +       my $cpu = $cpu[0];
> +       if ( $cpu->{'model name'} && $cpu->{'cpu family'} && $cpu->{model} && $cpu->{stepping} ) {
> +               print "# Processor: $cpu->{'model name'} ($cpu->{'cpu family'}/$cpu->{model}/$cpu->{stepping})\n";
> +       }
> ++      elsif ( $cpu->{'model name'} ) {
> ++              print "# Processor: $cpu->{'model name'}\n";
> ++      }
> ++      elsif ( $cpu->{'cpu'} && $cpu->{'revision'} ) {
> ++              print "# Processor: $cpu->{'cpu'} $cpu->{'revision'}\n";
> ++      }
> +       else {
> +               print "# Processor: There isn't enough cpu info for this arch!!!\n";
> +       }
> +--
> +2.8.1
> +
> diff --git a/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb b/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb
> index ffab5d6..4dbef73 100644
> --- a/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb
> +++ b/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb
> @@ -12,6 +12,7 @@ SRC_URI = "https://github.com/groeck/lm-sensors/archive/V3-4-0.tar.gz \
>             file://sensord.init \
>             file://0001-lmsensors-sensors-detect-print-a-special-message-whe.patch \
>             file://0001-prog-Do-not-limit-sys-io.h-header-include-to-just-gl.patch \
> +           file://0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch \
>  "
>  SRC_URI[md5sum] = "1e9f117cbfa11be1955adc96df71eadb"
>  SRC_URI[sha256sum] = "e334c1c2b06f7290e3e66bdae330a5d36054701ffd47a5dde7a06f9a7402cb4e"
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


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

* Re: [meta-oe][PATCH] lmsensors: read cpu information fail on ppc
  2019-02-27 16:44 ` Khem Raj
@ 2019-02-28  2:33   ` Changqing Li
  0 siblings, 0 replies; 3+ messages in thread
From: Changqing Li @ 2019-02-28  2:33 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembeded-devel


On 2/28/19 12:44 AM, Khem Raj wrote:
> On Wed, Feb 27, 2019 at 12:13 AM <changqing.li@windriver.com> wrote:
>> From: Dengke Du <dengke.du@windriver.com>
>>
>> The program sensors-detect in lmsensors can't read the cpu
>> information on ppc and arm arch, such as: fsl-t4xxx based on ppc.
>>
>> This is because the program sensors-detect design for the x86 and
>> x86-64, but weak on ppc and arm.
>>
>> So add the support for the ppc and arm, just add the correspond
>> field to read in sensors-detect.
>>
> the patch deserves to be upstreamed to lmsensors as well. Can you
> try doing that on the side ?

Yes,  I have send it to upstream lmsensors.

https://github.com/lm-sensors/lm-sensors/pull/168

>> Signed-off-by: Dengke Du <dengke.du@windriver.com>
>> Signed-off-by: Changqing Li <changqing.li@windriver.com>
>> ---
>>   ...fix-sensors-detect-can-t-read-the-cpu-inf.patch | 74 ++++++++++++++++++++++
>>   meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb  |  1 +
>>   2 files changed, 75 insertions(+)
>>   create mode 100644 meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch
>>
>> diff --git a/meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch b/meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch
>> new file mode 100644
>> index 0000000..2d5709f
>> --- /dev/null
>> +++ b/meta-oe/recipes-bsp/lm_sensors/lmsensors/0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch
>> @@ -0,0 +1,74 @@
>> +From dd9b40c54f160a44f1d78e5946d4cd00a8852802 Mon Sep 17 00:00:00 2001
>> +From: Dengke Du <dengke.du@windriver.com>
>> +Date: Wed, 21 Sep 2016 03:17:32 -0400
>> +Subject: [PATCH] lm-sensors: fix sensors-detect can't read the cpu information
>> + on fsl-t4xxx
>> +
>> +This is because two reasons:
>> +
>> +1. The sensors-detect program in lm-sensors depends on the file '/proc/cpuinfo',
>> +   different arch write different infomation to it. That program supports x86
>> +   and x86-64 well, but weak on ppc and arm.
>> +
>> +2. The sensors-detect program show the cpu information just design for intel's
>> +   cpu, when meets other arch, it can't output the correct information.
>> +
>> +So we need to add the ppc and arm support for this program:
>> +
>> +1. add the ppc cpu information field 'cpu' in initialize_cpu_list function.
>> +
>> +2. add the correspond case of ppc and arm when print cpu information in
>> +   print_cpu_info function.
>> +
>> +Upstream-Status: Pending
>> +
>> +Signed-off-by: Dengke Du <dengke.du@windriver.com>
>> +---
>> + prog/detect/sensors-detect | 11 ++++++++++-
>> + 1 file changed, 10 insertions(+), 1 deletion(-)
>> +
>> +diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect
>> +index 5f62405..ae4def1 100755
>> +--- a/prog/detect/sensors-detect
>> ++++ b/prog/detect/sensors-detect
>> +@@ -2833,6 +2833,7 @@ sub kernel_version_at_least
>> + # model name and stepping, directly taken from /proc/cpuinfo.
>> + use vars qw(@cpu);
>> +
>> ++# The added field 'cpu' is for support the ppc.
>> + sub initialize_cpu_list
>> + {
>> +       local $_;
>> +@@ -2848,7 +2849,7 @@ sub initialize_cpu_list
>> +                       };
>> +                       next;
>> +               }
>> +-              if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level)\s*:\s*(.+)$/) {
>> ++              if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level|cpu|revision)\s*:\s*(.+)$/) {
>> +                       my $k = $1;
>> +                       my $v = $2;
>> +                       $v =~ s/\s+/ /g;        # Merge multiple spaces
>> +@@ -2861,12 +2862,20 @@ sub initialize_cpu_list
>> +       push @cpu, $entry if scalar keys(%{$entry}); # Last entry
>> + }
>> +
>> ++# The field 'model name' is for ARM.
>> ++# The field 'cpu' is for ppc.
>> + sub print_cpu_info
>> + {
>> +       my $cpu = $cpu[0];
>> +       if ( $cpu->{'model name'} && $cpu->{'cpu family'} && $cpu->{model} && $cpu->{stepping} ) {
>> +               print "# Processor: $cpu->{'model name'} ($cpu->{'cpu family'}/$cpu->{model}/$cpu->{stepping})\n";
>> +       }
>> ++      elsif ( $cpu->{'model name'} ) {
>> ++              print "# Processor: $cpu->{'model name'}\n";
>> ++      }
>> ++      elsif ( $cpu->{'cpu'} && $cpu->{'revision'} ) {
>> ++              print "# Processor: $cpu->{'cpu'} $cpu->{'revision'}\n";
>> ++      }
>> +       else {
>> +               print "# Processor: There isn't enough cpu info for this arch!!!\n";
>> +       }
>> +--
>> +2.8.1
>> +
>> diff --git a/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb b/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb
>> index ffab5d6..4dbef73 100644
>> --- a/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb
>> +++ b/meta-oe/recipes-bsp/lm_sensors/lmsensors_3.4.0.bb
>> @@ -12,6 +12,7 @@ SRC_URI = "https://github.com/groeck/lm-sensors/archive/V3-4-0.tar.gz \
>>              file://sensord.init \
>>              file://0001-lmsensors-sensors-detect-print-a-special-message-whe.patch \
>>              file://0001-prog-Do-not-limit-sys-io.h-header-include-to-just-gl.patch \
>> +           file://0001-lm-sensors-fix-sensors-detect-can-t-read-the-cpu-inf.patch \
>>   "
>>   SRC_URI[md5sum] = "1e9f117cbfa11be1955adc96df71eadb"
>>   SRC_URI[sha256sum] = "e334c1c2b06f7290e3e66bdae330a5d36054701ffd47a5dde7a06f9a7402cb4e"
>> --
>> 2.7.4
>>
>> --
>> _______________________________________________
>> Openembedded-devel mailing list
>> Openembedded-devel@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-devel

-- 
BRs

Sandy(Li Changqing)



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

end of thread, other threads:[~2019-02-28  2:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-27  8:12 [meta-oe][PATCH] lmsensors: read cpu information fail on ppc changqing.li
2019-02-27 16:44 ` Khem Raj
2019-02-28  2:33   ` Changqing Li

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.