Sam,
To disable swapping I am sure you know how to with the swapoff
command. I would remove the swap file image that the default
Raspberry PI OS images have (on SD card). I would hope with the
swap file image removed any subsequent boot of the PI OS will
not create a swap file image to restore the one removed from
the SD image.
I highly suspect your CLI based PI OS is not using the
swap file, but you know how to check this with swapon command.
It has been some years since my extensive assembler coding at
the OS and compiler levels. I would think masking other
interrupts would not be a good idea. If other interrupts can
be confirmed as the source of your latency issues then the
question is are those other interrupts excessive and/or have
means to be reduced via what is running on your Pi OS? Masking
other interrupts I suspect could cause other issues in greater
scope compared to the code your current assessment to be missing
interrupts.
I assume with the logic analyzer you see the SPI device raise
the line for the PI pin you have assigned to sense the SPI
device interrupt? If so and your assessment of sometimes the
interrupt is missed I would suggest either the bcm2835 library
and/or the Linux Kernel are at issue. I currently do not have
a PI OS up and running due to a UPS Hat causing file system
corruption while I was working towards creating my custom for
my needs Pi OS image. This is why I am asking what Kernel
version is the PI OS using or did you build your own kernel?
If my question about what Kernel version you are using happens
to cause you to decide to build a Kernel I would suggest doing
so if you can via cross compile on something other than the Pi
simply to avoid the extensive SD card wear it would cause.
Do you have a Pi other than Pi 4 to try to see if you have the
same, different, or no issues? Point is to find out if for
some reason the issue you are experiencing is Pi 4 specific.
I do not know if there is a real time version of the Linux
Kernel available for Pi OS. If so that may worth a try to see
what, if any, differences occur for the application and/or
logic analyzer findings you have thus far.
I know you have your reasons for using a Pi for what you are
working towards. If it is not too difficult in terms of code
adjustments for the purpose of testing maybe it might be an
idea from testing point of view to try the application on a
micro controller. Latency for interrupts in micro controller
is far far less than would be under an OS. The idea of this
test is to determine if there might be a Pi OS factor and/or
device SPI issue.
John L. Males
Toronto, Ontario
Canada
04 October 2020 17:04 -0400 EDT
================================================================
2020-10-04 16:31:19+0000-UTC Time: 1601829079 PC/System time
4 Oct 16:31:19 ntpdate[37564]: ntpdate 4.2.8p12-a (1)
4 Oct 16:31:34 ntpdate[39347]: step time server 132.246.11.227
offset -0.000107 sec
FreeBSD 11.3-RELEASE-p13 FreeBSD 11.3-RELEASE-p13 #0: Tue Sep
1 06:56:51 UTC 2020
ro...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC
(Work in progress alternative to Linux Kernel of its own right,
Debian, and
other Linux based Kernel distributions determined.)
Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz (1396.86-MHz K8-class
CPU) Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz (1396.86-MHz
K8-class CPU) Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
(1396.86-MHz K8-class CPU) Intel(R) Core(TM) i3-2367M CPU @
1.40GHz (1396.86-MHz K8-class CPU) Intel(R) Core(TM) i3-2367M
CPU @ 1.40GHz (1396.86-MHz K8-class CPU)
dev.cpu.0.temperature: 74.0C
dev.cpu.1.temperature: 74.0C
dev.cpu.2.temperature: 74.0C
dev.cpu.3.temperature: 74.0C
hw.acpi.thermal.tz0.temperature: 73.1C
vmstat -s:
3714777493 cpu context switches
81748017 device interrupts
13214685 software interrupts
1118894072 traps
1215719883 system calls
27 kernel threads created
2954554 fork() calls
69460 vfork() calls
8 rfork() calls
28927 swap pager pageins
138347 swap pager pages paged in
36155 swap pager pageouts
347633 swap pager pages paged out
33656 vnode pager pageins
324684 vnode pager pages paged in
16520 vnode pager pageouts
310049 vnode pager pages paged out
1125 page daemon wakeups
569612219 pages examined by the page daemon
0 clean page reclamation shortfalls
27610974 pages reactivated by the page daemon
119168717 copy-on-write faults
518233 copy-on-write optimized faults
788499346 zero fill pages zeroed
66656 zero fill pages prezeroed
487395 intransit blocking page faults
1168466348 total VM faults taken
60535 page faults requiring I/O
0 pages affected by kernel thread creation
104990967 pages affected by fork()
2429249 pages affected by vfork()
348 pages affected by rfork()
1107693096 pages freed
65053662 pages freed by daemon
367730754 pages freed by exiting processes
951976 pages active
1689666 pages inactive
699143 pages in the laundry queue
674952 pages wired down
37029 pages free
4096 bytes per page
196029434 total name lookups
cache hits (87% pos + 3% neg) system 0% per-directory
deletions 0%, falsehits 0%, toolong 0%
Boot time : 1601389878
procs memory page disks
faults cpu0 cpu1 cpu2 cpu3 r b w avm
fre flt re pi po fr sr ad0 pa0 in sy cs us sy
id us sy id us sy id us sy id 1 0 0 63595180 148056 2660 63
0 0 2522 1297 0 0 186 2768 8458 20 6 74 21 5 74 21
5 74 21 5 74
memory info:
real memory =
17179869184 (16384 MB)
avail memory = 16495013888 (15730 MB)
last pid: 47758; load averages: 0.83, 0.90, 1.10 up
5+02:00:17 16:31:35 67 processes: 1 running, 66 sleeping
Mem: 3719M Active, 6600M Inact, 2731M Laundry, 2637M Wired,
1554M Buf, 144M Free Swap: 48G Total, 868M Used, 47G Free, 1%
Inuse
hw.physmem:
17053859840
hw.usermem:
14289092608
buffers cached Mem: 16210872 9304184
6906688 0 0 0 Swap: 50331644
888328 49443316
swapinfo:
Device 1K-blocks Used Avail Capacity
/dev/ada0s1b 50331644 888328 49443316 2%
vmstat:
procs memory page disks
faults cpu r b w avm fre flt re pi po
fr sr ad0 pa0 in sy cs us sy id 0 0 0 63595116
148072 2660 63 0 0 2522 1297 0 0 186 2768 8458 21
5 74
Message replied to:
Date: Sun, 4 Oct 2020 10:48:10 -0500
[snip]
[snip]
> >
https://groups.google.com/d/msgid/bcm2835/20201001191104.467e07ee87f8d193770e81be%40gmail.com
> > .
> >
>
> --
> You received this message because you are subscribed to the
> Google Groups "bcm2835" group. To unsubscribe from this group
> and stop receiving emails from it, send an email to
>
bcm2835+u...@googlegroups.com. To view this discussion
> on the web visit
>
https://groups.google.com/d/msgid/bcm2835/CAK_H8tU4icck2YWAsOzFoTyeibqs2BvHLnkmaye8hnt-2Q5rtA%40mail.gmail.com.