aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/coretemp.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-10-20hwmon: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-05-01Revert "hwmon: (coretemp) Refine TjMax detection"Guenter Roeck1-2/+2
This reverts commit 9fb6c9c73b11bef65ba80a362547fd116c1e1c9d. Tjmax on some Intel CPUs is below 85 degrees C. One known example is L5630 with Tjmax of 71 degrees C. There are other Xeon processors with Tjmax of 70 or 80 degrees C. Also, the Intel IA32 System Programming document states that the temperature target is in bits 23:16 of MSR 0x1a2 (MSR_TEMPERATURE_TARGET), which is 8 bits, not 7. So even if turbostat uses similar checks to validate Tjmax, there is no evidence that the checks are actually required. On the contrary, the checks are known to cause problems and therefore need to be removed. This fixes https://bugzilla.kernel.org/show_bug.cgi?id=75071. Fixes: 9fb6c9c hwmon: (coretemp) Refine TjMax detection Reviewed-by: Jean Delvare <jdelvare@suse.de> Cc: stable@vger.kernel.org # 3.14+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-04-07Merge tag 'cpu-hotplug-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pmLinus Torvalds1-7/+7
Pull CPU hotplug notifiers registration fixes from Rafael Wysocki: "The purpose of this single series of commits from Srivatsa S Bhat (with a small piece from Gautham R Shenoy) touching multiple subsystems that use CPU hotplug notifiers is to provide a way to register them that will not lead to deadlocks with CPU online/offline operations as described in the changelog of commit 93ae4f978ca7f ("CPU hotplug: Provide lockless versions of callback registration functions"). The first three commits in the series introduce the API and document it and the rest simply goes through the users of CPU hotplug notifiers and converts them to using the new method" * tag 'cpu-hotplug-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (52 commits) net/iucv/iucv.c: Fix CPU hotplug callback registration net/core/flow.c: Fix CPU hotplug callback registration mm, zswap: Fix CPU hotplug callback registration mm, vmstat: Fix CPU hotplug callback registration profile: Fix CPU hotplug callback registration trace, ring-buffer: Fix CPU hotplug callback registration xen, balloon: Fix CPU hotplug callback registration hwmon, via-cputemp: Fix CPU hotplug callback registration hwmon, coretemp: Fix CPU hotplug callback registration thermal, x86-pkg-temp: Fix CPU hotplug callback registration octeon, watchdog: Fix CPU hotplug callback registration oprofile, nmi-timer: Fix CPU hotplug callback registration intel-idle: Fix CPU hotplug callback registration clocksource, dummy-timer: Fix CPU hotplug callback registration drivers/base/topology.c: Fix CPU hotplug callback registration acpi-cpufreq: Fix CPU hotplug callback registration zsmalloc: Fix CPU hotplug callback registration scsi, fcoe: Fix CPU hotplug callback registration scsi, bnx2fc: Fix CPU hotplug callback registration scsi, bnx2i: Fix CPU hotplug callback registration ...
2014-03-20hwmon, coretemp: Fix CPU hotplug callback registrationSrivatsa S. Bhat1-7/+7
Subsystems that want to register CPU hotplug callbacks, as well as perform initialization for the CPUs that are already online, often do it as shown below: get_online_cpus(); for_each_online_cpu(cpu) init_cpu(cpu); register_cpu_notifier(&foobar_cpu_notifier); put_online_cpus(); This is wrong, since it is prone to ABBA deadlocks involving the cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently with CPU hotplug operations). Instead, the correct and race-free way of performing the callback registration is: cpu_notifier_register_begin(); for_each_online_cpu(cpu) init_cpu(cpu); /* Note the use of the double underscored version of the API */ __register_cpu_notifier(&foobar_cpu_notifier); cpu_notifier_register_done(); Fix the hwmon coretemp code by using this latter form of callback registration. Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Jean Delvare <jdelvare@suse.de> Cc: Ingo Molnar <mingo@kernel.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-03hwmon: (coretemp) Convert to use devm_hwmon_device_register_with_groupsGuenter Roeck1-39/+8
Simplify code, reduce code size, and attach sysfs attributes to hwmon device. For this driver, the only attribute created is the name attribute. Other attributes are still created and removed dynamically as cores are added or removed. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de> Tested-by: Jean Delvare <jdelvare@suse.de>
2014-03-03hwmon: (coretemp) Allocate platform data with devm_kzallocGuenter Roeck1-7/+5
This simplifies error handling. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de> Tested-by: Jean Delvare <jdelvare@suse.de>
2014-03-03hwmon: (coretemp) Use sysfs_create_group to create sysfs attributesGuenter Roeck1-13/+7
Instead of creating each attribute individually, use sysfs_create_group to create all attributes for one core with a single call. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de> Tested-by: Jean Delvare <jdelvare@suse.de>
2014-01-14hwmon: (coretemp) Do not return -EAGAIN for low temperaturesGuenter Roeck1-8/+9
Some Intel CPUs do not set the 'valid' bit in IA32_THERM_STATUS if the temperature is too low to be measured. This condition will not change until the CPU is hot enough for its temperature to be measured. Returning an error in such conditions is not very useful. Drop checking the valid bit and just return the reported temperature instead. Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14hwmon: (coretemp) Refine TjMax detectionGuenter Roeck1-2/+2
Intel's turbostat code uses only 7 bits from MSR_IA32_TEMPERATURE_TARGET to read TjMax, and also only accepts it if the reported temperature is at least 85 degrees C. Play safe and do the same. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14hwmon: (coretemp) Add PCI device ID for CE41x0 CPUsGuenter Roeck1-3/+1
Since we now have to use PCI IDs to detect CPU types anyway, use this mechanism to detect CE41x0 CPUs. Advantage is that it only requires a single entry and covers all variants of CE41x0, including those unknown to us. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14hwmon: (coretemp) Use PCI host bridge ID to identify CPU if necessaryGuenter Roeck1-3/+30
Atom S12x0 CPUs are identified by the CPU host bridge ID. Add an override table based on PCI IDs as well as code to detect it. PCI access functions can now be called with PCI disabled, so unlike previous attempts to use PCI IDs, the code no longer depends on it. If PCI is disabled, the CPU will not be identified correctly. Since it is unlikely that anything will work in this case, this is an acceptable limitation. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14hwmon: (coretemp) Fix truncated name of alarm attributesJean Delvare1-1/+1
When the core number exceeds 9, the size of the buffer storing the alarm attribute name is insufficient and the attribute name is truncated. This causes libsensors to skip these attributes as the truncated name is not recognized. Reported-by: Andreas Hollmann <hollmann@in.tum.de> Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11hwmon: (coretemp) Atom CPUs don't support TjMax; no warning neededGuenter Roeck1-1/+13
Display warning "Unable to read TjMax from CPU x" only if the CPU is supposed to support it. This is not the case for the various Atom CPUs. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-07-14hwmon: delete __cpuinit usage from all hwmon filesPaul Gortmaker1-21/+18
The __cpuinit type of throwaway sections might have made sense some time ago when RAM was more constrained, but now the savings do not offset the cost and complications. For example, the fix in commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time") is a good example of the nasty type of bugs that can be created with improper use of the various __init prefixes. After a discussion on LKML[1] it was decided that cpuinit should go the way of devinit and be phased out. Once all the users are gone, we can then finally remove the macros themselves from linux/init.h. This removes all the drivers/hwmon uses of the __cpuinit macros from all C files. [1] https://lkml.org/lkml/2013/5/20/589 Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: lm-sensors@lm-sensors.org Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-21hwmon: (coretemp) Remove redundant platform_set_drvdata()Sachin Kamat1-2/+0
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no driver is bound) removes the need to set driver data field to NULL. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07hwmon: Fix checkpatch warning 'quoted string split across lines'Guenter Roeck1-2/+1
Cc: Corentin Labbe <corentin.labbe@geomatys.fr> Cc: Mark M. Hoffman <mhoffman@lightlink.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Cc: Marc Hulsman <m.hulsman@tudelft.nl> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-01-25hwmon: (coretemp) Document and add support for additional CPU modelsGuenter Roeck1-2/+3
Cc: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-12-11Merge tag 'driver-core-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-coreLinus Torvalds1-4/+4
Pull driver core updates from Greg Kroah-Hartman: "Here's the large driver core updates for 3.8-rc1. The biggest thing here is the various __dev* marking removals. This is going to be a pain for the merge with different subsystem trees, I know, but all of the patches included here have been ACKed by their various subsystem maintainers, as they wanted them to go through here. If this is too much of a pain, I can pull all of them out of this tree and just send you one with the other fixes/updates and then, after 3.8-rc1 is out, do the rest of the removals to ensure we catch them all, it's up to you. The merges should all be trivial, and Stephen has been doing them all in linux-next for a few weeks now quite easily. Other than the __dev* marking removals, there's nothing major here, some firmware loading updates and other minor things in the driver core. All of these have (much to Stephen's annoyance), been in linux-next for a while. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" Fixed up trivial conflicts in drivers/gpio/gpio-{em,stmpe}.c due to gpio update. * tag 'driver-core-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (93 commits) modpost.c: Stop checking __dev* section mismatches init.h: Remove __dev* sections from the kernel acpi: remove use of __devinit PCI: Remove __dev* markings PCI: Always build setup-bus when PCI is enabled PCI: Move pci_uevent into pci-driver.c PCI: Remove CONFIG_HOTPLUG ifdefs unicore32/PCI: Remove CONFIG_HOTPLUG ifdefs sh/PCI: Remove CONFIG_HOTPLUG ifdefs powerpc/PCI: Remove CONFIG_HOTPLUG ifdefs mips/PCI: Remove CONFIG_HOTPLUG ifdefs microblaze/PCI: Remove CONFIG_HOTPLUG ifdefs dma: remove use of __devinit dma: remove use of __devexit_p firewire: remove use of __devinitdata firewire: remove use of __devinit leds: remove use of __devexit leds: remove use of __devinit leds: remove use of __devexit_p mmc: remove use of __devexit ...
2012-12-05hwmon: (coretemp) Drop N4xx, N5xx, D4xx, D5xx CPUs from tjmax tableGuenter Roeck1-8/+0
Since N4xx, N5xx, D4xx, and D5xx are now reliably detected using the model ID and the stepping/mask, drop the respective entries from tjmax_table. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-12-05hwmon: (coretemp) Use model table instead of if/else to identify CPU modelsGuenter Roeck1-14/+27
Make the code easier to extend and easier to adjust by using a model table listing CPU models, stepping/mask, and associated TjMax. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-12-05hwmon: (coretemp) Drop dependency on PCI for TjMax detection on Atom CPUsGuenter Roeck1-22/+15
So far, we use the NM10 Express Chipset PCI chip ID to detect TjMax for Atom CPUs with model 0x1c. As it turns out, we can use the CPU stepping (x86_mask) for the same purpose; stepping is 10 for all model 0x1c CPUs with TjMax of 100 degrees C. This was verified by checking the output of /proc/cpuinfo for the respective CPUs (D4xx, D5xx, N4xx, N5xx). Other CPUs currently covered by the same code (Exx, Z6xx, Z2460) are not supported by the NM10 Express Chipset. Most of those CPUs have TjMax of 90 degrees C, except for E6xxT models which have a TjMax of 110 degrees C. E6xxT CPUs can however not be detected by software. Calculate TjMax for Atom CPUs as follows. Note that the listed values are not correct in some cases (230, 330). tjmax_table is used for those to override the default values. ID Stepping TjMax Models 0x1c 10 100 D4xx, N4xx, D5xx, N5xx 0x1c not 10 90 Z5xx, N2xx, 230, 330, others 0x26 - 90 Atom Tunnel Creek (Exx), Lincroft (Z6xx) 0x27 - 90 Atom Medfield (Z2460) 0x36 - 100 Atom Cedar Trail (N2xxx, D2xxx) Also drop the module dependency on PCI. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-11-28hwmon: remove use of __devexitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devinitBill Pemberton1-2/+2
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devexit_pBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-14hwmon: (coretemp) Add support for Atom CE4110/4150/4170Guenter Roeck1-2/+5
TjMax for the CE4100 series of Atom CPUs was previously reported to be 110 degrees C. cpuinfo logs on the web show existing CPU types CE4110, CE4150, and CE4170, reported as "model name : Intel(R) Atom(TM) CPU CE41{1|5|7}0 @ 1.{2|6}0GHz" with model 28 (0x1c) and stepping 10 (0x0a). Add the three known variants to the tjmax table. Signed-off-by: Guenter Roeck <linux@roeck-us.net> cc: stable@vger.kernel.org Acked-by: Jean Delvare <khali@linux-fr.org>
2012-09-23hwmon: (coretemp) Use get_online_cpus to avoid races involving CPU hotplugSilas Boyd-Wickizer1-0/+5
coretemp_init loops with for_each_online_cpu, adding platform_devices and sysfs interfaces, then calls register_hotcpu_notifier. There is a race if a CPU is offlined or onlined after the loop, but before register_hotcpu_notifier. The race might result in the absence of a platform_device+sysfs interface for an online CPU, or the presence of a platform_device+sysfs interface for an offline CPU. A similar race occurs during coretemp_exit, after the module calls unregister_hotcpu_notifier, but before it unregisters all devices, a CPU might offline and a device for an offline CPU will exist for a short while. This fix surrounds for_each_online_cpu and register_hotcpu_notifier with get_online_cpus+put_online_cpus; and surrounds unregister_hotcpu_notifier and device unregistering with get_online_cpus+put_online_cpus. Build tested. Signed-off-by: Silas Boyd-Wickizer <sbw@mit.edu> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2012-08-18sections: Fix section conflicts in drivers/hwmonAndi Kleen1-1/+1
Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-07-30hwmon: struct x86_cpu_id arrays can be __initconstJan Beulich1-1/+1
... as being referenced from __init code only. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2012-06-29Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds1-2/+2
Pull x86 fixes from Ingo Molnar. * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86, cpufeature: Remove stray %s, add -w to mkcapflags.pl x86, cpufeature: Catch duplicate CPU feature strings x86, cpufeature: Rename X86_FEATURE_DTS to X86_FEATURE_DTHERM x86: Fix kernel-doc warnings x86, compat: Use test_thread_flag(TIF_IA32) in compat signal delivery
2012-06-25x86, cpufeature: Rename X86_FEATURE_DTS to X86_FEATURE_DTHERMH. Peter Anvin1-2/+2
It makes sense to label "Digital Thermal Sensor" as "DTS", but unfortunately the string "dts" was already used for "Debug Store", and /proc/cpuinfo is a user space ABI. Therefore, rename this to "dtherm". This conflict went into mainline via the hwmon tree without any x86 maintainer ack, and without any kind of hint in the subject. a4659053 x86/hwmon: fix initialization of coretemp Reported-by: Jean Delvare <khali@linux-fr.org> Link: http://lkml.kernel.org/r/4FE34BCB.5050305@linux.intel.com Cc: Jan Beulich <JBeulich@suse.com> Cc: <stable@vger.kernel.org> v2.6.36..v3.4 Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2012-06-17hwmon: (coretemp) Drop needless initializationJean Delvare1-1/+1
The value is overridden a few lines later. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-06-17hwmon: (coretemp) Improve support for TjMax detection on Atom CPUsGuenter Roeck1-0/+25
Atom CPUs don't have a register to retrieve TjMax. Detection so far was incomplete. Use the X86 model ID to improve it. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2012-06-17hwmon: (coretemp) Add support for Atom D2000 and N2000 series CPU modelsGuenter Roeck1-0/+3
Document the Atom series D2000 and N2000 (Cedar Trail) as being supported. List and set TjMax for those series. Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: "R, Durgadoss" <durgadoss.r@intel.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2012-06-17hwmon: (coretemp) Improve support of recent Atom CPU modelsJean Delvare1-1/+2
Document the new Atom series (Tunnel Creek and Medfield) as being supported, and list TjMax for the Atom E600 series. Also enable the Atom tjmax heuristic for these Atom CPU models. Signed-off-by: Jean Delvare <khali@linux-fr.org> Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Alexander Stein <alexander.stein@systec-electronic.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: "R, Durgadoss" <durgadoss.r@intel.com>
2012-05-01hwmon: (coretemp) Increase CPU core limitGuenter Roeck1-1/+1
CPU core ID is used to index the core_data[] array. The core ID is, however, not sequential; 10-core CPUS can have a core ID as high as 25. Increase the limit to 32 to be able to deal with current CPUs. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: stable@vger.kernel.org # 3.0+ Acked-by: Jean Delvare <khali@linux-fr.org> Acked-by: Durgadoss R <durgadoss.r@intel.com>
2012-05-01hwmon: (coretemp) fix oops on cpu unplugKirill A. Shutemov1-0/+4
coretemp tries to access core_data array beyond bounds on cpu unplug if core id of the cpu if more than NUM_REAL_CORES-1. BUG: unable to handle kernel NULL pointer dereference at 000000000000013c IP: [<ffffffffa00159af>] coretemp_cpu_callback+0x93/0x1ba [coretemp] PGD 673e5a067 PUD 66e9b3067 PMD 0 Oops: 0000 [#1] SMP CPU 79 Modules linked in: sunrpc cpufreq_ondemand acpi_cpufreq freq_table mperf bnep bluetooth rfkill ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter nf_conntrack_ipv4 nf_defrag_ipv4 ip6_tables xt_state nf_conntrack coretemp crc32c_intel asix tpm_tis pcspkr usbnet iTCO_wdt i2c_i801 microcode mii joydev tpm i2c_core iTCO_vendor_support tpm_bios i7core_edac igb ioatdma edac_core dca megaraid_sas [last unloaded: oprofile] Pid: 3315, comm: set-cpus Tainted: G W 3.4.0-rc5+ #2 QCI QSSC-S4R/QSSC-S4R RIP: 0010:[<ffffffffa00159af>] [<ffffffffa00159af>] coretemp_cpu_callback+0x93/0x1ba [coretemp] RSP: 0018:ffff880472fb3d48 EFLAGS: 00010246 RAX: 0000000000000124 RBX: 0000000000000034 RCX: 00000000ffffffff RDX: 0000000000000000 RSI: 0000000000000046 RDI: 0000000000000246 RBP: ffff880472fb3d88 R08: ffff88077fcd36c0 R09: 0000000000000001 R10: ffffffff8184bc48 R11: 0000000000000000 R12: ffff880273095800 R13: 0000000000000013 R14: ffff8802730a1810 R15: 0000000000000000 FS: 00007f694a20f720(0000) GS:ffff88077fcc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 000000000000013c CR3: 000000067209b000 CR4: 00000000000007e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process set-cpus (pid: 3315, threadinfo ffff880472fb2000, task ffff880471fa0000) Stack: ffff880277b4c308 0000000000000003 ffff880472fb3d88 0000000000000005 0000000000000034 00000000ffffffd1 ffffffff81cadc70 ffff880472fb3e14 ffff880472fb3dc8 ffffffff8161f48d ffff880471fa0000 0000000000000034 Call Trace: [<ffffffff8161f48d>] notifier_call_chain+0x4d/0x70 [<ffffffff8107f1be>] __raw_notifier_call_chain+0xe/0x10 [<ffffffff81059d30>] __cpu_notify+0x20/0x40 [<ffffffff815fa251>] _cpu_down+0x81/0x270 [<ffffffff815fa477>] cpu_down+0x37/0x50 [<ffffffff815fd6a3>] store_online+0x63/0xc0 [<ffffffff813c7078>] dev_attr_store+0x18/0x30 [<ffffffff811f02cf>] sysfs_write_file+0xef/0x170 [<ffffffff81180443>] vfs_write+0xb3/0x180 [<ffffffff8118076a>] sys_write+0x4a/0x90 [<ffffffff816236a9>] system_call_fastpath+0x16/0x1b Code: 48 c7 c7 94 60 01 a0 44 0f b7 ac 10 ac 00 00 00 31 c0 e8 41 b7 5f e1 41 83 c5 02 49 63 c5 49 8b 44 c4 10 48 85 c0 74 56 45 31 ff <39> 58 18 75 4e eb 1f 49 63 d7 4c 89 f7 48 89 45 c8 48 6b d2 28 RIP [<ffffffffa00159af>] coretemp_cpu_callback+0x93/0x1ba [coretemp] RSP <ffff880472fb3d48> CR2: 000000000000013c Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: stable@vger.kernel.org # 3.0+ Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-03-21Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-stagingLinus Torvalds1-2/+2
Pull hwmon changes for v3.4 from Guenter Roeck: "Mostly cleanup. No new drivers this time around, but support for several chips added to existing drivers: TPS40400, TPS40422, MTD040, MAX34446, ZL9101M, ZL9117M, and LM96080. Also, added watchdog support for SCH56xx, and additional attributes for a couple of drivers." * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (137 commits) hwmon: (sch56xx) Add support for the integrated watchdog (v2) hwmon: (w83627ehf) Add support for temperature offset registers hwmon: (jc42) Remove unnecessary device IDs hwmon: (zl6100) Add support for ZL9101M and ZL9117M hwmon: (adm1275) Add support for ADM1075 hwmon: (max34440) Add support for MAX34446 hwmon: (pmbus) Add more virtual registers hwmon: (pmbus) Add support for Lineage Power MDT040 hwmon: (pmbus) Add support for TI TPS40400 and TPS40422 hwmon: (max34440) Add support for 'lowest' output voltage attribute hwmon: (jc42) Convert to use devm_kzalloc hwmon: (max16065) Convert to use devm_kzalloc hwmon: (smm665) Convert to use devm_kzalloc hwmon: (ltc4261) Convert to use devm_kzalloc hwmon: (pmbus) Simplify remove functions hwmon: (pmbus) Convert pmbus drivers to use devm_kzalloc hwmon: (lineage-pem) Convert to use devm_kzalloc hwmon: (hwmon-vid) Fix checkpatch issues hwmon: (hwmon-vid) Add new entries to VRM model table hwmon: (lm80) Add detection of NatSemi/TI LM96080 ...
2012-03-18hwmon: (coretemp) Fix checkpatch errorGuenter Roeck1-2/+2
Fix: ERROR: Macros with complex values should be enclosed in parenthesis Cc: Fenghua Yu <fenghua.yu@intel.com> Acked-By: Durgadoss R <durgadoss.r@intel.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-01-26HWMON: Convert coretemp to x86 cpuid autoprobingAndi Kleen1-3/+14
Use the new x86 cpuid autoprobe interface for the Intel coretemp driver. Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Thomas Renninger <trenn@suse.de> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-16hwmon: (coretemp) Add missing section annotationsJean Delvare1-11/+15
Many functions in the coretemp driver lack a proper section annotation. Add them to let the kernel free the memory after initialization when possible. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Durgadoss R <durgadoss.r@intel.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com>
2011-12-21x86: Simplify code by removing a !SMP #ifdefs from 'struct cpuinfo_x86'Kevin Winchester1-4/+3
Several fields in struct cpuinfo_x86 were not defined for the !SMP case, likely to save space. However, those fields still have some meaning for UP, and keeping them allows some #ifdef removal from other files. The additional size of the UP kernel from this change is not significant enough to worry about keeping up the distinction: text data bss dec hex filename 4737168 506459 972040 6215667 5ed7f3 vmlinux.o.before 4737444 506459 972040 6215943 5ed907 vmlinux.o.after for a difference of 276 bytes for an example UP config. If someone wants those 276 bytes back badly then it should be implemented in a cleaner way. Signed-off-by: Kevin Winchester <kjwinchester@gmail.com> Cc: Steffen Persvold <sp@numascale.com> Link: http://lkml.kernel.org/r/1324428742-12498-1-git-send-email-kjwinchester@gmail.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-11-06hwmon: (coretemp) Fix for non-SMP buildsJean Delvare1-2/+1
The definition of TO_ATTR_NO in the non-SMP case is wrong. As the SMP definition resolves to the correct value, just use this for both cases. Without this fix the temperature attributes are named temp0_* instead of temp2_*, so libsensors won't pick them. Broken since kernel 3.0. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Phil Sutter <phil@nwl.cc> Cc: stable@kernel.org Acked-by: Durgadoss R <Durgadoss.r@intel.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-10-14coretemp: Get microcode revision from cpu_dataAndi Kleen1-24/+4
Now that the ucode revision is available in cpu_data remove the existing code in coretemp.c to query it manually. Read the ucode revision from cpu_data instead Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Cc: jbeulich@novell.com Cc: fenghua.yu@intel.com Cc: khali@linux-fr.org Link: http://lkml.kernel.org/r/1318466795-7393-3-git-send-email-andi@firstfloor.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-09-28hwmon: (coretemp) Avoid leaving around dangling pointerGuenter Roeck1-0/+1
Storing the struct temp_data pointer allocated from create_core_data() when returning an error has the potential of leaving around a pointer to freed memory. Reset it to NULL for error returns. Reported-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Jean Delvare <khali@linux-fr.org>
2011-09-28hwmon: (coretemp) Fixup platform device ID changeJean Delvare1-15/+12
With recent change "hwmon: (coretemp) don't use kernel assigned CPU number as platform device ID", the microcode check is now running on random CPU. Fix that by checking the microcode before creating the platform device rather than at probe time. Also avoid calling TO_PHYS_ID(cpu) twice in the same function, it's expensive. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Jan Beulich <jbeulich@suse.com> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-09-23hwmon: (coretemp) remove struct platform_data * parameter from create_core_data()Jan Beulich1-6/+3
The only caller of the function obtained the pointer solely for the purpose of passing it to this function, while it can be easily determined from the struct platform_device * parameter also passed. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-09-23hwmon: (coretemp) constify static dataJan Beulich1-2/+2
These arrays won't ever be written to, so protect them from unintentional modification. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-09-23hwmon: (coretemp) don't use kernel assigned CPU number as platform device IDJan Beulich1-2/+2
... as that has the potential to conflict with (particularly soft) CPU hot removal and re-adding. Signed-off-by: Jan Beulich <jbeulich@suse.com> [guenter.roeck@ericsson.com: use platform device ID as physical CPU id] Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-09-21hwmon: (coretemp) Don't use threshold registers for tempX_maxGuenter Roeck1-121/+14
With commit c814a4c7c4aad795835583344353963a0a673eb0, the meaning of tempX_max was changed. It no longer returns the value of bits 8:15 of MSR_IA32_TEMPERATURE_TARGET, but instead returns the value of CPU threshold register T1. tempX_max_hyst was added to reflect the value of temperature threshold register T0. As it turns out, T0 and T1 are used on some systems, presumably by the BIOS. Also, T0 and T1 don't have a well defined meaning. The thresholds may be used as upper or lower limits, and it is not guaranteed that T0 <= T1. Thus, the new attribute mapping does not reflect the actual usage of the threshold registers. Also, register contents are changed during runtime by an entity other than the hwmon driver, meaning the values cached by the driver do not reflect actual register contents. Revert most of c814a4c7c4aad795835583344353963a0a673eb0 to address the problem. Support for T0 and T1 will be added back in with a separate commit, using new attribute names. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Durgadoss R <durgadoss.r@intel.com> Acked-by: Jean Delvare <khali@linux-fr.org>
2011-09-21hwmon: (coretemp) Let the user force TjMaxJean Delvare1-0/+15
On old CPUs (and even some recent Atom CPUs) TjMax can't be read from the CPU registers, so it is guessed by the driver using a complex heuristic which isn't reliable. So let users who know their CPU's TjMax pass it as a module parameter. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: "R, Durgadoss" <durgadoss.r@intel.com> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Alexander Stein <alexander.stein@systec-electronic.com> Acked-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>