Tag Archives: cpu

How to Fix Freezing of Linux Kernel on Intel’s Bay Trail SoCs ( Celeron )

A patch fixes the frequent freezing at the Bay Trail has become known low-cost processors, the Celeron series on Linux. The SoCs are installed in cheap notebooks and other cheap hardware.

Bay Trail SoCs are known to be critical in Linux. This ranges from installation problems to crashes every minute. Intel knows the problem. It stands in an errata under the abbreviation VLP52 and is classified as No Fix , so Intel does not fix it .

Affected by the freeze, which usually occurs a few minutes after booting the system, are SoCs such as J1900, Celeron N2840, Celeron N2940, Atom Z3736F and Pentium N3540. The error that caused the crash was initially suspected in the GPU, but then localized in the power management of the chip and is described in a Bugzilla bug report. The problems only occur with many users if a graphical user interface is used.

The problem occurs when the system enters sleep mode C-State 6 (C6) after an interrupt service routine (ISR) is started but before it is terminated and the program continues at the interrupted location. A previously used workaround was to set the processor to C state 1 by passing the intel_idle.max_cstate = 1 parameter to the kernel . However, this leads to increased energy consumption and thus to shorter battery life.

The patch from Wolfgang M. Reimer disables only the C-States 6 and activates the C7-Core-States at the same time . This preserves the energy-saving options. The workaround introduced in mid-July was tested by many users and showed almost all the convincing results. However, some users also report that the problems with kernel 4.7 no longer occur even without the patch on their hardware.

patch (c6off+c7on.sh):

#!/bin/sh

#title:       c6off+c7on.sh
#description: Disables all C6 and enables all C7 core states for Baytrail CPUs
#author:      Wolfgang Reimer <linuxball (at) gmail.com>
#date:        2016014
#version:     1.0    
#usage:       sudo <path>/c6off+c7on.sh
#notes:       Intended as test script to verify whether erratum VLP52 (see
#             [1]) is the root cause for kernel bug 109051 (see [2]). In order
#             for this to work you must _NOT_ use boot parameter
#             intel_idle.max_cstate=<number>.
#
# [1] http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/pentium-n3520-j2850-celeron-n2920-n2820-n2815-n2806-j1850-j1750-spec-update.pdf
# [2] https://bugzilla.kernel.org/show_bug.cgi?id=109051

# Disable ($1 == 1) or enable ($1 == 0) core state, if not yet done.
disable() {
	local action
	read disabled <disable
	test "$disabled" = $1 && return
	echo $1 >disable || return
	action=ENABLED; test "$1" = 0 || action=DISABLED
	printf "%-8s state %7s for %s.\n" $action "$name" $cpu  
}

# Iterate through each core state and for Baytrail (BYT) disable all C6
# and enable all C7 states.
cd /sys/devices/system/cpu
for cpu in cpu[0-9]*; do
	for dir in $cpu/cpuidle/state*; do
		cd "$dir"
		read name <name
		case $name in
			C6*-BYT) disable 1;;
			C7*-BYT) disable 0;;
		esac
		cd ../../..
	done
done

 

References:

https://www.golem.de/news/intel-einfrieren-bei-intels-bay-trail-socs-durch-patch-abgefedert-1609-123546.html

How to check system information on linux command line

There are several commands on Linux to fetch system information like number of cpus, partitions, their type and hardware information. In this article we will see few commands which are helpful to fetch information like mentioned above.

Command lscpu

The command lscpu will give the brief summary about cpu and cores. That is total number of cpus and number of cores per cpu are available on machine. The command output would be something like below describing cups and cores.

# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    2
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 58
Stepping:              9
CPU MHz:               1254.394
BogoMIPS:              4988.85
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0-3

 

Command lspci

Command lspci will list all PCI devices  available and recognized by kernel on machine

# lspci
00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)
00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4)
00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4)
00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation HM77 Express Chipset LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series] (rev ff)
07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller (rev 05)
08:00.0 Network controller: Broadcom Corporation BCM43142 802.11b/g/n (rev 01)

This command is useful to find available devices on machine and corresponding vendor.

Command procinfo

This command display system statistics gathered from /proc. That is you will get insight overview from file system /proc

This is command is useful to find,

Users, boot up time, load, swap, memory and interrupt etc.

s# procinfo
Memory:        Total        Used        Free     Buffers                       
RAM:         8075912     5422088     2653824      629120                       
Swap:        4092924       37076     4055848                                   

Bootup: Sun Jun 19 11:19:52 2016   Load average: 0.37 0.46 0.40 2/895 14009    

user  :      01:07:43.25   2.0%  page in :          2202162                    
nice  :      00:07:06.18   0.2%  page out:          3703908                    
system:      00:18:09.06   0.5%  page act:          2084699                    
IOwait:      00:30:13.51   0.9%  page dea:           239956                    
hw irq:      00:00:00.04   0.0%  page flt:         78776915                    
sw irq:      00:00:19.22   0.0%  swap in :             1333                    
idle  :   2d 05:06:32.92  96.3%  swap out:            25034                    
uptime:      13:51:59.48         context :         64344840                    

irq   0:         18  timer               irq  25:          0  xhci_hcd         
irq   1:      10656  i8042               irq  26:          0  eth0             
irq   8:          1  rtc0                irq  27:     454653  0000:00:1f.2     
irq   9:         87  acpi                irq  28:         15  mei_me           
irq  12:     201507  i8042               irq  29:        532  snd_hda_intel    
irq  16:        345  16-fasteoi ehci_h   irq  30:     127539  i915             
irq  17:    1121122  17-fasteoi wlan0    irq  31:         27  radeon           
irq  23:        187  23-fasteoi ehci_h                                         

sda           193761r          200425w                                         

eth0        TX 0.00B         RX 0.00B         wlan0       TX 40.60MiB      RX 186.85MiB    
lo          TX 370.71KiB     RX 370.71KiB                                      

 

Command lsdev

The command lsdev display information about installed hardware.  This command also gathers some information from /proc file system and will give  quick overview of which hardware uses what I/O addresses, what IRQ and DMA channels

Command lsblk

This is useful to list the block devices available. To list type the following,

lsblk

# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   100M  0 part 
├─sda2   8:2    0  98.5G  0 part 
├─sda3   8:3    0  97.7G  0 part 
├─sda4   8:4    0     1K  0 part 
├─sda5   8:5    0  86.2G  0 part 
├─sda6   8:6    0    92G  0 part 
├─sda7   8:7    0   3.9G  0 part [SWAP]
└─sda8   8:8    0  87.5G  0 part /
sr0     11:0    1  1024M  0 rom  

 

Command lsusb

This command will list all available USB ports on machine.

# lsusb
Bus 004 Device 003: ID 0a5c:21d7 Broadcom Corp. BCM43142 Bluetooth 4.0
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 004: ID 064e:8125 Suyin Corp. 
Bus 003 Device 003: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

Command lshw

The command lshw will list the complete hardware information. It gives pretty big output. Try this out on your linux box to get complete hardware information,

lshw

Command df -ah

This command displays information regarding partitions something like used space, available space and file system type. To do so type following command

df -ah

Where option -a and -h  are to list  all volumes and display usage in human readable format respectively.

$ df -ah
Filesystem      Size   Used  Avail Capacity  iused    ifree %iused  Mounted on
/dev/disk1      92Gi   77Gi   15Gi    84% 20284234  3914932   84%   /
devfs          329Ki  329Ki    0Bi   100%     1137        0  100%   /dev
/dev/disk0s4    63Gi  3.6Gi   59Gi     6%   944196 15494636    6%   /Volumes/Data
/dev/disk0s5    77Gi   45Gi   32Gi    59% 11843161  8433770   58%   /Volumes/Games
map -hosts       0Bi    0Bi    0Bi   100%        0        0  100%   /net
map auto_home    0Bi    0Bi    0Bi   100%        0        0  100%   /home

Command mount

The command mount is used for both to display mounted volumes information and mount the required volume at specified location.

To display mounted volumes and location, just type the following command

mount

As mentioned this can also be useful to mount paritions, to do so,

mount /dev/sda2  /location/to/mount

Where /dev/sda2  is the partition to mount at specified location

File /proc/interrupts

The /proc/interrupts contains the list of all supported interrupts by this CPU.  This is nothing more than a file having information about interrupts.

cat /proc/interrupts 
           CPU0       CPU1       CPU2       CPU3       
  0:         18          0          0          0   IO-APIC-edge      timer
  1:        166       1611        107        142   IO-APIC-edge      i8042
  8:          0          1          0          0   IO-APIC-edge      rtc0
  9:         26         14          2          1   IO-APIC-fasteoi   acpi
 12:       6601      51898       5272       4890   IO-APIC-edge      i8042
 16:         22        247         15         59   IO-APIC  16-fasteoi   ehci_hcd:usb3
 17:       8827      32076       2265       6273   IO-APIC  17-fasteoi   wlan0
 23:         29        114         12         32   IO-APIC  23-fasteoi   ehci_hcd:usb4
 25:          0          0          0          0   PCI-MSI-edge      xhci_hcd
 26:          0          0          0          0   PCI-MSI-edge      eth0
 27:       3506      25472       3876      18634   PCI-MSI-edge      0000:00:1f.2
 28:          0         15          0          0   PCI-MSI-edge      mei_me
 29:        425        373         93        215   PCI-MSI-edge      snd_hda_intel
 30:       7204      21584       4192       4105   PCI-MSI-edge      i915
 31:         13          5          3          2   PCI-MSI-edge      radeon
NMI:          7          8          7          7   Non-maskable interrupts
LOC:     135444      97512     127823      98675   Local timer interrupts
SPU:          0          0          0          0   Spurious interrupts
PMI:          7          8          7          7   Performance monitoring interrupts
IWI:          0          3          0          0   IRQ work interrupts
RTR:          2          0          0          0   APIC ICR read retries
RES:      19153      18350      15877      15106   Rescheduling interrupts
CAL:       1178        554        910        842   Function call interrupts
TLB:       6742       6857       7333       6673   TLB shootdowns
TRM:          4          4          4          4   Thermal event interrupts
THR:          0          0          0          0   Threshold APIC interrupts
MCE:          0          0          0          0   Machine check exceptions
MCP:          9          9          9          9   Machine check polls
HYP:          0          0          0          0   Hypervisor callback interrupts
ERR:          0
MIS:          0