Skip to content

Conversation

bllgg
Copy link

@bllgg bllgg commented Aug 28, 2025

Summary of changes

  • Introduced a new loader tunable hw.atkbd.fast_delay to /boot/loader.conf.
    • When enabled, the driver uses atkbd_short_delay, which applies significantly shorter delays in the following routines:
      • empty_both_buffers()
      • reset_aux_dev()
      • test_controller()
      • reset_kbd()
    • New short delays are up to 1000× smaller (for buffer resets) and about 40× smaller (for controller and keyboard resets).
    • Default behaviour remains with shorter delays, and hw.atkbd.short_delay should be set to 0, if someone needs longer delays for the old, slower hardware
  • Added a separate conf file into the /sys/amd64/conf named BOOT_PROF to enable the TSlogs

Notes:

This patch is part of the ongoing GSoC 2025 work on FreeBSD boot process optimisation.

Copy link

github-actions bot commented Aug 28, 2025

Thank you for taking the time to contribute to FreeBSD!
There are a few issues that need to be fixed:

Please review CONTRIBUTING.md, then update and push your branch again.

@bllgg bllgg marked this pull request as ready for review August 28, 2025 02:40
@cperciva cperciva self-assigned this Aug 28, 2025
@bllgg bllgg requested a review from bsdimp as a code owner August 28, 2025 05:02

#define MAXKBDC 1 /* XXX */
#define MAXKBDC 1 /* XXX */
#define MILISECOND_MULTIPLIER 1000 /* micro second values will be multiplied to convert to mili seconds */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, 'milli'. also, be mindful about line lengths, in general, we want to fit into 80 chars

(bus_space_write_1((k)->iot, (k)->ioh1, 0, (d)))

#define ATKBD_DELAY(x) (atkbd_short_delay ? (x) : (x) * MILISECOND_MULTIPLIER)
#define RESET_DELAY(x) (atkbd_short_delay ? (x) * MILISECOND_MULTIPLIER : (x) * MILISECOND_MULTIPLIER / RESET_DELAY_DIVISION_FACTOR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with long macro body we use \ to continue on next line and next line will be indented


int delay_us = 5000;
int max_wait_us = KBD_RESETDELAY*1000*KBD_MAXWAIT;
int delay_us = RESET_DELAY(KBD_RESETDELAY); /* if the atkbd_short_delay is activated, delay will be shorten */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line length there too

Copy link
Contributor

@concussious concussious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow this is cool! Please put these settings in atkbdc(4) when you get the chance.

kevans91 and others added 24 commits September 4, 2025 07:51
This reverts commit 65059dd.

lindebugfs does he vast majority of its pseudofs initialization nearly
everywhere but pseudofs, so let's defer this to post-brsnching.
We need to build OpenSSL when bootstrapping certctl.  On MacOS
ktls_enable() isn't defined anywhere, so without this the build fails.
We don't need KTLS in the bootstrap library, so just disable it.

Reviewed by:	khorben, ngie
Differential Revision:	https://reviews.freebsd.org/D52341
When LIB_PACKAGE was added, MIT Kerberos was updated to use it but
Heimdal was not, so it still used PACKAGE=kerberos-lib.  Since we
deleted kerberos-lib-all.ucl, this caused update-packages to fail
when WITHOUT_MITKRB5 is set.

Change the Heimdal libraries to use LIB_PACKAGE by setting this in
kerberos5/lib/Makefile.inc, and remove PACKAGE=kerberos-lib from the
individual Makefiles for each library.  This means Heimdal gets the
same set of packages as MIT Kerberos, except for kerberos-kdc which
we don't create for Heimdal.

Fixes:	929f596 ("packages: Improve handling of -lib packages")
Reported by:	jlduran
Reviewed by:	jlduran, cy
Differential Revision:	https://reviews.freebsd.org/D52371
Mark the unused space after pv_memattr as reserved. This doesn't change
the size of the struct as this padding was already inserted by the
compiler.

Sponsored by:	Arm Ltd
To allow for possible future use add reserved fields to struct mdproc.

Sponsored by:	Arm Ltd
Originally in e234027 the function argument was a
"const void *data" which we changed to "const int" in FreeBSD.  The
Linux version simply cast the const void * to (enum rtw89_rf_path)
both losing the const and changing the type.  When later the function
argument became a const union rtw89_fw_element_arg in 5b760ea it
seems we tried to undo the older FreeBSD specific part and initially
mismerged it leading to the const void *; but when fixing the type we
did not undo the __DECONST but did a mechanical copy.

Reviewed by:	bz
Co-authored-by:	bz (commit message)
Obtained from:	CheriBSD
Sponsored by:	AFRL, DARPA
Fixes:		6d67aab ("rtw89: update Realtek's rtw89 driver.")
Differential Revision:	https://reviews.freebsd.org/D52359
This will be used later to extend cpu feature detection

Reviewed by:	imp (earlier version)
Sponsored by:   Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52356
This will also be used as a tunable to control features in a later
change.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52357
Allow the user to enable/disable supported cpu features/errata from a
known tunable. This will allow the user to disable features, e.g. to
work around broken firmware. It can also be used to enable workarounds
for rare errata.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52358
Add a function that can check if a given midr is within a range of
revisions. This will be used to check if a CPU is affected by a known
erratum.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52187
 - Use the passed in midr rather than reading from pcpu
 - Use the new midr_check_var_part_range function to check if the midr
   is within the range of affected CPUs

Reviewed by:	alc
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52188
Use the new midr_check_var_part_range function to check if running on
an affected Neoverse-N1 CPU.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52189
When adding an interface with an IP address to a bridge, or assigning an
IP address to an interface which is in a bridge, and member_ifaddrs=1,
print a warning so users are informed this is deprecated.  Also add
"(deprecated)" to the sysctl description.

MFC after:	9 hours
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52335
We aren't ready to release with this set to 0: there's no solution for
running DHCP on a bridge from a devd hook, there are missing edge cases
like network boot with the boot interface in a bridge, and third-party
tools (e.g., vm-bhyve) still direct users to use the incorrect
configuration and/or don't support the correct configuration.

Based on popular vote, we'll set this back to 0 in both main and for
stable/15.

MFC after:	9 hours
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52336
It's unused.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52191
Add pmap_s1_invalidate_all_kernel to remove the need to check for the
kernel_pmap when it's passed in.

While here replace pmap calls to cpu_tlb_flushID with
pmap_s1_invalidate_all_kernel as they are identical.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52183
Replace cpu_tlb_flushID with pmap_s1_invalidate_all_kernel in initarm.
They are identical in the SMP case.

Reviewed by:	alc
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52184
The Arm Cortex-A55, Cortex-A76, and Cortex-A510 CPUs have errata that
require multiple TLBI, DSB instructions to workaround.

Add support to pmap to implement these. As it appears that all
affected TLBI calls are via pmap.c this should be sufficient.

As all variants of this erratum are Category-B (rare) require the
user to enable it at boot time.

Reviewed by:	alc
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52190
Otherwise files are handled in the order returned by find(1).  This
in turn results in inconsistent ordering of files in the METALOG mtree
file produced by "make installworld -DNO_ROOT", which results in
non-reproducible filesystem images.

Reviewed by:	gshapiro, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52349
Add kqueue tracking to jails, inspired by how it's done with processes.
EVFILT_JAIL takes a jail ID, and tracks with NOTE_JAIL_SET,
NOTE_JAIL_ATTACH, NOTE_JAIL_REMOVE, and NOTE_JAIL_CHILD. It also uses
the NOTE_TRACK mechanism that EVFILT_PROC uses, using the same result
flags (NOTE_CHILD and NOTE_TRACKERR).

Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D51940
While here, advertise the IFCAP_HWSTATS capability to avoid the net
stack from double counting it.

Co-authored-by:	zlei
Reviewed by:	zlei
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D44816
…r of octets sent

When ALTQ is enabled, this driver does "hardware" accounting and soft
accounting at the same time. Prefer the "hardware" one to make the logic
simpler.

Reviewed by:	zlei
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D44817
Similar to process descriptors, jail desriptors are allow jail
administration using the file descriptor interface instead of JIDs.
They come from and can be used by jail_set(2) and jail_get(2),
and there are two new system calls, jail_attach_jd(2) and
jail_remove_jd(2).

Reviewed by:	bz, brooks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D43696
stesser and others added 30 commits September 11, 2025 16:42
Add extra defines required for bc-7.1.0 to the Makefiles.
When freeing the last reference of the net80211 node the net80211
node_free() code may directly call into the crypto code to delete
the keys.  While we still holding the wiphy lock this would lead to
a recursion on the non-recursive wiphy lock.  Defer freeing the
reference until we are back under the net80211 com lock.

Reported by:	Mark Phillips (mark freebsdfoundation.org) on 15.0-ALPHA1
MFC after:	3 days
StartImage() may return additional data from failure. This data
has text message followed by optional binary blob. Print
out the text message (if present) and free the data.
See 7.4.2 EFI_BOOT_SERVICES.StartImage() page 199
UEFI_Spec_Final_2.11.pdf.

Reviewed by:	imp
Separate ossl's existing AES-NI GCM implementation into a common
ossl_aes_gcm.c and add conditionals to switch between OpenSSL's AES-NI
and POWER8 GCM routines depending on the architecture. Since the
existing AVX-512 implementation is less agnostic, move it into a
separate ossl_aes_gcm_avx512.c.

Reviewed by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D44274
PR:		286720
Reviewed by:	zlei
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D50491
Reported by:    markj, bz
Approved by:    markj (mentor)
Fixes:  2b74ff5 ("ichwd: introduce i6300esbwd watch dog driver")
Differential Revision: https://reviews.freebsd.org/D52476
The new Framework 16 with ALC285 exhibits the same issue as the previous
model. Therefore, we apply the same fix to the new model.

Reviewed by:    emaste, Daniel Schaefer <[email protected]>
Approved by:    lwhsu (mentor)
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Framework Computer Inc
Differential Revision: https://reviews.freebsd.org/D52423
* Set mode of sudoers to 0440.

Reviewed by:            bapt@, jlduran@
Approved by:            bapt@, jlduran@
Differential Revision:  https://reviews.freebsd.org/D52438
To better comply with the cloud-init specification, we need to
support the configuration of network-related parameters from
the network-config file, which is common in most deployments.

Reviewed by:            bapt@
Approved by:            bapt@
Differential Revision:  https://reviews.freebsd.org/D52419
* Set mode of etc directory to 0755.
* Use user.localbase sysctl instead of /usr/local.
* Add test case for doas.
* Set ${LOCALBASE} instead of /usr/local in nuageinit(7) man page.

Reviewed by:            bapt@
Approved by:            bapt@
Differential Revision:  https://reviews.freebsd.org/D52437
Reviewed by:	bcr
MFC after:	3 days
MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52489
I received a report that certain Linux application would crash on a
message of a departure of an interface with FreeBSD name.  Looks like
dropping NL_RTM_DELLINK is a lesser evil than relay them with FreeBSD
names.

This reverts commit 554907b.
Use bitfields to pack tx_credits and plen into a single 32-bit word.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D47759
This is intended to support control work requests that manipulate
connection state but do not transmit data.  Raw WRs are transmitted
immediately if possible, otherwise they are queued to an mbufq in the
toe pcb until sufficient credits are available.  Raw WRs take
precendence over transmitting socket data.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D47761
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D47762
In particular, the work request to update the TCB state when switching
from plain TCP to TLS is now queued on the connection's offload
transmit queue rather than over the per-port control queue.

This also handles an unlikely edge case that a connection does not
have sufficient credits to transmit other work requests synchronously
such as programming the key in on-card memory or altering TCB fields.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D47763
and whitespace cleanup.

MFC after:	3 days
Instead of using the EVFILT_PROC model of attempting to automatically
register new events when a child jail is created, just give a single
event when a child jail is created.  As was already done with jail
attach events, make a best-effort report of the added jail's id in
kn_data.  If the are multiple NOTE_JAIL_CHILD and/or NOTE_JAIL_ATTACH
events, set the NOTE_JAIL_MULTI flag, and don't report anything in
data, indicating that the caller will need to query the system state
on their own.

MFC after:	3 days
…S2 mouse drivers to identify the bottlenecks, mount process of the root file system, usb initialization and device initialization with TSLOG to identify the bottlenecks
…dev-atkbd-psm

# Conflicts:
#	sys/dev/atkbdc/atkbdc.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.