|
From: Luca T. <no...@gi...> - 2026-10-14 09:41:02
|
Branch: refs/heads/master Home: https://github.com/LinuxCNC/linuxcnc Commit: 6bbfa032027ca0dc9cb1252290d5ddc2a3e8e4cf https://github.com/LinuxCNC/linuxcnc/commit/6bbfa032027ca0dc9cb1252290d5ddc2a3e8e4cf Author: yurc <yu...@gm...> Date: 2026-10-04 (Sun, 04 Oct 2026) Changed paths: A tests/hal-delf-live/README A tests/hal-delf-live/beat-check.sh A tests/hal-delf-live/checkresult A tests/hal-delf-live/control A tests/hal-delf-live/delfvictim.comp A tests/hal-delf-live/test.sh Log Message: ----------- tests: delf/unloadrt of a function in a running thread Repeatedly loadrt -> addf -> delf -> unloadrt a component whose function busy-waits 20 us in a 100 us thread that keeps running. DELF_ITER (default 200) sets the number of cycles. Commit: 23f54b89bc4d907d3029c24ce3d187785d6e0331 https://github.com/LinuxCNC/linuxcnc/commit/23f54b89bc4d907d3029c24ce3d187785d6e0331 Author: yurc <yu...@gm...> Date: 2026-10-04 (Sun, 04 Oct 2026) Changed paths: M src/hal/hal_lib.c Log Message: ----------- hal: don't recycle a funct entry the running thread may still use The realtime thread walks its funct_list without the HAL mutex. hal_del_funct_from_thread() and free_funct_struct() (unloadrt) unlinked the entry with list_remove_entry(), which points the entry's links at itself, and returned it to the free list at once. A thread standing on the entry then loops on it or follows a recycled link, and the following unloadrt dlclose()s code the thread may still run: rtapi_app dies or the thread hangs. Unlink the entry keeping its own links, then wait until the thread has completed two more passes (beatcnt, published with a release store) before the entry is freed. If the thread does not complete a pass within 1000 periods the entry is leaked and delf returns -ETIMEDOUT. Commit: 6af8e3b6da7fef694c7d55371d66338f9122bfd9 https://github.com/LinuxCNC/linuxcnc/commit/6af8e3b6da7fef694c7d55371d66338f9122bfd9 Author: yurc <yu...@gm...> Date: 2026-10-04 (Sun, 04 Oct 2026) Changed paths: M tests/hal-delf-live/test.sh Log Message: ----------- tests: hal-delf-live: fix shellcheck SC2034 (unused loop variable) Commit: 61c51433f546e3c2432fe4d4d1bc5d2ce6ab5475 https://github.com/LinuxCNC/linuxcnc/commit/61c51433f546e3c2432fe4d4d1bc5d2ce6ab5475 Author: yurc <yu...@gm...> Date: 2026-10-05 (Mon, 05 Oct 2026) Changed paths: M src/hal/hal_lib.c Log Message: ----------- hal: wait for quiescence on the threadbeat pin Leave beatcnt alone and read the thread's threadbeat pin with hal_get_sint(). The pin reference is only valid in the context that created the thread, so it is mapped through the owner's shmem base, as unlink_pin() does. Read threadbeat, then while threads are running delay two periods (one period on later rounds) and stop once threadbeat advanced by two. No timeout and no leak path: stopping the threads ends the wait. Commit: 4fd86137c3740ba2c94ee4ca950da1639a2f0966 https://github.com/LinuxCNC/linuxcnc/commit/4fd86137c3740ba2c94ee4ca950da1639a2f0966 Author: yurc <yu...@gm...> Date: 2026-10-05 (Mon, 05 Oct 2026) Changed paths: M tests/hal-delf-live/README M tests/hal-delf-live/beat-check.sh R tests/hal-delf-live/control M tests/hal-delf-live/test.sh Log Message: ----------- tests: hal-delf-live: no sudo, wait for threadbeat instead of sleeping Run halcompile without sudo and drop the sudo restriction. beat-check.sh waits until threadbeat advanced by two instead of comparing two reads 0.1 s apart; a stuck thread is caught by the timeout in test.sh. Commit: 85a3ac512b5ab8b517fd5cfd55b7819cadcfb61f https://github.com/LinuxCNC/linuxcnc/commit/85a3ac512b5ab8b517fd5cfd55b7819cadcfb61f Author: yurc <yu...@gm...> Date: 2026-10-05 (Mon, 05 Oct 2026) Changed paths: A tests/hal-delf-live/control M tests/hal-delf-live/delfvictim.comp M tests/hal-delf-live/test.sh Log Message: ----------- tests: hal-delf-live: restore sudo restriction, bit -> bool package-arch installs test components into the system rtlib and needs root, same as tests/realtime-math, tests/symbols.0/.1 and tests/rtapi-shmem: ${SUDO} halcompile --install plus a control file with Restrictions: sudo. runtests only exports SUDO=sudo for system builds (scripts/runtests.in), so RIP still runs this test without sudo. Also update delfvictim.comp's dummy pin from bit to bool, matching the rest of the tree after the bit->bool rename. Commit: 005e951ef4457b409e78b992eb1c24d860e81482 https://github.com/LinuxCNC/linuxcnc/commit/005e951ef4457b409e78b992eb1c24d860e81482 Author: yurc <yu...@gm...> Date: 2026-10-06 (Tue, 06 Oct 2026) Changed paths: R tests/hal-delf-live/control A tests/hal-delf-live/skip M tests/hal-delf-live/test.sh Log Message: ----------- tests: hal-delf-live: skip on installed packages instead of sudo Follow the convention for new tests: no sudo anywhere. test.sh runs plain 'halcompile --install' (RIP tree), the control file with 'Restrictions: sudo' is dropped, and an executable skip file (as in tests/kins-frames) skips the test when SYSTEM_BUILD is set, so package-arch never touches /usr/lib/linuxcnc/modules. Commit: d36ff694c31c4c4bc68c64e6c6533019ced860fa https://github.com/LinuxCNC/linuxcnc/commit/d36ff694c31c4c4bc68c64e6c6533019ced860fa Author: yurc <yu...@gm...> Date: 2026-10-06 (Tue, 06 Oct 2026) Changed paths: M src/hal/hal_lib.c Log Message: ----------- hal: look up the threadbeat pin by name in thread_wait_quiescent() thread->threadbeat is only valid in the context that created the thread, and delf reaches the wait from halcmd. Instead of rebasing the pointer through the owner's shmem_base, find '<thread>.threadbeat' by name and resolve it (signal or dummysig) in the current context, as hal_getref_p() does. hal_getref_p() itself is ULAPI only, while unloadrt reaches the wait from RTAPI through free_funct_struct(). Also indent the added code with spaces only. Commit: e1a8c562fa0c0150009f35040cfb2f4832ae09b1 https://github.com/LinuxCNC/linuxcnc/commit/e1a8c562fa0c0150009f35040cfb2f4832ae09b1 Author: yurc <yu...@gm...> Date: 2026-10-06 (Tue, 06 Oct 2026) Changed paths: M tests/hal-delf-live/README R tests/hal-delf-live/beat-check.sh A tests/hal-delf-live/delftest.hal A tests/hal-delf-live/delftest.py M tests/hal-delf-live/delfvictim.comp M tests/hal-delf-live/test.sh Log Message: ----------- tests: hal-delf-live: deterministic delf/unloadrt race test Replace the probabilistic loop with a test that holds the thread inside the function: delfvictim spins while its hold pin is set. delftest.py then runs 'delf' and 'unloadrt' from another process and fails if either returns while the thread is still inside, if it fails after the thread is released, or if the thread stops advancing threadbeat. While delf/unloadrt waits it holds the HAL mutex, so the script drives the victim through its own component pins, which need no mutex. threadbeat is read with hal.get_p() in Python (no 32-bit wrap); a stopped thread ends in the timeout. beat-check.sh is removed. Commit: 2fcb0d4e6e5a34514a9db4b85769bc62873dfe2d https://github.com/LinuxCNC/linuxcnc/commit/2fcb0d4e6e5a34514a9db4b85769bc62873dfe2d Author: yurc <yu...@gm...> Date: 2026-10-06 (Tue, 06 Oct 2026) Changed paths: M src/hal/hal_lib.c Log Message: ----------- hal: wait for a removed funct entry only in ULAPI (delf), with a timeout rtapi_delay() must not be used to wait in RTAPI code, and unloadrt reaches free_funct_struct() from RTAPI. Only delf (ULAPI) now waits for the thread to leave the unlinked entry, at most 1000 thread periods; on timeout delf fails with -ETIMEDOUT and the entry is not recycled. In RTAPI, an entry removed from a running thread is not recycled and an error asks to stop the threads or delf the function before unloading. The threadbeat pin is looked up with hal_getref_p(), a missing pin is reported as an error. Commit: 2b760c35f97b73ba09763ba034f1c88bfa4c1561 https://github.com/LinuxCNC/linuxcnc/commit/2b760c35f97b73ba09763ba034f1c88bfa4c1561 Author: yurc <yu...@gm...> Date: 2026-10-06 (Tue, 06 Oct 2026) Changed paths: M tests/hal-delf-live/README M tests/hal-delf-live/delftest.py M tests/hal-delf-live/delfvictim.comp Log Message: ----------- tests: hal-delf-live: no component, no nets, no wall-clock timeouts The test uses hal.set_p()/hal.get_p() on the victim's pins. The victim holds the thread for 500 periods by itself, so nothing has to be written while delf holds the HAL mutex. After delf returns, v.inside must be false. The only time limit is the one in test.sh. Commit: 68d4ea10886a6347790fd8e8e90ef324860ad0bf https://github.com/LinuxCNC/linuxcnc/commit/68d4ea10886a6347790fd8e8e90ef324860ad0bf Author: yurc <yu...@gm...> Date: 2026-10-06 (Tue, 06 Oct 2026) Changed paths: M src/hal/hal_lib.c Log Message: ----------- hal: funct_entry_unlink() comment names funct_entry_release() Commit: cb300d33d2c173dc76616b3580163a2327c43859 https://github.com/LinuxCNC/linuxcnc/commit/cb300d33d2c173dc76616b3580163a2327c43859 Author: yurc <yu...@gm...> Date: 2026-10-06 (Tue, 06 Oct 2026) Changed paths: M tests/hal-delf-live/README Log Message: ----------- tests: hal-delf-live: README describes delf waiting, unloadrt not Commit: 32a602d1a3871dc7a3ff7edcbab4ec7e47a9aec7 https://github.com/LinuxCNC/linuxcnc/commit/32a602d1a3871dc7a3ff7edcbab4ec7e47a9aec7 Author: yurc <yu...@gm...> Date: 2026-10-07 (Wed, 07 Oct 2026) Changed paths: M src/hal/hal.h M src/hal/hal_lib.c M src/hal/utils/halcmd_commands.cc M tests/hal-delf-live/README M tests/hal-delf-live/delftest.py Log Message: ----------- hal: refuse unloadrt while a function of the component is in a running thread hal_comp_check_unload() checks, under the HAL mutex, whether a function of the component is in a thread while the threads run. halcmd unloadrt calls it before unloading and fails with -EBUSY; hal_lib names the functions. The check has to come before the unload: rtapi_app_exit() is void and rtapi_app dlclose()s the module whatever hal_exit() returns. delf still waits for the thread to leave the removed entry: unlinking does not stop a thread that is already on the entry, and the function's user count only drops once the entry is released. Also: the edited lines keep the indentation of the lines they replace, and the missing threadbeat pin message prints the error code. tests/hal-delf-live: unloadrt must fail before delf and work after it; stop, unloadrt, start works as before; every wait aborts after 10 s. Commit: 0b36e486199ea06a16c165e2ea13c918d9663259 https://github.com/LinuxCNC/linuxcnc/commit/0b36e486199ea06a16c165e2ea13c918d9663259 Author: yurc <yu...@gm...> Date: 2026-10-07 (Wed, 07 Oct 2026) Changed paths: M src/hal/utils/halcmd_commands.cc Log Message: ----------- halcmd: unloadrt refusal message without hal_strerror (it has no text for -EBUSY) Commit: 5fdeffe077298e3e4ca78752ff8eea83cf6f4c2e https://github.com/LinuxCNC/linuxcnc/commit/5fdeffe077298e3e4ca78752ff8eea83cf6f4c2e Author: yurc <yu...@gm...> Date: 2026-10-09 (Fri, 09 Oct 2026) Changed paths: M src/hal/hal.h M src/hal/hal_lib.c M src/hal/utils/halcmd_commands.cc M tests/hal-delf-live/README M tests/hal-delf-live/delftest.py Log Message: ----------- halcmd: unloadrt delfs the component's functions instead of a hal_lib check hal_comp_check_unload() is removed. halcmd finds the component's functions with hal_list_funct() and their threads with hal_list_thread() (HAL_QTYPE_THREAD_FUNCT) and delfs each entry before unloading, so unloadrt waits for a running thread like delf does and does not unload when a delf fails. Init entries are left to the unload. With the config locked, unloadrt works as before. The test now runs unloadrt without delf while the thread is held inside the function. Commit: 985d03feafac7062e6122a80031a32bccb7d8603 https://github.com/LinuxCNC/linuxcnc/commit/985d03feafac7062e6122a80031a32bccb7d8603 Author: yurc <yu...@gm...> Date: 2026-10-09 (Fri, 09 Oct 2026) Changed paths: M src/hal/utils/halcmd_commands.cc Log Message: ----------- halcmd: unloadrt_delf() messages in the style of the other list errors The error messages drop the function-name prefix, like the message of do_unloadrt_cmd() for hal_list_comp(). The comment says that the entries removed before a failed delf stay removed. Commit: 9d639ea00652872e1659c2094c0fb0c9cb4174f9 https://github.com/LinuxCNC/linuxcnc/commit/9d639ea00652872e1659c2094c0fb0c9cb4174f9 Author: yurc <yu...@gm...> Date: 2026-10-10 (Sat, 10 Oct 2026) Changed paths: M src/hal/hal.h M src/hal/hal_lib.c M src/hal/utils/halcmd_commands.cc M tests/hal-delf-live/README M tests/hal-delf-live/delftest.hal Log Message: ----------- halcmd: unloadrt removes the component's init entries first, one query record hal_del_init_funct_from_thread() removes one entry of a function from a thread's init list. The realtime thread walks and drains that list without the mutex once the threads run, so it is changed only while the threads are stopped and the init cycle has not run; otherwise it returns -EBUSY. unloadrt_delf() collects the init entries and the cyclic entries of the component in two vectors and removes the init entries first. If that fails, the threads were started meanwhile and the component is not unloaded. One HalQRec is reused for both queries with clear(). delftest.hal unloads a component with an init entry before start. Commit: f1c6bbd4a51cbcc4000b6314cedf5a0cccc5e13f https://github.com/LinuxCNC/linuxcnc/commit/f1c6bbd4a51cbcc4000b6314cedf5a0cccc5e13f Author: yurc <yu...@gm...> Date: 2026-10-10 (Sat, 10 Oct 2026) Changed paths: M docs/src/hal/components.adoc M docs/src/man/man3/hal_init_funct_to_thread.3.adoc M src/hal/hal_lib.c Log Message: ----------- hal: document hal_del_init_funct_from_thread(), -ENOENT like its counterpart The new function is described on the hal_init_funct_to_thread(3) page, the way hal_del_funct_from_thread() shares the hal_add_funct_to_thread(3) page, and is listed in components.adoc. A function or thread that does not exist returns -ENOENT, as in hal_init_funct_to_thread(), so the return values on the shared page hold for both. Commit: cde9d4ee0165b3b019c338d77ced666048c90c7d https://github.com/LinuxCNC/linuxcnc/commit/cde9d4ee0165b3b019c338d77ced666048c90c7d Author: yurc <yu...@gm...> Date: 2026-10-10 (Sat, 10 Oct 2026) Changed paths: M tests/hal-delf-live/README M tests/hal-delf-live/delfvictim.comp Log Message: ----------- tests/hal-delf-live: the victim sleeps inside its function delfvictim held the thread inside its function for 500 periods in a busy loop. When delftest.py and halcmd ran on the CPU of the realtime thread (no isolcpus, RTAPI_CPU_NUMBER on a shared CPU), they did not run during the hold: v.inside was never seen and the test failed with "no progress in 10 s", and delf could not run while the thread was inside. The function now waits in rtapi_delay(), which sleeps in uspace, so the CPU is free while the thread is inside and delf runs during the hold in every CPU layout. Without the wait in delf the test still fails ("delf returned while the thread was inside v"), now also when all processes share one CPU. Commit: 738c4efbcebcb9f53ef86a560048ec0bcd6fa8a9 https://github.com/LinuxCNC/linuxcnc/commit/738c4efbcebcb9f53ef86a560048ec0bcd6fa8a9 Author: yurc <yu...@gm...> Date: 2026-10-10 (Sat, 10 Oct 2026) Changed paths: M docs/src/man/man3/hal_init_funct_to_thread.3.adoc M src/hal/hal.h M src/hal/hal_lib.c Log Message: ----------- hal: hal_del_init_funct_from_thread() returns -EALREADY like its counterpart Commit: 04cd92b0d1ee5027dc9b1b3e3bdc78c061a943e3 https://github.com/LinuxCNC/linuxcnc/commit/04cd92b0d1ee5027dc9b1b3e3bdc78c061a943e3 Author: yurc <yu...@gm...> Date: 2026-10-10 (Sat, 10 Oct 2026) Changed paths: M src/hal/utils/halcmd_commands.cc Log Message: ----------- halcmd: unloadrt names the error when an init entry is not removed Commit: f6eadeb2941b6d27b8c27f690ceb471bb3b48352 https://github.com/LinuxCNC/linuxcnc/commit/f6eadeb2941b6d27b8c27f690ceb471bb3b48352 Author: yurc <yu...@gm...> Date: 2026-10-10 (Sat, 10 Oct 2026) Changed paths: M src/hal/hal_lib.c Log Message: ----------- hal: quote the function name in the hal_del_init_funct_from_thread() error Commit: b36e0d1822ec32fc167ad2c77abb94a00203d609 https://github.com/LinuxCNC/linuxcnc/commit/b36e0d1822ec32fc167ad2c77abb94a00203d609 Author: Luca Toniolo <107...@us...> Date: 2026-10-14 (Wed, 14 Oct 2026) Changed paths: M docs/src/hal/components.adoc M docs/src/man/man3/hal_init_funct_to_thread.3.adoc M src/hal/hal.h M src/hal/hal_lib.c M src/hal/utils/halcmd_commands.cc A tests/hal-delf-live/README A tests/hal-delf-live/checkresult A tests/hal-delf-live/delftest.hal A tests/hal-delf-live/delftest.py A tests/hal-delf-live/delfvictim.comp A tests/hal-delf-live/skip A tests/hal-delf-live/test.sh Log Message: ----------- Merge pull request #4630 from SyncTwin/synctwin/hal-delf-quiescence-master hal: don't free a funct entry the running thread may still use (delf/unloadrt crash) Compare: https://github.com/LinuxCNC/linuxcnc/compare/912313954ee1...b36e0d1822ec To unsubscribe from these emails, change your notification settings at https://github.com/LinuxCNC/linuxcnc/settings/notifications |