aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* Fix regression issue after r351616. Make sure the mbuf queue gets initialized.Hans Petter Selasky2019-09-021-0/+9
| | | | | | | | | Found by: gonzo@ MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=351692
* mips: fix some mcount nitsKyle Evans2019-09-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The symbol version for _mcount was removed 12 years ago in r169525 from gmon/Symbol.map, to be added to the per-arch Symbol.map. mips was overlooked in this, so _mcount has no symver. Add it back to where it should have been, rather than where it would go if it were added today, since we're correcting a historical mistake. Additionally, _mcount is getting thrown into .mdebug.abi32 in the llvm80/90 world as it's not getting explicitly thrown into .text, so do this now. This fixes the libc build that was previously failing due to relocations in .mdebug.abi32. This is specifically due to the way clang's integrated AS works and that they emit the .mdebug.abiNN section early in the process. An LLVM bug has been submitted[0] and an agreement has been made that the mips backend should switch to .text following .mdebug.abiNN for compatibility. [0] https://bugs.llvm.org/show_bug.cgi?id=43119 Reviewed by: imp, arichardson MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21435 Notes: svn path=/head/; revision=351681
* Extend uma_reclaim() to permit different reclamation targets.Mark Johnston2019-09-018-81/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The page daemon periodically invokes uma_reclaim() to reclaim cached items from each zone when the system is under memory pressure. This is important since the size of these caches is unbounded by default. However it also results in bursts of high latency when allocating from heavily used zones as threads miss in the per-CPU caches and must access the keg in order to allocate new items. With r340405 we maintain an estimate of each zone's usage of its (per-NUMA domain) cache of full buckets. Start making use of this estimate to avoid reclaiming the entire cache when under memory pressure. In particular, introduce TRIM, DRAIN and DRAIN_CPU verbs for uma_reclaim() and uma_zone_reclaim(). When trimming, only items in excess of the estimate are reclaimed. Draining a zone reclaims all of the cached full buckets (the previous behaviour of uma_reclaim()), and may further drain the per-CPU caches in extreme cases. Now, when under memory pressure, the page daemon will trim zones rather than draining them. As a result, heavily used zones do not incur bursts of bucket cache misses following reclamation, but large, unused caches will be reclaimed as before. Reviewed by: jeff Tested by: pho (an earlier version) MFC after: 2 months Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D16667 Notes: svn path=/head/; revision=351673
* Restrict the input domain set in cpuset_setdomain(2) to all_domains.Mark Johnston2019-09-011-3/+11
| | | | | | | | | | | | | | | | | | | | | | | To permit larger values of MAXMEMDOM, which is currently 8 on amd64, cpuset_setdomain(2) accepts a mask of size 256. In the kernel, domain set masks are 64 bits wide, but can only represent a set of MAXMEMDOM domains due to the use of the ds_order table. Domain sets passed to cpuset_setdomain(2) are restricted to a subset of their parent set, which is typically the root set, but before this happens we modify the input set to exclude empty domains. domainset_empty_vm() and other code which manipulates domain sets expect the mask to be a subset of all_domains, so enforce that when performing validation of cpuset_setdomain(2) parameters. Reported and tested by: pho Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21477 Notes: svn path=/head/; revision=351672
* makefs: share msdosfsmount.h between kernel msdosfs and makefsEd Maste2019-09-011-1/+3
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351665
* vnic: correct and simplify SIOCSIFFLAGSEd Maste2019-09-011-6/+6
| | | | | | | | | PR: 223573, 223575 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13028 Notes: svn path=/head/; revision=351664
* Remove CLANG_NO_IAS definitionEd Maste2019-09-011-2/+0
| | | | | | | | | CLANG_NO_IAS is not used anywhere in the tree. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351661
* netmap: import changes from upstream (SHA 137f537eae513)Vincenzo Maffione2019-09-016-75/+153
| | | | | | | | | | | - Rework option processing. - Use larger integers for memory size values in the memory management code. MFC after: 2 weeks Notes: svn path=/head/; revision=351657
* vfs: stop refing freed mount points in vop_stdgetwritemountMateusz Guzik2019-09-011-12/+18
| | | | | | | | | | | | | | The code used blindly ref based on an unsafely red address and then would backpedal if necessary. This was safe in terms of memory access since mounts are type-stable, but made for a potential a bug where the mount was reused and had the count reset to 0 before this code decreased it. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21411 Notes: svn path=/head/; revision=351656
* Fix initialization of top_fsn.Michael Tuexen2019-09-011-1/+0
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=351655
* Improve the handling of state cookie parameters in INIT-ACK chunks.Michael Tuexen2019-09-013-46/+65
| | | | | | | | | | | | | | | | | This fixes problem with parameters indicating a zero length or partial parameters after an unknown parameter indicating to stop processing. It also fixes a problem with state cookie parameters after unknown parametes indicating to stop porcessing. Thanks to Mark Wodrich from Google for finding two of these issues by fuzz testing the userland stack and reporting them in https://github.com/sctplab/usrsctp/issues/355 and https://github.com/sctplab/usrsctp/issues/352 MFC after: 3 days Notes: svn path=/head/; revision=351654
* Add support for TP-Link Archer T2U Nano.Jung-uk Kim2019-09-012-1/+3
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=351653
* nullfs: reduce areas protected by vnode interlock in null_lockMateusz Guzik2019-09-011-9/+10
| | | | | | | | | | | | | Similarly to the other routine stop taking the interlock for the lower vnode. The interlock for nullfs vnode is still taken to ensure stability of ->v_data. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21480 Notes: svn path=/head/; revision=351651
* posixshm: switch to OBJT_SWAP in advance of other changesKyle Evans2019-09-011-1/+1
| | | | | | | | | | | | | | | | | Future changes to posixshm will start tracking writeable mappings in order to support file sealing. Tracking writeable mappings for an OBJT_DEFAULT object is complicated as it may be swapped out and converted to an OBJT_SWAP. One may generically add this tracking for vm_object, but this is difficult to do without increasing memory footprint of vm_object and blowing up memory usage by a significant amount. On the other hand, the swap pager can be expanded to track writeable mappings without increasing vm_object size. This change is currently in D21456. Switch over to OBJT_SWAP in advance of the other changes to the swap pager and posixshm. Notes: svn path=/head/; revision=351650
* ARM kernel can get RAM regions three ways:Aleksandr Rybalko2019-08-311-0/+2
| | | | | | | | | | | | | | o from FDT; o from EFI; o from Linux Boot API (ATAG). U-Boot may pass RAM info all that 3 ways simultaneously. We do select between FDT and EFI, but not for ATAG. So this is not problem fix, but correctness check. MFC after: 2 weeks Notes: svn path=/head/; revision=351649
* zfs: fix snapshot dir destruction after introducion of VOP_NEED_INACTIVEMateusz Guzik2019-08-311-0/+1
| | | | | | | | | Reported by: lwhsu PR: 240221 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351642
* Improve function definition.Michael Tuexen2019-08-311-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=351641
* Improve the handling of illegal sequence number combinations in receivedMichael Tuexen2019-08-311-5/+15
| | | | | | | | | | | | | | data chunks. Abort the association if there are data chunks with larger fragement sequence numbers than the fragement sequence of the last fragment. Thanks to Mark Wodrich from Google who found this issue by fuzz testing the userland stack and reporting this issue in https://github.com/sctplab/usrsctp/issues/355 MFC after: 3 days Notes: svn path=/head/; revision=351638
* vfs: add a missing VNODE_REFCOUNT_FENCE_REL to v_incr_usecount_lockedMateusz Guzik2019-08-301-0/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351632
* Wrap a vlan's parent's if_output in a separate function.Matt Joras2019-08-301-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a vlan interface is created, its if_output is set directly to the parent interface's if_output. This is fine in the normal case but has an unfortunate consequence if you end up with a certain combination of vlan and lagg interfaces. Consider you have a lagg interface with a single laggport member. When an interface is added to a lagg its if_output is set to lagg_port_output, which blackholes traffic from the normal networking stack but not certain frames from BPF (pseudo_AF_HDRCMPLT). If you now create a vlan with the laggport member (not the lagg interface) as its parent, its if_output is set to lagg_port_output as well. While this is confusing conceptually and likely represents a misconfigured system, it is not itself a problem. The problem arises when you then remove the lagg interface. Doing this resets the if_output of the laggport member back to its original state, but the vlan's if_output is left pointing to lagg_port_output. This gives rise to the possibility that the system will panic when e.g. bpf is used to send any frames on the vlan interface. Fix this by creating a new function, vlan_output, which simply wraps the parent's current if_output. That way when the parent's if_output is restored there is no stale usage of lagg_port_output. Reviewed by: rstone Differential Revision: D21209 Notes: svn path=/head/; revision=351629
* avoid holding PCB mutex during copyin/copyout()Maksim Yevmenkin2019-08-302-89/+154
| | | | | | | | Reported by: imp, mms dot vanbreukelingen at gmail dot com Reviewed by: imp Notes: svn path=/head/; revision=351626
* Properly check for an interrupted cv_wait_sig().Mark Johnston2019-08-301-2/+2
| | | | | | | | | | | | The returned error number may be EINTR or ERESTART depending on whether or not the signal is supposed to interrupt the system call. Reported and tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351624
* vfs: tidy up assertions in vfs_subrMateusz Guzik2019-08-301-2/+8
| | | | | | | | | | | - assert unlocked vnode interlock in vref - assert right counts in vputx - print debug info for panic in vdrop Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351622
* xdma: avoid NULL deref in error caseEd Maste2019-08-301-2/+1
| | | | | | | | | Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351621
* qlxgbe: avoid NULL deref in error caseEd Maste2019-08-301-1/+1
| | | | | | | | | Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351620
* exynos5: avoid NULL deref in error caseEd Maste2019-08-301-1/+1
| | | | | | | | | | Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days MFC with: r351618 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351619
* exynos5: avoid NULL deref in error caseEd Maste2019-08-301-1/+1
| | | | | | | | | Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351618
* nullfs: use VOP_NEED_INACTIVEMateusz Guzik2019-08-301-4/+22
| | | | | | | | | Reviewed by: kib Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351617
* Use mbuf queue instead of ifqueue in USB network drivers.Gleb Smirnoff2019-08-304-8/+6
| | | | | | | Reviewed by: stevek Notes: svn path=/head/; revision=351616
* Allow mbuf queues to be unlimited.Gleb Smirnoff2019-08-301-1/+1
| | | | | | | | | There is number of legacy code that uses ifqueue without setting a limit on it first. Easier to allow for that rather than improve legacy drivers. Notes: svn path=/head/; revision=351615
* Remove unused VM page locking macros.Mark Johnston2019-08-291-5/+0
| | | | | | | | | | | | They were orphaned by r292373. Reviewed by: asomers MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21469 Notes: svn path=/head/; revision=351613
* Simplify bhyve vlapic ESR logic.John Baldwin2019-08-293-48/+31
| | | | | | | | | | | | | | | | | | | The bhyve virtual local APIC uses an instance-global flag to indicate when an error LVT is being delivered to prevent infinite recursion. Use a function argument instead to reduce the amount of instance-global state. This was inspired by reviewing the bhyve save/restore work, which saves a copy of the instance-global state for each vlapic. Smart OS bug: https://smartos.org/bugview/OS-7777 Submitted by: Patrick Mooney Reviewed by: markj, rgrimes Obtained from: SmartOS / Joyent Differential Revision: https://reviews.freebsd.org/D20365 Notes: svn path=/head/; revision=351609
* Take proper lock in ses_setphyspath_callback().Alexander Motin2019-08-295-4/+8
| | | | | | | | | | | | | | | XPT_DEV_ADVINFO call should be protected by the lock of the specific device it is addressed to, not the lock of SES device. In some weird case, probably with hardware violating standards, it sometimes caused NULL dereference due to race. To protect from it further, add lock assertion to *_dev_advinfo(). MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=351606
* ichsmb: defer smbus attach until interrupts are availableYuri Pankov2019-08-291-5/+2
| | | | | | | | | | | | This fixes a "timed sleep before timers are working" panic seen while attaching jedec_dimm(4) instances too early in the boot. Submitted by: ian Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D21452 Notes: svn path=/head/; revision=351604
* vnic: avoid NULL deref in error caseEd Maste2019-08-291-3/+2
| | | | | | | | | Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351603
* scsi_cd: whitespace cleanupAndriy Gapon2019-08-291-111/+110
| | | | | | | | | Remove trailing whitespace and fix mixed indentation. MFC after: 3 weeks Notes: svn path=/head/; revision=351601
* scsi_cd: ifdef out cdsize()Andriy Gapon2019-08-291-1/+3
| | | | | | | | | It was used only by the old cdcheckmedia(). MFC after: 3 weeks Notes: svn path=/head/; revision=351600
* scsi_cd: make the media check asynchronousAndriy Gapon2019-08-292-43/+554
| | | | | | | | | | | | This makes the media check process asynchronous, so we no longer block in cdstrategy() to check for media. PR: 219857 Obtained from: ken MFC after: 3 weeks Notes: svn path=/head/; revision=351599
* Rework v_object lifecycle for vnodes.Konstantin Belousov2019-08-2915-101/+43
| | | | | | | | | | | | | | | | | | | | | | | Current implementation of vnode_create_vobject() and vnode_destroy_vobject() is written so that it prepared to handle the vm object destruction for live vnode. Practically, no filesystems use this, except for some remnants that were present in UFS till today. One of the consequences of that model is that each filesystem must call vnode_destroy_vobject() in VOP_RECLAIM() or earlier, as result all of them get rid of the v_object in reclaim. Move the call to vnode_destroy_vobject() to vgonel() before VOP_RECLAIM(). This makes v_object stable: either the object is NULL, or it is valid vm object till the vnode reclamation. Remove code from vnode_create_vobject() to handle races with the parallel destruction. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21412 Notes: svn path=/head/; revision=351598
* UFS: stop reusing the vnode for reallocated inode.Konstantin Belousov2019-08-293-5/+29
| | | | | | | | | | | | | | | | | In ffs_valloc(), force reclaim existing vnode on inode reuse, instead of trying to re-initialize the same vnode for new purposes. This is done in preparation of changes to the vp->v_object lifecycle handling. A new FFSV_REPLACE flag to ffs_vgetf() directs the function to vgone(9) the vnode if found in vfs hash, instead of returning it. Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21412 Notes: svn path=/head/; revision=351597
* Fix qmath(3) build problems with GCC 8.Edward Tomasz Napierala2019-08-291-1/+1
| | | | | | | | | Discussed with: asomers Sponsored by: Klara Systems Differential Revision: https://reviews.freebsd.org/D21442 Notes: svn path=/head/; revision=351596
* Remove useless redefinition of NSFBUFS in i386/vm_machdep.c.Konstantin Belousov2019-08-291-4/+0
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351595
* Centralize __pcpu definitions.Konstantin Belousov2019-08-2926-111/+460
| | | | | | | | | | | | | | | | | | | | | | | | | Many extern struct pcpu <something>__pcpu declarations were copied/pasted in sources. The issue is that the definition is MD, but it cannot be provided by machine/pcpu.h due to actual struct pcpu defined in sys/pcpu.h later than the inclusion of machine/pcpu.h. This forced the copying when other code needed direct access to __pcpu. There is no way around it, due to machine/pcpu.h supplying part of struct pcpu fields. To work around the problem, add a new machine/pcpu_aux.h header, which should fill any needed MD definitions after struct pcpu definition is completed. This allows to remove copies of __pcpu spread around the source. Also on x86 it makes it possible to remove work arounds like OFFSETOF_CURTHREAD or clang specific warnings supressions. Reported and tested by: lwhsu, bcran Reviewed by: imp, markj (previous version) Discussed with: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21418 Notes: svn path=/head/; revision=351594
* zfs_ioc_snapshot: check user-prop permissions on snapshotted datasetsAndriy Gapon2019-08-291-10/+16
| | | | | | | | | | | | | | | | | | Previously, the permissions were checked on the pool which was obviously incorrect. After this change, zfs_check_userprops() only validates the properties without any permission checks. The permissions are checked individually for each snapshotted dataset. This was also committed to ZoL: zfsonlinux/zfs@e6203d2 Reported by: CyberSecure MFC after: 1 week Sponsored by: CyberSecure Notes: svn path=/head/; revision=351593
* Use get_pcpu() to fetch the current CPU's pcpu pointer.John Baldwin2019-08-282-8/+2
| | | | | | | | | | This avoids encoding knowledge about how pcpu objects are allocated and is also a few instructions shorter. MFC after: 2 weeks Notes: svn path=/head/; revision=351591
* cxgbe/t4_tom: Use the correct value of sndbuf in AIO Tx.Navdeep Parhar2019-08-281-4/+2
| | | | | | | | | This should have been part of r351540. Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=351590
* Fix AHCI Enclosure Management, broken by r351356.Alexander Motin2019-08-282-20/+24
| | | | | | | | ivars value of -1 was used to distinguish EM device, and r351356 left some wrong checks for it. Give EM device separate flag there instead. Notes: svn path=/head/; revision=351589
* tmpfs: use VOP_NEED_INACTIVEMateusz Guzik2019-08-281-0/+22
| | | | | | | | | | Reviewed by: kib Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21371 Notes: svn path=/head/; revision=351585
* vfs: add VOP_NEED_INACTIVEMateusz Guzik2019-08-286-0/+68
| | | | | | | | | | | | | | | | | | | | | vnode usecount drops to 0 all the time (e.g. for directories during path lookup). When that happens the kernel would always lock the exclusive lock for the vnode in order to call vinactive(). This blocks other threads who want to use the vnode for looukp. vinactive is very rarely needed and can be tested for without the vnode lock held. This patch gives filesytems an opportunity to do it, sample total wait time for tmpfs over 500 minutes of poudriere -j 104: before: 557563641706 (lockmgr:tmpfs) after: 46309603301 (lockmgr:tmpfs) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21371 Notes: svn path=/head/; revision=351584
* amd64: clean up cpu_switch.SMateusz Guzik2019-08-281-17/+14
| | | | | | | | | | | | | | | | - LK macro (conditional on SMP for the lock prefix) is unused - SETLK unnecessarily performs xchg. obtained value is never used and the implicit lock prefix adds avoidable cost. Barrier provided by it does not appear to be of any use. - the lock waited for is almost never blocked, yet the loop starts with a pause. Move it out of the common case. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19563 Notes: svn path=/head/; revision=351577