While "fast" taskqueue may be more expensive due to spinlock use,
when used mainly for timeout tasks it allows to avoid extra context
switches to and from callout thread, that is even more expensive.
MFC after: 1 month
(cherry picked from commit 358453ce9bdd99eb69641b02f2d7e29cedecbe27)
taskqueue_enqueue_timeout(0) is equivalent to taskqueue_enqueue(),
so no need to create a separate periodic_task and event_task to run
exactly the same handler.
MFC after: 1 month
(cherry picked from commit a8f80c0c16c7fb38c46ddccd7e1b06dc46c407b1)
My previous commit by reducing precision reduced the sampling rate
from 60Hz to 40Hz on idle system. Return it back to 60-80Hz range,
that should be good for mouse smoothness on 60Hz displays.
MFC after: 1 months
(cherry picked from commit 68e457df0268113646264883515412af4c8808cb)
It should make pause interval less strict.
While there, add cpu_spinwait() into a tight spin wait loop to burn
less power and let other SMT thread work more.
MFC after: 1 month
(cherry picked from commit a74df3f96e3ea4cc632088be870d9b0b0198859c)
In sampling mode some devices return same data indefinitely even if
there is nothing to report. Previous idle hysteresis implementation
activated only when device returned no data, so some devices ended up
polled at fast rate all the time. This new implementation compares
each new report with the previous, and, if they are identical, after
reaching threshold also drop sampling rate to slow.
On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
reduces idle power consumption by ~0.5W by reducing number of context
switches in the driver from ~4000 to ~700 per second when not touched.
MFC after: 1 month
(cherry picked from commit 8c86b981240324c1daaa387d4d3f8e3e53db3d2e)
Before every wait for FIFO interrupt set how much data/space do we
want to see there. Previous code was not using it for receive, as
result aggregating interrupts only within processing latency. The
new code needs only one interrupt per transfer per FIFO length.
On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
reduces the interrupt rate per device down to 2 per sample or 16-20
per second when idle and 120-160 per second when actively touched.
MFC after: 1 month
(cherry picked from commit 13037eaabede7fb7fbc25f4e84b549c73f9acb3c)
At least on my Tiger Lake-LP queue depth detection failed before the
ig4iic_set_config() call, resulting in no FIFO use. Moving it after
solves the problem, getting proper 64 bytes size.
On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
by few times reduces context switch rate in the driver, and probably
also improves the I2C bus utilization.
MFC after: 1 month
(cherry picked from commit 9c9d7fdd9f0041783955c5f540ac55a900877c0c)
Instead of setting and clearing BUS_MASTER_RLD register on every C3
state enter/exit, set it only once if the system supports C3 state
and we are going to "disable" bus master arbitration while in it.
This is what Linux does for the past 14 years, and for even more time
this register is not implemented in a relevant hardware. Same time
since this is only a single bit in a bigger register, ACPI has to
do take a global lock and do read-modify-write for it, that is too
expensive, saved only by C3 not entered frequently, but enough to be
seen in idle system CPU profiles.
MFC after: 1 month
(cherry picked from commit 5bc10feacc9d81e3bba9d28734a85e996682b408)
In particular, this enables support for PCI config access for domains
(segments) other than 0.
Reported by: cperciva
Tested by: cperciva (m7i.metal-48xl AWS instance)
Reviewed by: imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D42828
(cherry picked from commit f54a3890b1f419d4a9edc99000efef52b9071b8f)
This commit changes the API of pci_cfgreg(read|write) to add a domain
argument (referred to as a segment in ACPI parlance) (note that this
is not the same as a NUMA domain, but something PCI-specific). This
does not yet enable access to domains other than 0, but updates the
API to support domains.
Places that use hard-coded bus/slot/function addresses have been
updated to hardcode a domain of 0. A few places that have the PCI
domain (segment) available such as the acpi_pcib_acpi.c Host-PCI
bridge driver pass the PCI domain.
The hpt27xx(4) and hptnr(4) drivers fail to attach to a device not on
domain 0 since they provide APIs to their binary blobs that only
permit bus/slot/function addressing.
The x86 non-ACPI PCI bus drivers all hardcode a domain of 0 as they do
not support multiple domains.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D42827
(cherry picked from commit 1587a9db92c03c738bb3f0fc5874b43c961e7c99)
In particular, don't reserve resources added by drivers via other
means (e.g. acpi_bus_alloc_gas which calls bus_alloc_resource
right after adding the resource).
The intention of reserved resources is to ensure that a resource range
that a bus driver knows is assigned to a device is reserved by the
system even if no driver is attached to the device. This prevents
other "wildcard" resource requests from conflicting with these
resources. For ACPI, the only resources the bus driver knows about
for unattached devices are the resources returned from _CRS. All of
these resources are already reserved now via acpi_reserve_resources
called from acpi_probe_children.
As such, remove the logic from acpi_set_resource to try to reserve
resources when they are set. This permits RF_SHAREABLE to work with
acpi_bus_alloc_gas without requiring hacks like the current one for
CPU device resources in acpi_set_resource.
Reported by: gallatin (RF_SHAREABLE not working)
Diagnosed by: jrtc27
(cherry picked from commit c6a488511ab1fbae8d16264b9e83c85024c9e1ce)
In 9750d9e5, I brought the equivalent of the TS_BUSY flag back in a
mostly hardware-agnostic way in order to fix tty_drain() and, thus,
TIOCDRAIN for UARTs with TX FIFOs. This proved to be sufficient for
fixing the regression reported. So in light of the release cycle of
FreeBSD 10.3, I decided that this change was be good enough for the
time being and opted to go with the smallest possible yet generic
(for all UARTs driven by uart(4)) solution addressing the problem at
hand.
However, at least for the NS8250-class the above isn't a complete
fix as these UARTs only trigger an interrupt when the TX FIFO became
empty. At this point, there still can be an outstanding character
left in the transmit shift register as indicated via the LSR. Thus,
this change adds the 3rd (besides the tty(4) and generic uart(4) bits)
part I had in my tree ever since, adding a uart_txbusy method to be
queried in addition for tsw_busy and hooking it up as appropriate
for the NS8250-class.
As it turns out, the exact equivalent of this 3rd part later on was
implemented for uftdi(4) in 9ad221a5.
While at it, explain the rational behind the deliberately missing
locking in uart_tty_busy() (also applying to the generic sc_txbusy
testing already present).
(cherry picked from commit 353e4c5a068d06b0d6dcfa9eb736ecb16e9eae45)
The global hw.igb.rx_process_limit knob never was adhered to by the
in-tree version of this driver but similar functionality is available
via the device-specific dev.igb.N.iflib.rx_budget.
While at it, remove the - besides initialization of tx_process_limit -
unused {r,t}x_process_limit members.
(cherry picked from commit f221d35be7a5749e2a1246c81adc9c03c1dc545c)
The global hw.em.rx_process_limit knob has been replaced by the device-
specific dev.IF.N.iflib.rx_budget along with the conversion to iflib(4).
While at it, remove the - besides initialization of tx_process_limit -
unused {r,t}x_process_limit members.
(cherry picked from commit 0d6d28ce5650d1cd23dbe4bbac87fb103b3e2d3d)
This is in preparation for annotating copyin() and related functions
with __result_use_check.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D43178
(cherry picked from commit 243e3ab3d34ada9da4f202f8cab90da2d6c49e5e)
Some of the files are using outdated linceses.
Update the license to be 2023.
Approved by: cperciva (mentor)
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
(cherry picked from commit 246aa273244e91a30d70997a3be790a29f9eb29c)
This commit introduces SRD metrics through sysctl.
The metrics can be queried using the following sysctl node:
sysctl dev.ena.<device index>.ena_srd_info
Approved by: cperciva (mentor)
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
(cherry picked from commit 36d42c862f4a5643f6e2395e8d7b7e5c4580499a)
This commit adds sysctl support for customer metrics.
Different customer metrics can be found in the following sysctl node:
sysctl dev.ena.<device index>.customer_metrics
Approved by: cperciva (mentor)
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
(cherry picked from commit f97993ad7b9c9e4787bd198d11f348c271af513e)
Rename sample_interval node to stats_sample_interval and move
it up in the sysctl tree to make it clear that it's relevant for
all the stats and not only ENI metrics (Currently, sample interval node
is found under eni_metrics node).
Path to node:
dev.ena.<device_index>.stats_sample_interval
Once this parameter is set it will set the sample interval for all the
stats node including SRD/customer metrics.
Approved by: cperciva (mentor)
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
(cherry picked from commit 5b925280d9a54eaefd85827bf6e84049aea8fa98)
This commit removes the usage of this API from the freebsd driver since
the relevant functionality is not supported by the device.
Approved by: cperciva (mentor)
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
(cherry picked from commit 2835752e075f2fa3edcb596df8306c570ec4cae6)
This commit fixes the usage of this function to be compatible with the
new API introduced by ena-com update to v2.7.0
Approved by: cperciva (mentor)
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
(cherry picked from commit 72e34ebdd08854dc896f267b0461e241c4040241)
This commit:
1. Sets the time since last cleanup to milliseconds.
2. Fixes incorrect indentations.
Approved by: cperciva (mentor)
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
(cherry picked from commit 9272e45c04c0d4fcb5d767e962783f3ab192f64e)
This commit allows spreading IO IRQs over different CPUs through sysctl.
Two sysctl nodes are introduced:
1- base_cpu: servers as the first CPU to which the first IO IRQ
will be bound.
2- cpu_stride: sets the distance between every two CPUs to which every
two consecutive IO IRQs are bound.
For example for doing the following IO IRQs / CPU binding:
IRQ idx | CPU
----------------
1 | 0
2 | 2
3 | 4
4 | 6
Run the following commands:
sysctl dev.ena.<device index>.irq_affinity.base_cpu=0
sysctl dev.ena.<device_index>.irq_affinity.cpu_stride=2
Also introduced rss_enabled field, which is intended to replace
'#ifdef RSS' in multiple places, in order to prevent code duplication.
We want to bind interrupts to CPUs in case of rss set OR in case
the newly defined sysctl paremeter is set. This requires to remove a
couple of '#ifdef RSS' as well in the structs, since we'll be using the
relevant parameters in the CPU binding code.
Approved by: cperciva (mentor)
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
(cherry picked from commit f9e1d9471077109c19fd7d6dc9c1d35432efdede)
The logic analyzer in the T6 CIM block has a different capture size than
previous chips.
Sponsored by: Chelsio Communications
(cherry picked from commit 9ea86c8f67a65ca00f79f3cd83aa977b38589f39)
Version : 1.27.5.0
Date : 10/10/2023
=====================
Fixes
-----
BASE:
- Fixed handling the Remote Fault with AN, causing the link failure.
=====================
Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications
(cherry picked from commit b1e82d33193b83d86d46483b4ddfe295becd80c4)
Replace the DOOMED flag with a transient DETACHING flag that is cleared
when VI is detached. This fixes VI reattach when only the VI and not
the parent nexus is detached. The old flag was never cleared and
prevented subsequent synch op's related to the VI.
PR: 275260
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D43287
Sponsored by: Chelsio Communications
(cherry picked from commit 0201eb29dde9dccbf796f81fbf18f3b21798183d)
This avoids a mutex reinitialization when the VI is detached and
reattached.
Fixes: 516fe911a6 cxgbe(4): Always use the per-VI callout to read interface stats.
Sponsored by: Chelsio Communications
(cherry picked from commit 8b144c015c9cce0bc99a7fbdc43f22f51a946d2c)
This is in preparation for annotating copyin() and related functions
with __result_use_check.
MFC after: 1 week
(cherry picked from commit 916273680b6d6439a117d6cf8c2d7423234bc1c0)
This is in preparation for annotating copyin() and related functions
with __result_use_check.
MFC after: 1 week
(cherry picked from commit 2873d841f81cdc205135370875d3d71a3402e90a)
This is in preparation for annotating copyin() and related functions
with __result_use_check.
MFC after: 1 week
(cherry picked from commit b4a9e6d81447c46c7bae56dc798097d9d3a4c495)
The CSB_WRITE() and _READ() macros respectively write to and read from
userspace memory and so can in principle fault. However, we do not
check for errors and will proceed blindly if they fail. Add assertions
to verify that they do not.
This is in preparation for annotating copyin() and related functions
with __result_use_check.
Reviewed by: vmaffione
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43200
(cherry picked from commit 99efa2c88d93c6272a8f54b18d18d0fd9d60f137)
In the VESA driver, simply ignore errors. It is not clear to me how to
return them to userspace.
This is in preparation for annotating copyin() and related functions
with __result_use_check.
MFC after: 1 week
(cherry picked from commit ddc8576d297937a1395f47550a8f5b1fac79afc2)