Sebastian Huber created a merge request: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/166
Project:Branches: sebhub/rtems-libbsd:counter-smp-6 to rtems/pkg/rtems-libbsd:6-freebsd-14 Author: Sebastian Huber ## Summary Issue #112: counter_u64 is broken on SMP archs This is the backport of !165 to 6-freebsd-14. The commit applies without a change. The update to FreeBSD 14 dropped the processor offset from `zpcpu_get()`. All processors added to the slot of processor 0 without an atomic operation. The new `keg_layout()` places the items of a per-CPU slab in its first page and the copy of each processor in a page of its own. The RTEMS value of `UMA_PCPU_ALLOC_SIZE` was `PAGE_SIZE / 32`. `counter_u64_fetch()` therefore added the values of unrelated counters, and an `M_ZERO` allocation cleared them. This gave the `netstat -i` output of the issue. Use `PAGE_SIZE` for `UMA_PCPU_ALLOC_SIZE` and restore the processor offset in `zpcpu_get()`, as FreeBSD does. Give the size of the early counter in `uint64_t` elements. On a target with 32 processors, the early counter takes 128 KiB. The new test `counter01` checks the sum of each counter and the slot of each processor. It fails without the fix. With the fix, `counter01`, `epoch01`, `smp01`, `loopback01` and `init01` pass against RTEMS 6. The branch does not build for sparc/gr740 without a local change. `freebsd/sys/arm/ti/am335x/am335x_scm.c` uses `phandle_t`, but no header of an RTEMS 6 build provides `<dev/ofw/openfirm.h>` to it. The tests ran with this include added. This defect predates the merge request. **BSP** sparc/gr740 with RTEMS_SMP ยท **Simulator** sis -gr740 -m 4 ## AI Details <!-- Make sure you have read our statement at https://www.rtems.org/generative-ai/ --> ### Prompt used None as a single prompt. The work was done in an interactive Claude Code session on the rtems-libbsd tree. The task was to fix issue #112 and to backport the fix. Each change was directed and reviewed. ### AI model used Claude Opus 5.5 (claude-opus-5-5), through Claude Code. ### How AI was used for the contribution - ( ) Formatting - (x) Test creation. - (x) Code comments. - ( ) The entire contribution was generated using AI - ( ) AI code completion such as Copilot in VSCode. The diagnosis, the implementation and the test were produced in that session under my direction, and the commit message was drafted there. ### Access I have not used a product which claims copyright in its output, and I have legitimate access to the one I used. -- View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/166 You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/namespace/20/sent_notifications/5-01hgaxwoekrpoqbukfiwqkggh-k/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help
_______________________________________________ bugs mailing list [email protected] http://lists.rtems.org/mailman/listinfo/bugs
