Flush: write back the contents of cache to main memory
Invalidate: mark cache lines as invalid so that future reads go to main memory.
Dirty: mark DMA memory region "dirty", so that CPU will invalidate the region
DDR memory -> HW buffer:
1. Flush DDR memory (no flush on HW buffer needed because it's not cacheable)
2. Invalidate DDR memory (so no cache line used during DMA)
https://stackoverflow.com/questions/7132284/dma-cache-coherence-management
Friday, March 29, 2019
Thursday, March 7, 2019
To disable suspend from closing lid
https://help.ubuntu.com/stable/ubuntu-help/power-closelid.html.en
- Open the Activities overview and start typing Tweaks.
- Click Tweaks (GNOME Tweaks) to open the application.
- Click the Power tab.
- Switch Suspend when laptop lid is closed to OFF.
- Close the Tweaks window.
Friday, March 1, 2019
store / remove ssh key (git passphrase)
********************
*
********************
$ eval $(ssh-agent)
## The output without the eval will look like this:
$ ssh-agent
ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-hvcwJQnSOHOi/agent.125894; export SSH_AUTH_SOCK;
SSH_AGENT_PID=125895; export SSH_AGENT_PID;
echo Agent pid 125895;
After the ssh-agent is started (with the eval). You can add SSH keys with ssh-add
$ ssh-add ~/.ssh/google
$ ssh-add ~/.ssh/id_rsa
With current versions of SSH you can also add the option AddKeysToAgent to the ~/.ssh/config file:
## ~/.ssh/config
AddKeysToAgent yes
********************
* Remove known host
********************
ssh-keygen -R 192.168.123.254
********************
*
********************
~/.bashrc
SSH_ENV=$HOME/.ssh/environment
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
echo succeeded
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null
/usr/bin/ssh-add
}
if [ -f "${SSH_ENV}" ]; then
. ${SSH_ENV} > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
********************
* MacBook
********************
As of macOS Sierra 10.12.2 Apple added an ssh_config option called UseKeychain which allows a 'proper' resolution to the problem. Add the following to your ~/.ssh/config file:
Wednesday, February 27, 2019
execute a script on a remote machine over ssh using expect
https://linux.die.net/man/1/expect
https://www.blogger.com/blogger.g?blogID=7297027245100107097#allposts/postNum=0
* clock
https://www.tcl.tk/man/tcl8.5/tutorial/Tcl41.html
on Macbook
brew install expect
on Ubuntu
sudo apt install expect
expect.sh
------------------------------
#!/bin/bash
nodeIp=192.168.1.176
(expect -c '
#exp_internal 1
#set timeout 15
spawn ssh root@'$nodeIp'
#expect {
# ")? " { send "yes\r" ; exp_continue }
# "# " { send "\r" }
# }
expect "# "
send "rm /var/log/messages*\r"
expect "# "
send "reboot\r"
expect "# "
#send "exit\r"
expect eof ')
------------------------------
#!/bin/bash
#foreach {host user password target} $argv {break}
#set command "ping -c 1 $target"
#send "$command\r"
#log_user 0 ;# turn off the usual output
#expect -re "(yes/no)"
#send "yes\r"
#sleep 1
nodeIp=192.168.1.176
(
expect -c '
#exp_internal 1
#set timeout 20
set command "i2cget -y 1 0x1c 0x14"
spawn ssh root@'$nodeIp'
#expect {
# ")? " { send "yes\r" ; exp_continue }
# "# " { send "\r" }
# }
expect "~# "
send_user "running $command\r\n"
send "$command\r"
expect "0x04"
send "\r"
# puts "$expect_out(0,string)\n"
if {$expect_out(0,string) == "0x04"} {
puts "output of i2cget -y 1 0x1c 0x14 is 0x04\n"
} else {
puts "False\n"
}
# puts "$expect_out(buffer)"
send "\r"
expect "~# "
send "exit\r"
expect eof '
)
Monday, February 4, 2019
taskset example
-p [process id]
./taskset -p 1760
pid 1760's current affinity mask: f
/taskset -cp 1760
pid 1760's current affinity list: 0-3
taskset -p 0x4 1760
assign it to core0 and core3
taskset -cp 0,3 9726
Wednesday, November 7, 2018
Monday, November 5, 2018
Subscribe to:
Posts (Atom)
