how to enable linux perf tool's branch sampling - linux

I use linux perf tool to collect branch info of programs, and the command and result is as follow:
$ sudo perf record -b /bin/ls
Error:
No hardware sampling interrupt available.
No APIC? If so then you can boot the kernel with the "lapic" boot parameter to force-enable it.
the content in /pro/cpuinfo is below:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5405 # 2.00GHz
stepping : 10
microcode : 0xa07
cpu MHz : 1994.921
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 **apic** sep mtrr pge mca cmov pat pse36 clflush dts acpi strong text mmx fxsr sse sse2 ss ht tm
pbe syscall nx lm constant_tsc arch_perfmon pebs **bts** rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm
dca sse4_1 xsave lahf_lm dtherm tpr_shadow vnmi flexpriority
bugs :
bogomips : 3989.84
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
apic and bts in flags entry is strengthened(I want but just encapsuled by "**") and I don't know what else is import for this case. And the other 7 processors are same to processor 0.
The boot parameter "lapic" is added by modifying /boot/grub/grub.cfg:
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-0ed8a872-4eb7-4339-a0bb-6c0033da582e' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 ced80bc6-08a9-4909-9717-97658cf0c4fd
else
search --no-floppy --fs-uuid --set=root ced80bc6-08a9-4909-9717-97658cf0c4fd
fi
linux /vmlinuz-4.2.0-42-generic root=/dev/mapper/fedora_hustyong-root ro **lapic** quiet splash $vt_handoff
initrd /initrd.img-4.2.0-42-generic
}
just add lapic in linux entry.
But no sense after rebooting.
My questions:
1) What does the error info means?
2) Does the perf tool branch sampling use Intel Branch Trace Store(BTS)? Or Last Branch Record(LBR)?
3) How can I look up the LBR support?
4) what is different of the LBR and BTS support between x86 32bit and 64bit?
My OS is Ubuntu 14.04 64bit:
$ uname -a
Linux user-S5000VSA 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
The perf install instructions:
$ sudo apt-get install linux-tools-common
$ sudo apt-get install linux-tools-4.2.0-27-generic linux-cloud-tools-4.2.0-27-generic
update:
the content of /proc/interrupts:
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
0: 127780 52084 127784 126729 127706 128431 127785 126822 IO-APIC 2-edge timer
1: 52 42 3 2 62 49 5 2 IO-APIC 1-edge i8042
8: 0 0 0 0 0 0 0 1 IO-APIC 8-edge rtc0
9: 0 0 0 0 0 0 0 0 IO-APIC 9-fasteoi acpi
12: 1428 1307 52 47 1424 1324 53 58 IO-APIC 12-edge i8042
14: 0 0 0 0 0 0 0 0 IO-APIC 14-edge ata_piix
15: 0 0 0 0 0 0 0 0 IO-APIC 15-edge ata_piix
17: 47 276 1004 49 52 295 993 50 IO-APIC 17-fasteoi radeon
20: 31062 4201 7533 29935 31080 4297 7540 29824 IO-APIC 20-fasteoi ata_piix
22: 0 0 0 0 0 0 0 0 IO-APIC 22-fasteoi uhci_hcd:usb3, uhci_hcd:usb5
23: 0 0 0 0 0 0 0 0 IO-APIC 23-fasteoi ehci_hcd:usb1, uhci_hcd:usb2, uhci_hcd:usb4
25: 2 755654 3 3 1 1 3 6 PCI-MSI 2621440-edge eth0
27: 0 0 0 0 0 0 0 1 PCI-MSI 131072-edge ioat-msi
NMI: 6756 678 6894 5867 861 2168 4994 3700 Non-maskable interrupts
LOC: 343554 578094 1736638 773135 219952 777567 1459249 689292 Local timer interrupts
SPU: 0 0 0 0 0 0 0 0 Spurious interrupts
PMI: 6756 678 6894 5867 861 2168 4994 3700 Performance monitoring interrupts
IWI: 6756 678 6894 5867 861 2168 4994 3700 IRQ work interrupts
RTR: 0 0 0 0 0 0 0 0 APIC ICR read retries
RES: 82594 294601 142535 259797 77845 316210 84927 261455 Rescheduling interrupts
CAL: 4749 9296 7358 31330 7560 8564 5751 20364 Function call interrupts
TLB: 5933 2044 12867 11215 6563 4682 8669 8272 TLB shootdowns
TRM: 0 0 0 0 0 0 0 0 Thermal event interrupts
THR: 0 0 0 0 0 0 0 0 Threshold APIC interrupts
DFR: 0 0 0 0 0 0 0 0 Deferred Error APIC interrupts
MCE: 0 0 0 0 0 0 0 0 Machine check exceptions
MCP: 292 292 292 292 292 292 292 292 Machine check polls
HYP: 0 0 0 0 0 0 0 0 Hypervisor callback interrupts
ERR: 0
MIS: 0
PIN: 0 0 0 0 0 0 0 0 Posted-interrupt notification event
PIW: 0 0 0 0 0 0 0 0 Posted-interrupt wakeup event
I install ubuntu 16.10 64bit in my PC and run perf record -b successfully. I think maybe it's wrong in kernel or linux-tools-4.2.0-27-generic or linux-cloud-tools-4.2.0-27-generic package.

Related

Run program on boot with initramfs

I'm running uClinux on a SmartFusion2 as part of a University team building a small cube satellite. However, I'm not super experienced in Linux kernel, and this issue has had me stumped for a few days. I'm trying to get the SmartFusion to run a program on bootup. Currently, the only .uImage that does this is the test 'hello' file. I'm trying to recreate the process for another program, but am running into some difficulties.
in my hello directory I have the following files: hello.busybox, hello.kernel.M2S, help.txt, hello.uImage, Makefile, hello.initramfs, hello (directory)
in the hello subdirectory (projects/hello/hello):
hello (executable), hello.c, hello.gdb, hello.h, hello.o, Makefile
to try and get the uImage to boot and run a different program, I made a copy of my projects/hello/hello directory and renamed it 'goodbye', with a few minor changes int the .h and .c files for testing purposes. Now I'm trying to get the executable 'hello' in projects/hello/goodbye to run on boot.
My initramfs file originally looked like this:
# This is a very simple, default initramfs
dir /dev 0755 0 0
nod /dev/console 0600 0 0 c 5 1
nod /dev/tty 0666 0 0 c 5 0
nod /dev/null 0600 0 0 c 1 3
nod /dev/mem 0600 0 0 c 1 1
nod /dev/kmem 0600 0 0 c 1 2
nod /dev/zero 0600 0 0 c 1 5
nod /dev/random 0600 0 0 c 1 8
nod /dev/urandom 0600 0 0 c 1 9
dir /dev/pts 0755 0 0
nod /dev/ptmx 0666 0 0 c 5 2
nod /dev/ttyS0 0666 0 0 c 4 64
nod /dev/ttyS1 0666 0 0 c 4 65
nod /dev/ttyS2 0666 0 0 c 4 66
nod /dev/ttyS3 0666 0 0 c 4 67
nod /dev/ttyS4 0666 0 0 c 4 68
nod /dev/ttyS5 0666 0 0 c 4 69
dir /bin 755 0 0
dir /proc 755 0 0
file /bin/hello ${INSTALL_ROOT}/projects/${SAMPLE}/hello/hello 755 0 0
slink /bin/init hello 777 0 0
I changed the last two lines of the initramfs to read as follows:
file /bin/hello ${INSTALL_ROOT}/projects/${SAMPLE}/hello/goodbye 755 0 0
slink /bin/init hello 777 0 0
But when I try and boot the SmartFusion2 after remaking the uImage, I get this, witht the error at the bottom:
Starting kernel ...
Linux version 2.6.33-arm1 (ecenstudent#EE10308) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-189) ) #38 Thu May 25 09:09:08 MDT 2017
CPU: ARMv7-M Processor [412fc231] revision 1 (ARMv7M)
CPU: NO data cache, 8K instruction cache
Machine: Microsemi M2S
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: m2s_platform=m2s-fg484-som console=ttyS0,115200 panic=10 ip=10.2.118.102:10.2.118.101:192.168.0.1::m2s-fg484-som:eth0:off ethaddr=3C:FB:96:05:00:53
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 64408k/64408k available, 1128k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0x00000000 - 0x00001000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0x00000000 - 0xffffffff (4095 MB)
lowmem : 0xa0000000 - 0xa4000000 ( 64 MB)
modules : 0xa0000000 - 0x01000000 (1552 MB)
.init : 0xa0008000 - 0xa0012000 ( 40 kB)
.text : 0xa0074bc0 - 0xa0083000 ( 58 kB)
.data : 0xa0084000 - 0xa008cce0 ( 36 kB)
Hierarchical RCU implementation.
NR_IRQS:83
Calibrating delay loop... 132.30 BogoMIPS (lpj=661504)
Mount-cache hash table entries: 512
Switching to clocksource mss_timer2
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x40000000 (irq = 10) is a 16550A
console [ttyS0] enabled
serial8250.1: ttyS1 at MMIO 0x40010000 (irq = 11) is a 16550A
Freeing init memory: 40K
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
Backtrace: no frame pointer
Rebooting in 10 seconds..
Can somebody help explain why this is happening and what I need to do to my initramfs to make it run the proper program on boot? Thanks!!
As it turns out, I was confused about how those two lines worked. When I finally figured it out, they looked like this:
file /bin/hello ${INSTALL_ROOT}/projects/${SAMPLE}/goodbye/hello 755 0 0
slink /bin/init hello 777 0 0
then it worked as desired, and I was able to implement it into other uImages.

How to check what is causing performance issue

I have inherited a server with some performance issues. It is running node js, nginx, basic MEAN stack. (DB on another server though)
Whenever I copied a file (log file with size of around 150MB) or vim a file with that size, the output of "iostat -x 1" will be like below
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
scd0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 8137.62 0.00 49.50 0.00 29924.75 604.48 17.32 123.54 16.50 81.68
avg-cpu: %user %nice %system %iowait %steal %idle
1.59 0.00 24.34 0.00 0.00 74.07
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
scd0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.00 0.00 39.39 0.00 36606.06 929.23 2.42 351.64 1.87 7.37
avg-cpu: %user %nice %system %iowait %steal %idle
2.78 0.00 24.44 0.00 0.00 72.78
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
scd0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
The main reason I am bringing this up is because sometimes a simple RESTFUL API that my nodejs is serving will respond slowly (from 10ms to 500ms) and I am not sure what to look for or check what is causing this.
The same codebase copied to another server will run smoothly without issues, the problem mentioned above is the only lead I can find that there might be something wrong with the server but I am not sure what is it.
The codes are like below:
In one file statistic/index.js:
var tracker = function (data) {
piwik.tracker(data);
};
exports.tracker = tracker;
In another file statistic/piwik.js:
exports.tracker = function (data) {
var params = {};
/** Assign params with data - just static string **/
/** API_URL is another machine in same LAN **/
needle.post(API_URL, params, function (err, response, body) {
if (err || (response.statusCode !== 200 && response.statusCode !== 204)) {
util.error(err);
}
});
};
In the file that is calling the above route/getuser.js:
exports.getUser = function (req, res) {
async.auto({
get_user: function (cb) {
/** Read user data from DB **/
cb();
},
record_statistic: ['get_user', function (cb) {
statistic.tracker({ /** Pass static string data **/});
cb();
}]
}, function (err) {
if (err) {
res.json(err);
} else {
res.json();
}
});
};
The reason I am mentioning the above codes is because when I remarked out statistic.tracker({ /** Pass static string data **/}); The function will response within 50ms, but if I include it most of the time it will respond between 100ms - 500ms. I have even put a timestamp check for the "needle" HTTP post, and it respond within 10 - 20ms.
When I copy a file (cp -p x.txt y.txt) especially when it is a > 100MB file, it will also slow down my node js. But even when I am not doing anything on the server besides nginx and node js listening for request the codes below will respond slowly. (If I didn't remark out the code)
I am suspecting IO but where else to check? or what to look out for?
Below are some info about the server:
[ec2-user#tlp-backend logs]$ uname -a
Linux tlp-backend 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST 2011 x86_64 x86_64 x86_64 GNU/Linux
[ec2-user#tlp-backend logs]$ cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
[ec2-user#tlp-backend logs]$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 30502
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[ec2-user#tlp-backend logs]$ more /proc/meminfo
MemTotal: 3918960 kB
MemFree: 392260 kB
Buffers: 296116 kB
Cached: 1205652 kB
SwapCached: 364 kB
Active: 1725084 kB
Inactive: 1155564 kB
Active(anon): 949492 kB
Inactive(anon): 430528 kB
Active(file): 775592 kB
Inactive(file): 725036 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 4095992 kB
SwapFree: 4092872 kB
Dirty: 28 kB
Writeback: 0 kB
AnonPages: 1378528 kB
Mapped: 29860 kB
Shmem: 1140 kB
Slab: 588628 kB
SReclaimable: 461108 kB
SUnreclaim: 127520 kB
KernelStack: 2296 kB
PageTables: 16940 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 6055472 kB
Committed_AS: 1829320 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 288456 kB
VmallocChunk: 34359446140 kB
HardwareCorrupted: 0 kB
AnonHugePages: 507904 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 10240 kB
DirectMap2M: 4184064 kB
[ec2-user#tlp-backend logs]$ more /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU E5645 # 2.40GHz
stepping : 2
cpu MHz : 2400.000
cache size : 12288 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat
pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch
_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf unfair_
spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lah
f_lm ida arat
bogomips : 4800.00
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU E5645 # 2.40GHz
stepping : 2
cpu MHz : 2400.000
cache size : 12288 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat
pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch
_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf unfair_
spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lah
f_lm ida arat
bogomips : 4800.00
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU E5645 # 2.40GHz
stepping : 2
cpu MHz : 2400.000
cache size : 12288 KB
physical id : 1
siblings : 2
core id : 0
cpu cores : 2
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat
pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch
_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf unfair_
spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lah
f_lm ida arat
bogomips : 4800.00
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU E5645 # 2.40GHz
stepping : 2
cpu MHz : 2400.000
cache size : 12288 KB
physical id : 1
siblings : 2
core id : 1
cpu cores : 2
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat
pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch
_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf unfair_
spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lah
f_lm ida arat
bogomips : 4800.00
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
top - 18:02:58 up 26 days, 18:49, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 176 total, 1 running, 175 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.1%sy, 0.0%ni, 99.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3918960k total, 3522368k used, 396592k free, 295340k buffers
Swap: 4095992k total, 3120k used, 4092872k free, 1201660k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 19340 1248 1040 S 0.0 0.0 0:03.45 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:02.55 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:01.57 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
6 root RT 0 0 0 0 S 0.0 0.0 0:18.87 migration/1
7 root 20 0 0 0 0 S 0.0 0.0 0:01.34 ksoftirqd/1
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
9 root RT 0 0 0 0 S 0.0 0.0 0:01.90 migration/2
10 root 20 0 0 0 0 S 0.0 0.0 0:01.30 ksoftirqd/2
11 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/2
Apparently, the main problem is coming from the code itself. When you are mixing async.auto with needle package, you need to explicitly stating { connection: 'keep-alive' } in HTTP header
See more info here: https://github.com/tomas/needle/issues/148

Cannot talk to atmega328p over AVRisp mkII

I have similar issue as here(AVRISPmkII connection status: Unknown status 0x00) but different setup and changing bitcklock didn't help.
The current setup is atmega328p with external oscillator 16MHz connected to ISP interface of avrisp mkII programmer but whatever I do It keeps on showing the same output all the time:
mike#asus:~/wireless-temp-sens/tests$ sudo avrdude -p atmega328p -P usb -c avrispv2 -U lfuse:w:0xff:m -U hfuse:w:0xd9:m -U efuse:w:0xfe:m -v
avrdude: Version 6.0.1, compiled on Oct 21 2013 at 17:07:18
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/etc/avrdude.conf"
User configuration file is "/home/mike/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : avrispv2
avrdude: usbdev_open(): Found AVRISP mkII, serno: 000200209719
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel AVR ISP V2
Programmer Model: AVRISP mkII
Hardware Version: 1
Firmware Version Master : 1.23
Vtarget : 4.9 V
SCK period : 2053.39 us
avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
Any help is appreciated!
Problem resolved! Don't remember what was the reason exactly. I guess clock crystal didn't have proper connections on a breadboard. So, I would say:
Check your wiring
Check your wiring
Check your wiring

Kernel Panic after SMP Implementation - Attempted to kill init

I am working on implementing SMP support in Linux kernel for Marvell PXA2128 ARM SoC. I am using Linus Torvald kernel as base kernel. Kernel version is 3.5. I have added SMP support in Linux kernel, I am able to boot with the second core but sometimes my kernel crashes with "Attempted to kill Init" message, that is, init process of initramfs dies somehow, don't know why. I thought L1 cache of second core is corrupted, so I invalidated the L1 cache of second core before it enters the Linux kernel execution. Crash log of kernel is like
[ 16.413024] Freeing init memory: 268K
[ 16.658111] tmpfs: No value for mount option 'strictatime'
[ 16.809997] scsi 0:0:0:0: Direct-Access SanDisk Cruzer Blade 1.27 PQ: 0 ANSI: 6
[ 16.827545] tmpfs: No value for mount option 'strictatime'
[ 16.972473] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 16.972930] sd 0:0:0:0: [sda] 15330304 512-byte logical blocks: (7.84 GB/7.30 GiB)
[ 16.974487] sd 0:0:0:0: [sda] Write Protect is off
[ 16.976104] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 17.369537] sda: sda1 sda2
[ 17.377258] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 17.602966] tmpfs: No value for mount option 'strictatime'
[ 18.074981] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[ 18.074981]
[ 18.222442] [<c001691c>] (unwind_backtrace+0x0/0x128) from [<c046beb0>] (dump_stack+0x20/0x24)
[ 18.301177] [<c046beb0>] (dump_stack+0x20/0x24) from [<c046bfcc>] (panic+0x94/0x1d4)
[ 18.378265] [<c046bfcc>] (panic+0x94/0x1d4) from [<c002ad08>] (do_exit+0x390/0x7ac)
[ 18.454956] [<c002ad08>] (do_exit+0x390/0x7ac) from [<c002b37c>] (do_group_exit+0x0/0xc4)
[ 18.533111] CPU0: stopping
[ 18.605621] [<c001691c>] (unwind_backtrace+0x0/0x128) from [<c046beb0>] (dump_stack+0x20/0x24)
[ 18.687225] [<c046beb0>] (dump_stack+0x20/0x24) from [<c00145ac>] (handle_IPI+0x104/0x174)
[ 18.770141] [<c00145ac>] (handle_IPI+0x104/0x174) from [<c0008590>] (gic_handle_irq+0x60/0x68)
[ 18.854888] [<c0008590>] (gic_handle_irq+0x60/0x68) from [<c000e6c0>] (__irq_svc+0x40/0x70)
[ 18.940093] Exception stack(0xc0685f38 to 0xc0685f80)
[ 19.022155] 5f20: c06c4c28 a0000093
[ 19.108398] 5f40: 00000001 60400100 c0684000 c06c48c8 c047560c c0691438 c177a080 562f5842
[ 19.188018] SMP: failed to stop secondary CPUs
[ 19.275970] 5f60: 00000000 c0685f9c c0685f40 c0685f80 c0020668 c0010068 60000013 ffffffff
[ 19.363708] [<c000e6c0>] (__irq_svc+0x40/0x70) from [<c0010068>] (cpu_idle+0x94/0xdc)
[ 19.450805] [<c0010068>] (cpu_idle+0x94/0xdc) from [<c0462d24>] (rest_init+0x7c/0x94)
[ 19.537292] [<c0462d24>] (rest_init+0x7c/0x94) from [<c063f89c>] (start_kernel+0x328/0x380)
Now when my kernel boots successfully, the output of cat /proc/interrupts is like
bash-4.2# cat /proc/interrupts
CPU0 CPU1
39: 101 0 GIC pxa_i2c-i2c
45: 0 26692 GIC timer0
46: 26578 0 GIC timer1
52: 27 0 GIC olpc-ec-1.75
58: 0 0 GIC mmp-vmeta
60: 1142 0 GIC UART3
71: 0 0 GIC mmc2
72: 0 0 GIC olpc-kbd
73: 25978 0 GIC pxa168fb-dss
76: 2282 0 GIC ehci_hcd:usb1
84: 246 0 GIC mmc0
85: 9820 0 GIC mmc1
132: 0 0 ICU rtc Alrm
133: 0 0 ICU rtc 1Hz
137: 0 0 ICU galcore interrupt service
139: 88 0 ICU galcore interrupt service for 2D
141: 20 0 ICU pxa_i2c-i2c
143: 0 0 ICU pxa_i2c-i2c
145: 328 0 ICU pxa_i2c-i2c
186: 52 0 ICU mmc3
252: 0 0 GPIO hsdet-gpio
253: 0 0 GPIO hdmi-hpd
270: 0 0 GPIO d4280000.sdhci cd
278: 0 0 GPIO sdhci_wakeup_irq, sdhci_wakeup_irq, sdhci_wakeup_irq, sdhci_wakeup_irq
335: 0 0 GPIO micdet-gpio
365: 0 0 GPIO DCON
368: 0 0 GPIO olpc-switch-1.75-lid
369: 0 0 GPIO olpc-switch-1.75-ebook
393: 0 0 GPIO olpc-ec-1.75-wake
IPI0: 0 0 Timer broadcast interrupts
IPI1: 3508 4069 Rescheduling interrupts
IPI2: 0 0 Function call interrupts
IPI3: 7 429 Single function call interrupts
IPI4: 0 0 CPU stop interrupts
Err: 0
bash-4.2#
Please give me a clue what important I am missing in SMP implementation.

Valgrind support for TMS320DM365

We have developed an application using ipnc_rdk version 5.0 for TMS320DM365 .
We have memory leak in the application.
We cross compiled valgrind for arm using arm- arago.
But when we run valgrind on the device, it shows illegal instruction error.
We saw couple of posts telling that valgrind doesn't support armv5.
We got valgrind patches for armv5 at below link, but they fail to apply in the valgrind source.
https://bugs.kde.org/show_bug.cgi?id=248998
We tried applying patches for valgrind 3.9.0 3.8.1 & 3.2.1 versions
Is there a valgrind version for armv5 ?
If not how can we debug memory leak error in our application.
Also i ran top utility to check memory usage and there was increase in memory. Also kerenel calls oom killer. Please find the attached log which gives the top utility output and also the out of memory log
Top utility output just before oom killer was called:
shrd, 8K buff, 8352K cached
CPU: 86% usr 13% sys 0% nic 0% idle 0% io 0% irq 0% sirq
Load average: 2.86 1.31 0.51 4/54 690
PID PPID USER STAT VSZ %MEM %CPU COMMAND
663 655 root R 59184 132% 97% /opt/ipnc/stillImage.out
668 655 root R 3080 7% 3% top
1 0 root S 1624 4% 0% init [5]
269 2 root SW 0 0% 0% [kswapd0]
627 1 root S 6152 14% 0% ./boa -c /etc
655 1 root S 3080 7% 0% -sh
529 1 root S 2976 7% 0% /usr/sbin/inetd
651 1 root S 2964 7% 0% /sbin/syslogd -n -C64 -m 20
653 1 root S 2900 6% 0% /sbin/klogd -n
646 1 root S 2900 6% 0% /usr/sbin/telnetd
634 1 root S 2704 6% 0% avahi-daemon: running [10.local]
637 1 root S 1940 4% 0% /usr/sbin/avahi-dnsconfd -D
630 1 root S 1764 4% 0% avahi-autoipd: [eth0] bound 169.254.11
631 630 root S 1764 4% 0% avahi-autoipd: [eth0] callout dispatch
622 2 root SW 0 0% 0% [flush-1:0]
620 2 root SW 0 0% 0% [flush-ubifs_0_0]
5 2 root SW 0 0% 0% [kworker/u:0]
4 2 root SW 0 0% 0% [kworker/0:0]
3 2 root SW 0 0% 0% [ksoftirqd/0]
2 0 root SW 0 0% 0% [kthreadd]
stillImage.out invoked oom-killer: gfp_mask=0x200da, order=0, oom_adj=0, oom_score_adj=0
[ 96.003955] Backtrace:
[ 96.006595] Function entered at [<c0030504>] from [<c03330c8>]
[ 96.012605] r7:00000042 r6:00000000 r5:000200da r4:c1f06000
[ 96.018703] Function entered at [<c03330b0>] from [<c007cad0>]
[ 96.024712] Function entered at [<c007ca58>] from [<c007cf50>]
[ 96.030710] Function entered at [<c007cf00>] from [<c007d478>]
[ 96.036727] Function entered at [<c007d1b4>] from [<c00809bc>]
[ 96.042602] Function entered at [<c008056c>] from [<c007a5d0>]
[ 96.048656] Function entered at [<c007a574>] from [<c0132024>]
[ 96.054670] Function entered at [<c0131fb8>] from [<c00794bc>]
[ 96.060669] Function entered at [<c00793cc>] from [<c007b6c8>]
[ 96.066683] Function entered at [<c007b220>] from [<c007b78c>]
[ 96.072694] Function entered at [<c007b718>] from [<c01317a8>]
[ 96.078718] Function entered at [<c0131620>] from [<c00a2b34>]
[ 96.084813] Function entered at [<c00a2a90>] from [<c00a35e8>]
[ 96.090777] r8:400b4000 r7:c1f07f70 r6:400b4000 r5:00001000 r4:c1d85680
[ 96.098026] Function entered at [<c00a3534>] from [<c00a3738>]
[ 96.103955] r8:400b4000 r7:00001000 r6:c1d85680 r5:00000000 r4:0004e000
[ 96.111222] Function entered at [<c00a36f4>] from [<c002d020>]
[ 96.117225] r8:c002d1a4 r7:00000004 r6:00351d08 r5:400b4000 r4:00001000
[ 96.124460] Mem-info:
[ 96.126777] DMA per-cpu:
[ 96.129412] CPU 0: hi: 6, btch: 1 usd: 4
[ 96.134472] active_anon:2952 inactive_anon:179 isolated_anon:0
[ 96.134504] active_file:95 inactive_file:192 isolated_file:0
[ 96.134531] unevictable:0 dirty:191 writeback:0 unstable:0
[ 96.134557] free:220 slab_reclaimable:86 slab_unreclaimable:437
[ 96.134584] mapped:154 shmem:1911 pagetables:71 bounce:0
[ 96.163348] DMA free:880kB min:880kB low:1100kB high:1320kB active_anon:11808kBinactive_anon:716kB active_file:380kB inactive_file:768kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:48768kB mlocked:0kB dirty:764kB writeback:0kB mapped:616kB shmem:7644kB slab_reclaimable:344kB slab_unreclaimable:1748kB kernel_stack:432kB pagetables:284kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:1760 all_unreclaimable? yes
[ 96.202321] lowmem_reserve[]: 0 0 0
[ 96.206059] DMA: 6*4kB 7*8kB 8*16kB 1*32kB 4*64kB 3*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 880kB
[ 96.216739] 2198 total pagecache pages
[ 96.224107] 12288 pages of RAM
[ 96.227313] 317 free pages
[ 96.230128] 1096 reserved pages
[ 96.233410] 389 slab pages
[ 96.236289] 187 pages shared
[ 96.239319] 0 pages swap cached
[ 96.242494] [ pid ] uid tgid total_vm rss cpu oom_adj oom_score_adj name
[ 96.250121] [ 529] 0 529 744 20 0 0 0 inetd
[ 96.257877] [ 627] 0 627 1538 22 0 0 0 boa
[ 96.265408] [ 630] 0 630 441 20 0 0 0 avahi-autoipd
[ 96.273789] [ 631] 0 631 441 15 0 0 0 avahi-autoipd
[ 96.282186] [ 634] 0 634 676 54 0 0 0 avahi-daemon
[ 96.290549] [ 637] 0 637 485 22 0 0 0 avahi-dnsconfd
[ 96.299030] [ 646] 0 646 725 15 0 0 0 telnetd
[ 96.306996] [ 651] 0 651 741 34 0 0 0 syslogd
[ 96.314876] [ 653] 0 653 725 22 0 0 0 klogd
[ 96.322563] [ 655] 0 655 770 29 0 0 0 sh
[ 96.330018] [ 663] 0 663 14796 1080 0 0 0 stillImage.out
[ 96.338552] [ 668] 0 668 770 54 0 0 0 top
[ 96.346062] Out of memory: Kill process 663 (stillImage.out) score 66 or sacrifice child
[ 96.354411] Killed process 663 (stillImage.out) total-vm:59184kB, anon-rss:3824kB, file-rss:496kB
Thanks and Regards,
Arpitha

Resources