Quantcast
Channel: Active questions tagged linux-kernel - Stack Overflow
Viewing all 12299 articles
Browse latest View live

Describing a custom device on LPC to the Linux kernel

$
0
0

I have a custom multi-function device hanging off an LPC bus. Works fine with hardcoded addresses in a force-loaded kernel module, but longer-term I'd like to move towards per-function modules (there are about ten miscellaneous functions in there).

The recommended way seems to be to create a module that checks if the hardware is there and has the right version, then creates device tree entries for the functions, causing hot-plug events for the subunits.

  1. Does this work on x86_64?
  2. Does that give me any advantage over a single force-loaded module, given that I still need to load the detection module?
  3. Does it make sense to instead create an ACPI table describing the device, and pass that to the kernel from the BIOS?

Linux writing GPU drivers to print arbitrary outputs from kernel side

$
0
0

I have questions about GPU drivers for linux kernel.

1-) Is it possible to write a custom kernel module to print words or colors on screen like VGA using a GPU over PCI express ?

2-) If it is, is it generic or device/chip dependent?

3-) If it is, is it possible with writing MMIO space?

What is on my mind is, I want to write a simple kernel module to print some arbitrary values over PCI express bus. My GPU is only have mDP and DVI-D outputs and it has a big kernel driver in linux kernel.

Striped down kernel take long time to load on Raspberry Pi 4

$
0
0

I'm just trying to customize the kernel configuration for Raspberry Pi 4B, to achieve a compact system image and quick startup, but as we can see in the logs there's approximate ~4.0s to start executing my 4.2MB kernel.

  • Logs:
23:20:06.198 -> 
23:20:06.198 -> PM_RSTS: 0x00001000
23:20:06.198 -> RPi: BOOTLOADER release VERSION:f626c772 Sep 10 2019 10:41:52 BOOTMODE: 0x00000006 part: 0 BUILD_TIMESTAMP=1568112110
23:20:06.231 -> uSD voltage 3.3V
23:20:06.430 -> SD HOST: 200000000 CTL0: 0x00000000 BUS: 100000 Hz div: 2000 status: 0x1fff0000 delay-ticks: 1080
23:20:06.463 -> SD HOST: 200000000 CTL0: 0x00000f00 BUS: 100000 Hz div: 2000 status: 0x1fff0000 delay-ticks: 1080
23:20:06.463 -> CID: 00035344534331364780411a41a20123
23:20:06.463 -> CSD: 400e00325b59000076b27f800a404000
23:20:06.496 -> CSD: VER: 1 logical blocks: 30386 mult: 1024 rd(len: 512 partial: 0 misalign: 0) sectors: 31116288
23:20:06.496 -> SD: bus-width: 4 spec: 2 SCR: 0x02358443 0x00000000
23:20:06.496 -> SWITCH_FUNC: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000038001c00180018001800180c800
23:20:06.529 -> SD HOST: 200000000 CTL0: 0x00000f04 BUS: 40000000 Hz div: 6 status: 0x1fff0000 delay-ticks: 2
23:20:06.529 -> MBR: 0x00000001,   32768 type: 0x0c
23:20:06.529 -> MBR: 0x00008001,   20376 type: 0x83
23:20:06.529 -> MBR: 0x0000cf99,  131072 type: 0x83
23:20:06.529 -> MBR: 0x00000000,       0 type: 0x00
23:20:06.529 -> part-offset: 1 oem:  mkfs.fat volume:   V       ^ 
23:20:06.529 -> rsc: 4 sectors-per-fat: 32 clusters: 8167 cluster-size: 4 root-dir: 1 root-sectors: 32
23:20:06.562 -> WEL: 0x00000045 0x00008000
23:20:06.562 -> PM_RSTS: 0x00001000
23:20:06.562 -> Partition: 0
23:20:06.562 -> part-offset: 1 oem:  mkfs.fat volume:   V       ^ 
23:20:06.562 -> rsc: 4 sectors-per-fat: 32 clusters: 8167 cluster-size: 4 root-dir: 1 root-sectors: 32
23:20:06.562 -> Loading config.txt hnd: 0x00000017
23:20:06.562 -> Initialising SDRAM 'Samsung' 8Gb x1 total-size: 8 Gbit 3200
23:20:07.258 -> Loading recovery.elf hnd: 0x00000000
23:20:07.258 -> Failed to read recovery.elf error: 6
23:20:07.291 -> Loading start4.elf hnd: 0x0000001b
23:20:07.655 -> Loading fixup4.dat hnd: 0x00000018
23:20:07.655 -> MEM GPU: 96 ARM: 928 TOTAL: 1024
23:20:07.655 -> FIXUP src: 128 256 dst: 928 1024
23:20:07.821 -> Starting start4.elf @ 0xfec00200
23:20:07.821 -> 
23:20:11.859 -> Booting Linux on physical CPU 0x0
23:20:11.859 -> Linux version 4.19.66-v7l (iman@MSI-7758) (gcc version 8.3.0 (Buildroot 2019.11.1-dirty)) #12 SMP PREEMPT Tue Feb 18 23:17:21 +0330 2020
23:20:11.859 -> CPU: ARMv7 Processor [410fd083] revision 3 (ARMv7), cr=50c5383d
23:20:11.859 -> CPU: div instructions available: patching division code
23:20:11.859 -> CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
23:20:11.893 -> OF: fdt: Machine model: Raspberry Pi 4 Model B Rev 1.1
23:20:11.893 -> Memory policy: Data cache writealloc
23:20:11.893 -> Ignoring RAM at 0x30000000-0x3a000000
23:20:11.893 -> Consider using a HIGHMEM enabled kernel.
23:20:11.893 -> cma: Reserved 64 MiB at 0x2ac00000
23:20:11.893 -> random: get_random_bytes called from start_kernel+0x63/0x2e4 with crng_init=0
23:20:11.893 -> percpu: Embedded 16 pages/cpu s34828 r8192 d22516 u65536
23:20:11.893 -> Built 1 zonelists, mobility grouping on.  Total pages: 194880
23:20:11.926 -> Kernel command line: coherent_pool=1M 8250.nr_uarts=1 cma=64M bcm2708_fb.fbwidth=0 bcm2708_fb.fbheight=0 bcm2708_fb.fbswap=1 smsc95xx.macaddr=DC:A6:32:4C:50:2A vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200
23:20:11.926 -> Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
23:20:12.010 -> Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
23:20:12.010 -> Memory: 704556K/786432K available (4096K kernel code, 404K rwdata, 1748K rodata, 1024K init, 509K bss, 16340K reserved, 65536K cma-reserved)
23:20:12.010 -> Virtual kernel memory layout:
23:20:12.010 ->     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
23:20:12.010 ->     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
23:20:12.010 ->     vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
23:20:12.010 ->     lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
23:20:12.010 ->     modules : 0xbf800000 - 0xc0000000   (   8 MB)
23:20:12.010 ->       .text : 0x(ptrval) - 0x(ptrval)   (5088 kB)
23:20:12.010 ->       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
23:20:12.010 ->       .data : 0x(ptrval) - 0x(ptrval)   ( 405 kB)
23:20:12.010 ->        .bss : 0x(ptrval) - 0x(ptrval)   ( 510 kB)
23:20:12.010 -> ftrace: allocating 21664 entries in 43 pages
23:20:12.010 -> rcu: Preemptible hierarchical RCU implementation.
23:20:12.010 ->     Tasks RCU enabled.
23:20:12.010 -> NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
23:20:12.010 -> GIC: Using split EOI/Deactivate mode
23:20:12.010 -> arch_timer: cp15 timer(s) running at 54.00MHz (phys).
23:20:12.010 -> clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
23:20:12.032 -> sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns
23:20:12.032 -> Switching to timer-based delay loop, resolution 18ns
23:20:12.032 -> Console: colour dummy device 80x30
23:20:12.058 -> console [tty1] enabled
23:20:12.058 -> Calibrating delay loop (skipped), value calculated using timer frequency.. 108.00 BogoMIPS (lpj=540000)
23:20:12.058 -> pid_max: default: 32768 minimum: 301
23:20:12.058 -> Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
23:20:12.058 -> Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
23:20:12.091 -> CPU: Testing write buffer coherency: ok
23:20:12.091 -> CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
23:20:12.091 -> Setting up static identity map for 0x100000 - 0x100038
23:20:12.091 -> rcu: Hierarchical SRCU implementation.
23:20:12.091 -> smp: Bringing up secondary CPUs ...
23:20:12.091 -> CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
23:20:12.091 -> CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
23:20:12.091 -> CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
23:20:12.124 -> smp: Brought up 1 node, 4 CPUs
23:20:12.124 -> SMP: Total of 4 processors activated (432.00 BogoMIPS).
23:20:12.124 -> CPU: All CPU(s) started in HYP mode.
23:20:12.124 -> CPU: Virtualization extensions available.
23:20:12.124 -> devtmpfs: initialized
23:20:12.124 -> VFP support v0.3: implementor 41 architecture 3 part 40 variant 8 rev 0
23:20:12.124 -> clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
23:20:12.158 -> futex hash table entries: 1024 (order: 4, 65536 bytes)
23:20:12.158 -> pinctrl core: initialized pinctrl subsystem
23:20:12.158 -> NET: Registered protocol family 16
23:20:12.158 -> DMA: preallocated 1024 KiB pool for atomic coherent allocations
23:20:12.158 -> hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
23:20:12.158 -> hw-breakpoint: maximum watchpoint size is 8 bytes.
23:20:12.158 -> Serial: AMBA PL011 UART driver
23:20:12.158 -> bcm2835-mbox fe00b880.mailbox: mailbox enabled
23:20:12.190 -> bcm2835-dma fe007000.dma: DMA legacy API manager at (ptrval), dmachans=0x1
23:20:12.190 -> usbcore: registered new interface driver usbfs
23:20:12.190 -> usbcore: registered new interface driver hub
23:20:12.190 -> usbcore: registered new device driver usb
23:20:12.190 -> raspberrypi-firmware soc:firmware: Attached to firmware from 2019-08-15 12:03, variant start
23:20:12.190 -> raspberrypi-firmware soc:firmware: Firmware hash is 9f8431fb7839c7f00f52b81f5822ddab2b31d0db
23:20:12.224 -> clocksource: Switched to clocksource arch_sys_counter
23:20:12.224 -> VFS: Disk quotas dquot_6.6.0
23:20:12.224 -> VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
23:20:12.224 -> FS-Cache: Loaded
23:20:12.224 -> CacheFiles: Loaded
23:20:12.224 -> NET: Registered protocol family 2
23:20:12.224 -> tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)
23:20:12.224 -> TCP established hash table entries: 8192 (order: 3, 32768 bytes)
23:20:12.257 -> TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
23:20:12.257 -> TCP: Hash tables configured (established 8192 bind 8192)
23:20:12.257 -> UDP hash table entries: 512 (order: 2, 16384 bytes)
23:20:12.257 -> UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
23:20:12.257 -> NET: Registered protocol family 1
23:20:12.257 -> Initialise system trusted keyrings
23:20:12.257 -> workingset: timestamp_bits=14 max_order=18 bucket_order=4
23:20:12.290 -> squashfs: version 4.0 (2009/01/31) Phillip Lougher
23:20:12.290 -> Key type asymmetric registered
23:20:12.290 -> Asymmetric key parser 'x509' registered
23:20:12.290 -> Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
23:20:12.290 -> io scheduler noop registered
23:20:12.290 -> io scheduler deadline registered
23:20:12.290 -> io scheduler cfq registered (default)
23:20:12.290 -> io scheduler mq-deadline registered
23:20:12.290 -> io scheduler kyber registered
23:20:12.290 -> bcm2708_fb soc:fb: Unable to determine number of FB's. Assuming 1
23:20:12.323 -> bcm2708_fb soc:fb: FB found 1 display(s)
23:20:12.323 -> raspberrypi-firmware soc:firmware: Request 0x00048003 returned status 0x80000001
23:20:12.323 -> bcm2708_fb soc:fb: Failed to allocate GPU framebuffer (-22)
23:20:12.323 -> bcm2708_fb soc:fb: probe failed, err -22
23:20:12.323 -> bcm2708_fb: probe of soc:fb failed with error -22
23:20:12.323 -> Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
23:20:12.356 -> iproc-rng200 fe104000.rng: hwrng registered
23:20:12.356 -> vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
23:20:12.356 -> vc-sm: Videocore shared memory driver
23:20:12.356 -> gpiomem-bcm2835 fe200000.gpiomem: Initialised: Registers at 0xfe200000
23:20:12.356 -> brd: module loaded
23:20:12.356 -> loop: module loaded
23:20:12.356 -> libphy: Fixed MDIO Bus: probed
23:20:12.356 -> bcmgenet fd580000.genet: failed to get enet clock
23:20:12.356 -> bcmgenet fd580000.genet: GENET 5.0 EPHY: 0x0000
23:20:12.389 -> bcmgenet fd580000.genet: failed to get enet-wol clock
23:20:12.389 -> bcmgenet fd580000.genet: failed to get enet-eee clock
23:20:12.389 -> bcmgenet: Skipping UMAC reset
23:20:12.389 -> unimac-mdio unimac-mdio.-19: DMA mask not set
23:20:12.389 -> libphy: bcmgenet MII bus: probed
23:20:12.389 -> unimac-mdio unimac-mdio.-19: Broadcom UniMAC MDIO bus at 0x(ptrval)
23:20:12.389 -> dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
23:20:12.389 -> dwc_otg fe980000.usb: base=(ptrval)
23:20:12.422 -> Core Release: 2.80a
23:20:12.422 -> Setting default values for core params
23:20:12.422 -> Finished setting default values for core params
23:20:12.422 -> WARN::dwc_otg_core_reset:5114: dwc_otg_core_reset() HANG! Soft Reset GRSTCTL=80000001
23:20:12.422 -> 
23:20:12.422 -> WARN::dwc_otg_core_reset:5114: dwc_otg_core_reset() HANG! Soft Reset GRSTCTL=80000001
23:20:12.422 -> 
23:20:12.422 -> Using Buffer DMA mode
23:20:12.422 -> Periodic Transfer Interrupt Enhancement - disabled
23:20:12.455 -> Multiprocessor Interrupt Enhancement - disabled
23:20:12.455 -> OTG VER PARAM: 0, OTG VER FLAG: 0
23:20:12.455 -> Dedicated Tx FIFOs mode
23:20:12.455 -> WARN::dwc_otg_hcd_init:1045: FIQ DMA bounce buffers: virt = ead04000 dma = 0xead04000 len=9024
23:20:12.455 -> FIQ FSM acceleration enabled for :
23:20:12.455 -> Non-periodic Split Transactions
23:20:12.455 -> Periodic Split Transactions
23:20:12.455 -> High-Speed Isochronous Endpoints
23:20:12.455 -> Interrupt/Control Split Transaction hack enabled
23:20:12.489 -> WARN::hcd_init_fiq:457: FIQ on core 1
23:20:12.489 -> WARN::hcd_init_fiq:458: FIQ ASM at c038a680 length 26
23:20:12.489 -> WARN::hcd_init_fiq:497: MPHI regs_base at f0810200
23:20:12.489 -> dwc_otg fe980000.usb: DWC OTG Controller
23:20:12.489 -> dwc_otg fe980000.usb: new USB bus registered, assigned bus number 1
23:20:12.489 -> dwc_otg fe980000.usb: irq 38, io mem 0x00000000
23:20:12.489 -> Init: Port Power? op_state=1
23:20:12.489 -> Init: Power Port (0)
23:20:12.522 -> usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
23:20:12.522 -> usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
23:20:12.522 -> usb usb1: Product: DWC OTG Controller
23:20:12.522 -> usb usb1: Manufacturer: Linux 4.19.66-v7l dwc_otg_hcd
23:20:12.522 -> usb usb1: SerialNumber: fe980000.usb
23:20:12.522 -> hub 1-0:1.0: USB hub found
23:20:12.522 -> hub 1-0:1.0: 1 port detected
23:20:12.522 -> mousedev: PS/2 mouse device common for all mice
23:20:12.555 -> bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
23:20:12.555 -> sdhci: Secure Digital Host Controller Interface driver
23:20:12.555 -> sdhci: Copyright(c) Pierre Ossman
23:20:12.555 -> mmc-bcm2835 fe300000.mmcnr: could not get clk, deferring probe
23:20:12.555 -> sdhci-pltfm: SDHCI platform and OF driver helper
23:20:12.555 -> ledtrig-cpu: registered to indicate activity on CPUs
23:20:12.555 -> hidraw: raw HID events driver (C) Jiri Kosina
23:20:12.588 -> usbcore: registered new interface driver usbhid
23:20:12.588 -> usbhid: USB HID core driver
23:20:12.588 -> vchiq: vchiq_init_state: slot_zero = (ptrval), is_master = 0
23:20:12.588 -> [vc_sm_connected_init]: start
23:20:12.588 -> [vc_sm_connected_init]: end - returning 0
23:20:12.588 -> Initializing XFRM netlink socket
23:20:12.588 -> NET: Registered protocol family 17
23:20:12.588 -> Key type dns_resolver registered
23:20:12.588 -> Registering SWP/SWPB emulation handler
23:20:12.588 -> registered taskstats version 1
23:20:12.621 -> Loading compiled-in X.509 certificates
23:20:12.621 -> uart-pl011 fe201000.serial: cts_event_workaround enabled
23:20:12.621 -> fe201000.serial: ttyAMA0 at MMIO 0xfe201000 (irq = 34, base_baud = 0) is a PL011 rev2
23:20:12.621 -> console [ttyAMA0] enabled
23:20:12.621 -> fe215040.serial: ttyS0 at MMIO 0x0 (irq = 36, base_baud = 62500000) is a 16550
23:20:12.654 -> bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
23:20:12.654 -> brcmstb_thermal fd5d2200.thermal: registered AVS TMON of-sensor driver
23:20:12.654 -> mmc-bcm2835 fe300000.mmcnr: mmc_debug:0 mmc_debug2:0
23:20:12.654 -> mmc-bcm2835 fe300000.mmcnr: DMA channel allocated
23:20:12.687 -> sdhci-iproc fe340000.emmc2: Linked as a consumer to regulator.1
23:20:12.720 -> mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
23:20:12.720 -> mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
23:20:12.720 -> mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
23:20:12.754 -> mmc0: SDHCI controller on fe340000.emmc2 [fe340000.emmc2] using ADMA
23:20:12.754 -> of_cfs_init
23:20:12.754 -> of_cfs_init: OK
23:20:12.754 -> mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
23:20:12.754 -> uart-pl011 fe201000.serial: no DMA platform data
23:20:12.754 -> mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
23:20:12.754 -> Waiting for root device /dev/mmcblk0p2...
23:20:12.820 -> random: fast init done
23:20:12.820 -> mmc1: new high speed SDIO card at address 0001
23:20:12.886 -> mmc0: new ultra high speed DDR50 SDHC card at address aaaa
23:20:12.886 -> mmcblk0: mmc0:aaaa SC16G 14.8 GiB
23:20:12.886 ->  mmcblk0: p1 p2 p3
23:20:12.919 -> VFS: Mounted root (squashfs filesystem) readonly on device 179:2.
23:20:12.952 -> devtmpfs: mounted
23:20:12.985 -> Freeing unused kernel memory: 1024K
23:20:12.985 -> Run /sbin/init as init process
23:20:13.184 -> rcS: applet not found
23:20:13.283 -> 

23:20:13.283 -> Welcome to RPI4
23:20:13.283 -> root login: 
  • config.txt:
# Please note that this is only a sample, we recommend you to change it to fit
# your needs.
# You should override this file using a post-build script.
# See http://buildroot.org/manual.html#rootfs-custom
# and http://elinux.org/RPiconfig for a description of config.txt syntax

kernel=zImage

start_file=start4.elf
fixup_file=fixup4.dat

# Disable overscan assuming the display supports displaying the full resolution
# If the text shown on the screen disappears off the edge, comment this out
disable_overscan=1

# fixes rpi3 ttyAMA0 serial console
dtoverlay=pi3-miniuart-bt

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=off
dtparam=i2s=off
dtparam=spi=off

# Disable audio (loads snd_bcm2835)
dtparam=audio=off

# Disable DPI interface
enable_dpi_lcd=0

# Disable LCD on I2C bus
ignore_lcd=1

# Disable camera module
start_x=0

# Disable rainbow splash
disable_splash=1

# Remove possible bootloader delay
boot_delay_ms=0
bootcode_delay=0
boot_delay=0

# Set VideoCore memory
gpu_mem=96
  • cmdline.txt:
root=/dev/mmcblk0p2 rootfstype=squashfs rootwait console=tty1 console=ttyAMA0,115200

Is this supposed to be normal?

Linux user namespace - Remapping and subordinate user and group IDs

$
0
0

In the below docker file, base image(jenkins/jenkins) is providing a user jenkins with UID 1000 and GID 1000, within container.

FROM jenkins/jenkins

# Install some base packages

# Use non-privileged user provided by base image
USER jenkins # with uid 1000 and GID 1000

# Copy plugins and other stuff

On the docker host(EC2 instance), we also have similar UID & GID created,

 $ groupadd -g 1000 jenkins
 $ useradd -u 1000 -g jenkins jenkins
 $ mkdir -p /abc/home_folder_for_jenkins
 $ chown -R jenkins:jenkins /abc/home_folder_for_jenkins

to make sure, container can write files to /abc/home_folder_for_jenkins in EC2 instance.


Another aspect that we need to take care in same EC2 instance, is to run containers(other than above container) to run in non-privileged mode.

So, below configuration is performed on docker host(EC2):

$ echo dockremap:165536:65536 > /etc/subuid
$ echo dockremap:165536:65536 > /etc/subgid
$ echo '{"debug":true, "userns-remap":"dockremap"}'>     

/etc/docker/daemon.json


This dockremap configuration is not allowing jenkins to start and docker container goes in Exited state:

$ ls -l /abc/home_folder_for_jenkins
total 0

After removing docker remap configuration, everything work fine.


Why dockremap configuration not allow the jenkins container to run as jenkins user?

how to bind thermal sensor with cooling device using lookup table in code

$
0
0

i want to bind thermal sensor with cooling device ( fan ) using lookup table. I know how to do it using DTs ( device tree) but never worked using lookup table in code for same. I need help on how to do same on code using lookup table what we use to do using device tree. for example

thermal-zones {
    cpu_thermal: cpu-thermal {
        polling-delay-passive = <250>; /* milliseconds */
        polling-delay = <1000>; /* milliseconds */

        thermal-sensors = <&bandgap0>;

        trips {
            cpu_alert0: cpu-alert0 {
                temperature = <90000>; /* millicelsius */
                hysteresis = <2000>; /* millicelsius */
                type = "active";
            };
            cpu_alert1: cpu-alert1 {
                temperature = <100000>; /* millicelsius */
                hysteresis = <2000>; /* millicelsius */
                type = "passive";
            };
            cpu_crit: cpu-crit {
                temperature = <125000>; /* millicelsius */
                hysteresis = <2000>; /* millicelsius */
                type = "critical";
            };
        };

        cooling-maps {
            map0 {
                trip = <&cpu_alert0>;
                cooling-device = <&fan0 THERMAL_NO_LIMIT 4>;
            };
            map1 {
                trip = <&cpu_alert1>;
                cooling-device = <&fan0 5 THERMAL_NO_LIMIT>, <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
            };
        };
    };
};

how can i do same binding in code itself

Where do we define the type of structure returned by the kernel when using the "perf_event_open" system call using mmap?

$
0
0

I'm trying to use the syscall perf_vent_open to get some performance data from the system.

I am currently working on periodic data retrieval using shared memory with a ring buffer.

But I can't find what structure is returned in each section of the ring buffer. The manual page enumerate all possibilities, but that's all.

If you have some informations about that, I'll be happy to read it !

Linux console output on multiple UARTs

$
0
0

My embedded board has 2 UARTs. I want to have console output on both the UARTs.

In kernel/Documentation/console/console.txt it's mentioned that:

you can only define one console per device type (serial, video).

Does this mean I can use only one UART as console? Or, is it possible to redirect the console output to both of these UARTs?

How to get a global state of the locks in Linux kernel?

$
0
0

I'm writing some code for the Linux kernel and I noticed the interrupts are disabled when I need them to be enabled so that a process can handle a signal. It would be fantastic if I could just obtain a list of all the locks currently being hold in the system, as my suspicion is that a lock somewhere has disabled interruptions... This is, assuming that it was a lock that disabled the interruptions. If not, it would also be nice to know how did so (or where). Does the Linux kernel keep any record of this?


What is the "current" in Linux kernel source?

$
0
0

I'm studying about Linux kernel and I have a problem.

I see many Linux kernel source files have current->files. So what is the current?

struct file *fget(unsigned int fd)
{
     struct file *file;
     struct files_struct *files = current->files;

     rcu_read_lock();
     file = fcheck_files(files, fd);
     if (file) {
             /* File object ref couldn't be taken */
             if (file->f_mode & FMODE_PATH ||
                 !atomic_long_inc_not_zero(&file->f_count))
                     file = NULL;
     }
     rcu_read_unlock();

     return file;
 }

How nl80211 library & cfg80211 work?

$
0
0

I want to learn about how nl80211 and cfg80211 works in detail. Function flow, how nl80211 interact with network tools like wpa_supplicant, iw.

Plz suggest me some useful links or books to refer.

how to bind thermal temperature sensor with emc2103 fan

$
0
0

how to bind an external temperature sensor with fan emc2103 in Linux. As emc2103 has its own temperature sensor which its use to control fan speed. but I want to control fan speed based on CPU temperature. how to build this CPU temperature sensor with this emc2103 fan

Disabling the linux virtual console completely

$
0
0

I have a raspberry pi, which listens on the network and plays videos on hdmi when told. This is accomplished with omxplayer, without X11.

I want to make the screen completely back at all times except when omxplayer is showing something. By default there were a getty, linux debug output, a blinking cursor, a raspberry logo etc showing on the hdmi output. I have managed to disable everything with several cmdline.txt options.

However, it feels like a whole bunch of workarounds. I would like to disable the text output to the screen altogether in linux, like disabling the virtual terminal and the console altogether. Just like there is nothing on the 3.5mm sound output by default I don't want anything on the hdmi. Is this possible?

How to launch container with user namespace configuration?

$
0
0

In the below docker file, base image(jenkins/jenkins) is providing a user jenkins with UID 1000 and GID 1000, within container.

FROM jenkins/jenkins

# Install some base packages

# Use non-privileged user provided by base image
USER jenkins # with uid 1000 and GID 1000

# Copy plugins and other stuff

On the docker host(EC2 instance), we also have similar UID & GID created,

 $ groupadd -g 1000 jenkins
 $ useradd -u 1000 -g jenkins jenkins
 $ mkdir -p /abc/home_folder_for_jenkins
 $ chown -R jenkins:jenkins /abc/home_folder_for_jenkins

to make sure, container can write files to /abc/home_folder_for_jenkins in EC2 instance.


Another aspect that we need to take care in same EC2 instance, is to run containers(other than above container) to run in non-privileged mode.

So, below configuration is performed on docker host(EC2):

$ echo dockremap:165536:65536 > /etc/subuid
$ echo dockremap:165536:65536 > /etc/subgid
$ echo '{"debug":true, "userns-remap":"default"}'> /etc/docker/daemon.json

This dockremap configuration is not allowing jenkins to start and docker container goes in Exited state:

$ ls -l /abc/home_folder_for_jenkins
total 0

After removing docker remap configuration, everything work fine.


Why dockremap configuration not allow the jenkins container to run as jenkins user?

What is the mincore syscall used for in userland applications?

$
0
0

What is Linux'mincore(2) useful for in userland applications? Why is it exposed to non-privileged users?

I can imagine some databases taking advantage of knowing which pages are cached but what are some other examples?

How does Linux link device file with device driver? Does open() syscall eventually call device driver code?

$
0
0

I have a question about Linux device file and drivers, with my current understanding as the following:

  1. When a user calls open() on some device file, at some point of time kernel will ask inode of the device file for the read()/write() function.

  2. The device file was created by udev earlier, based on devices in /sys folder, meaning the inode of the device file should have i_fop field pointed to functions that know how to talk to the device, such as read()/write()/ioctl()/poll(). And that means each device file's inode->i_fop field should point to a different file_operations struct.

If so, the device driver will be providing these read()/write() functions, maybe the complete file_operations struct, including read/write/ioctl, etc.

now , ULK says (in the description of open() syscall for device files) "sets the i_fop field of the inode object to the address of either the def_blk_fops or the def_chr_fops file operation table, according to the type of device file." And that means all block device files have the same read()/write() function, but then how can a user talk to different devices?

I also checked the device_driver struct, and indeed, there are no place to store file access functions, so how exactly an open() syscall performs its job using a device specific driver then? And where do device specific operation function live, if not in device_driver?


Copying more than 1 page sized buffers from kernel space to user space using sysfs

$
0
0

I have created a sysfs entry with store and show functions. I'd like to use show function to copy buffers of size > PAGE_SIZE from the kernel space to userspace.

I am able to currently copy buffers of size PAGE_SIZE from/to kernel space to/from userspace respectively.

Any tips on how we can do it will be really helpful. Can we loop this show function in any possible way?

Also, In case above is not possible. Can you please suggest alternative ways to do the same thing? (which can be done really quickly)

Whats the difference between "id" and "stream_id" in the structure returned with the option "PERF_RECORD_SAMPLE" by the "perf_event_open" syscall?

$
0
0

I am trying to write a piece of code using the perf_event_open syscall. But I don't understand the real difference between id and stream_id fields in the structure returned in my memory map.


This structure is like this one (from the man page of perf_event_open) :

struct {
          struct perf_event_header header;
          u64    sample_id;   /* if PERF_SAMPLE_IDENTIFIER */
          u64    ip;          /* if PERF_SAMPLE_IP */
          u32    pid, tid;    /* if PERF_SAMPLE_TID */
          u64    time;        /* if PERF_SAMPLE_TIME */
          u64    addr;        /* if PERF_SAMPLE_ADDR */
          u64    id;          /* if PERF_SAMPLE_ID */
          u64    stream_id;   /* if PERF_SAMPLE_STREAM_ID */
          u32    cpu, res;    /* if PERF_SAMPLE_CPU */
          u64    period;      /* if PERF_SAMPLE_PERIOD */
          struct read_format v;
                                          /* if PERF_SAMPLE_READ */
          u64    nr;          /* if PERF_SAMPLE_CALLCHAIN */
          u64    ips[nr];     /* if PERF_SAMPLE_CALLCHAIN */
          u32    size;        /* if PERF_SAMPLE_RAW */
          char  data[size];   /* if PERF_SAMPLE_RAW */
          u64    bnr;         /* if PERF_SAMPLE_BRANCH_STACK */
          struct perf_branch_entry lbr[bnr];
                                          /* if PERF_SAMPLE_BRANCH_STACK */
          u64    abi;         /* if PERF_SAMPLE_REGS_USER */
          u64    regs[weight(mask)];
                                          /* if PERF_SAMPLE_REGS_USER */
          u64    size;        /* if PERF_SAMPLE_STACK_USER */
          char   data[size];  /* if PERF_SAMPLE_STACK_USER */
          u64    dyn_size;    /* if PERF_SAMPLE_STACK_USER &&
                                             size != 0 */
          u64    weight;      /* if PERF_SAMPLE_WEIGHT */
          u64    data_src;    /* if PERF_SAMPLE_DATA_SRC */
          u64    transaction; /* if PERF_SAMPLE_TRANSACTION */
          u64    abi;         /* if PERF_SAMPLE_REGS_INTR */
          u64    regs[weight(mask)];
                                          /* if PERF_SAMPLE_REGS_INTR */
          };

The man page give me this explanation :

id               If PERF_SAMPLE_ID is enabled, a 64-bit unique ID is included.  If the event is a member of an event group, the group leader ID is returned.  This ID is the same as the one returned by PERF_FORMAT_ID.
stream_id        If PERF_SAMPLE_STREAM_ID is enabled, a 64-bit unique ID is included. Unlike PERF_SAMPLE_ID the actual ID is returned, not the group leader.  This ID is the same as the one returned by PERF_FORMAT_ID.

But the problem is here: the documentation seems to be incoherent.

Have I missed something ?

Thanks for your attention.

Regular audio glitches on Linux with Scarlett 3rd gen USB interface [closed]

$
0
0

I have a Scarlett 18i20 audio interface running well on a Samsung laptop with Linux Mint 19.3 Tricia and with the 5.0.21-rt16 real time kernel with fully preemptive configuration.

The same set up on a desktop machine results in regular audio glitches between 3 and 4 seconds apart. I am testing with a sine wave in puredata and the problem occurs with alsa and with jack. The problem occurs with other audio apps too.

I came across a similar problem on this link:

https://askubuntu.com/questions/982882/audio-glitches-every-few-seconds-with-vlc-and-the-alc1220-codec/985596

The solution was related to the "system RTC clock having about a 4% drift" and was solved using the adjtimexconfig utility. When I run this utility, after stopping the NTP server, it reports:

Adjusting system time by -11.4326 sec/day to agree with CMOS clock...done.

"adjtimex -p" reveals the following:

         mode: 0
   offset: 14679795
frequency: 4435324
 maxerror: 289636
 esterror: 22136
   status: 8193 
time_constant: 7
precision: 1
tolerance: 32768000
     tick: 9998
 raw time:  1582195310s 628559316us = 1582195310.628559316

The adjustment however makes no improvement in the glitches.

For the hardware set up of the desktop, please see:

https://escuta.org/tmp/hardware.txt

Perf on MIPS debug kernel with frame_pointer

$
0
0

I am trying to use perf tool for MIPS & facing some trouble in getting back-stacks.

How can I enable FRAME_POINTER for mips ? I have DEBUG_KERNEL enabled, but it looks like -fno-omit-frame-pointer is not applicable for MIPS arch in kernel.

enter image description here

Does it mean frame pointer based stack unwinding with perf can't be achieved for MIPS ?

I don't see mips toolchain complaining about -fno-omit-frame-pointer flag

Linux timer hangs sometime and stops at 1ns

$
0
0

I have an embedded board with PowerPC 5200 running Realtime Linux with version 2.6.33.

My application is using one high-resolution timer in Linux for alarms. This timer sometimes didn’t expire. The problem happens very rarely, it may go many months between each time it happens on a system.

The timer is set by function timer_settime with absolute time. I have done some interesting observations when the timer didn’t expire:

  • Function timer_gettime returns remaining time 1ns.
  • Active timers are checked by displaying file /proc/timer_list and the timer_list didn’t show this timer in the active timer list.

I have looked into the Linux source and found a possible scenario:

The function timer_gettime ends up in function common_timer_get (posix-timers.c). Function common_timer_get returns it_value.tv_nsec = 1 if timer is active and remaining time is <= 0. This means that the timer has counted down and the timer state must be 'enqueued' or 'callback'.

I suppose that it is in state 'callback', that means it is running in function __run_hrtimer (hrtimer.c). Function __run_hrtimer is calling function __remove_hrtimer that remove the timer from timer active list before it changes timer state from 'enqueued' to 'callback'.

Several functions are called in function __run_hrtimer between changing timer state to 'callback' and the end of the function where the state 'callback' is cleared. If it is hanging here, the function timer_gettime may return 1ns while the timer is not on the active list. Here it is calling several functions in Linux kernel and the callback function in the application.

I have checked the callback function in my application. It is signaling a semaphore and setting the timer again on the same thread. I can't see why that should not work.

Is there someone that has seen a similar case?

Is there someone that has an idea of what is going wrong here?

Viewing all 12299 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>