if_tuntap: defer transient destroy_dev() to a taskqueue
We're in the dtor, so we can't destroy it now without deadlocking after
recent changes to make destroy_dev() provide a barrier. However, we
know there isn't any other dtor to run, so we can go ahead and clean up
our state and just prevent a use-after-free if someone races to open
the device while we're trying to destroy it. tunopen() now uses the
net epoch to protect against softc release by a concurrent
tun_destroy().
While we're here, allow a destroy operation to proceed if we caught a
signal in cv_wait_sig() but tun_busy dropped to 0 while we were waiting
to acquire the lock.
This was more of an inherent design flaw, rather than a bug in the
below-refed commit.
Reviewed by: kib, markj
(cherry picked from commit 96c1d8db39dfeea78ea3f27d67649252a39bbf2e)
avoid use-after-free when a network interface is destroyed
When iterating over the protocols list, the got_one handler will free
a protocol if an interface dhcpd was listening on was destroyed.
problem reported by landry@, feedback and ok claudio@
Bypass snprintf() in quota checks if no quotas set
This improves synthetic 1 byte write speed by ~2.5%.
Reviewed-by: Ameer Hamza <ahamza at ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: Alexander Motin <alexander.motin at TrueNAS.com>
Closes #18063
Implement reserveAllocationSpace for SectionMemoryManager (#71968)
Implements `reserveAllocationSpace` and provides an option to enable
`needsToReserveAllocationSpace` for large-memory environments with
AArch64.
The [AArch64
ABI](https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst#7code-models)
has restrictions on the distance between TEXT and GOT sections as the
instructions to reference them are limited to 2 or 4GB. Allocating
sections in multiple blocks can result in distances greater than that on
systems with lots of memory. In those environments several projects
using SectionMemoryManager with MCJIT have run across assertion failures
for the R_AARCH64_ADR_PREL_PG_HI21 instruction as it attempts to address
across distances greater than 2GB (an int32).
Fixes #71963 by allocating all sections in a single contiguous memory
allocation, limiting the distance required for instruction offsets
similar to how pre-compiled binaries would be loaded into memory.
Co-authored-by: Lang Hames <lhames at gmail.com>
take advantage of if_vinput not sleeping now to avoid real refcnts
the vlan tag hash was an array of smr protectect lists. previously
when we found a vlan interface in the tag hash we'd take a real ref
(refcnt_take) to that interface before pushing it through the network
stack with if_vinput. we did this because the network stack can
sleep, and you can't sleep in an smr critical section.
now that if_vinput simply queues the packet without sleeping, we
can call it from the smr critical section and skip taking and
releasing real refs with atomic ops. this is a win if the vlan
parent interfaces are multiq and doing a lot of packets across
multiple softnet threads because the cacheline the refcnt is on
doesnt have to be modified, hopefully it can be shared (or not used
at all) instead.
[RISCV] Prevent unnecessary calls to hasAllBUsers/AllHUsers. NFC (#172768)
Make sure the constant isn't already sign extended before calling these
functions.
Also add some elses to prevent checks where we already know the value
has been optimized.
[IR] Update `PHINode::removeIncomingValueIf()` to use the swap strategy like `PHINode::removeIncomingValue()` (#172639)
As suggested in https://github.com/llvm/llvm-project/pull/171963, update
`PHINode::removeIncomingValueIf()` to use the swap strategy too.