Skip to content

Instantly share code, notes, and snippets.

@lucmann
lucmann / linux-trees.txt
Last active August 1, 2024 00:05
linux trees
$ git remote -v
amd [email protected]:agd5f/linux.git (fetch)
amd [email protected]:agd5f/linux.git (push)
drm git://anongit.freedesktop.org/drm/drm (fetch)
drm git://anongit.freedesktop.org/drm/drm (push)
drm-misc git://anongit.freedesktop.org/drm/drm-misc (fetch)
drm-misc git://anongit.freedesktop.org/drm/drm-misc (push)
mlankhorst git://people.freedesktop.org/~mlankhorst/linux (fetch)
mlankhorst git://people.freedesktop.org/~mlankhorst/linux (push)
riscv git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git (fetch)
@lucmann
lucmann / cpuhp.sh
Last active September 26, 2024 07:25
CPU core hot plug
#!/usr/bin/env bash
set -x
for c in `ls /sys/bus/cpu/devices/cpu[^0]*/online`; do
echo $1 > $c # 2> /dev/null # delete the first comment sign # in this line if you care about what's wrong.
done
$ ulimit -a
-t: cpu time (seconds) unlimited
-f: file size (blocks) unlimited
-d: data seg size (kbytes) unlimited
-s: stack size (kbytes) 8192
-c: core file size (blocks) 0
-m: resident set size (kbytes) unlimited
-u: processes 31178
-n: file descriptors 1024
-l: locked-in-memory size (kbytes) 65536
@lucmann
lucmann / arm-as.md
Last active August 15, 2024 06:08
arm assembly
  • adrp 页 基地址 指令(address of page), 用于计算基于当前 PC 的页基地址
    adrp x0, #_g@PAGE    # 将变量 _g 所在的 4KB 大小页的 基地址,读入 x0 寄存器 
    
  • ccmp 条件比较 (conditional compare), 前面一般都有一条 cmp 指令
    mov w0, #10
    mov w1, #3
     
    

cmp w0, #10 # 比较 w0 和 10

@lucmann
lucmann / riscv-as.md
Last active July 17, 2024 04:29
riscv assembly
  • beqz s0, 1f Expands to beq s0, x0, 1f jump to label 1f if s0 == x0. Note that label 1f means to go to numeric label 1 FORWARD of the given position whose opposite is label 1b meaning to go to numeric label 1 BACKWARD of the given position.
  • csrrw t3, CSR_SSCRATCH, a0 Write the value in the csr register CSR_SSCRATCH to t3 register and write the value in a0 back to CSR_SSCRATCH
  • jal purgatory Expands to jal x1, purgatory and unconditionally jump to function purgatory() and write PC+4 into x1 (return address) register
  • jal t0, .Lbyte_copy_until_aligned_forward Write PC+4 into register t0 and unconditionally jump to label .Lbyte_copy_until_aligned_forward.
  • jalr s0 Expands to jalr x1, s0, 0 meaning the target address to jump to is s0 + 0 and write PC+4 into x1 (return address) register
@lucmann
lucmann / abbr.csv
Last active July 17, 2024 03:34
abbreviation
AFAICT As far as I can tell 个人认为
AFAIK As far as I know 据我了解
AFAIU As far as I understand 按我理解
BTW By the way 顺便
FWIW For what it's worth 陈述见解或建议的谦逊说法,比如我觉得这是有用的信息,但是从听者的角度未必也是
FYI For your information 供您参考
HTH Hope this helps 希望奏效
IDK I don't know 我不知道
IIRC If I recall correctly / If I remember correctly 如果我没有记错
IMHO In my humble opinion 在下愚见
@lucmann
lucmann / create-file.sh
Created July 30, 2024 07:38
create a file
dd if=/dev/zero of=/tmp/sock-ghost bs=1K seek=1 count=0
dd if=/dev/zero of=/tmp/sock-solid bs=1K count=1
@lucmann
lucmann / dri3.c
Last active August 1, 2024 06:34
libxcb building
/*
* This file generated automatically from dri3.xml by c_client.py.
* Edit at your peril.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
@lucmann
lucmann / drm_info.txt
Created August 5, 2024 08:08
drm_info output on WSL2
Node: /dev/dri/card0
├───Driver: vkms (Virtual Kernel Mode Setting) version 1.0.0 (20180514)
│ ├───DRM_CLIENT_CAP_STEREO_3D supported
│ ├───DRM_CLIENT_CAP_UNIVERSAL_PLANES supported
│ ├───DRM_CLIENT_CAP_ATOMIC supported
│ ├───DRM_CLIENT_CAP_ASPECT_RATIO supported
│ ├───DRM_CLIENT_CAP_WRITEBACK_CONNECTORS supported
│ ├───DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT not supported
│ ├───DRM_CAP_DUMB_BUFFER = 1
│ ├───DRM_CAP_VBLANK_HIGH_CRTC = 1
@lucmann
lucmann / v4l2.md
Last active September 13, 2024 04:30
similarities between media and DRM subsystems
  • Interact Methods (open/close, ioctls, mmap)
  • DMABUF (V4L2 Streaming I/O)
  • Image Formats
    • v4l2_pix_format vs drm_format (V4L2_PIX_FMT_ in videodev2.h vs DRM_FORMAT_ in drm_fourcc.h)
    • FourCC (Four Character Codes)
    • ColorSpaces
    • Depth Format (V4L2_PIX_FMT_Z16 vs DRM 没有 Depth Format)
    • Popular Data Formats
      • RGB565
  • Platform-specific Device Support