summaryrefslogtreecommitdiffstats
path: root/sys/i386
Commit message (Collapse)AuthorAgeFilesLines
* Improve get_pv_entry()'s handling of low-memory conditions. After pagealc2007-11-301-31/+21
| | | | | | | | | | | | | allocation fails and pv entries are reclaimed, there may be an unused pv entry in a pv chunk that survived the reclamation. However, previously, after reclamation, get_pv_entry() did not look for an unused pv entry in a surviving pv chunk; it simply retried the page allocation. Now, it does look for an unused pv entry before retrying the page allocation. Note: This only applies to RELENG_7. Earlier branches use a different pv entry allocator. MFC after: 6 weeks
* Don't use plain "ret" instructions at targets of jump instructions,bde2007-11-291-2/+2
| | | | | | | | | | | | | | | | | | | | | since the branch caches on at least Athlon XP through Athlon 64 CPU's don't understand such instructions and guarantee a cache miss taking at least 10 cycles. Use the documented workaround "ret $0" instead ("nop; ret" also works, but "ret $0" is probably faster on old CPUs). Normal code (even asm code) doesn't branch to "ret", since there is usually some cleanup to do, but the __mcount, .mcount and .mexitcount entry points were optimized too well to have the minimum number of instructions (3 instructions each if profiling is not enabled) and they did this. I didn't see a significant number of cache misses for .mexitcount, but for the shared "ret" for __mcount and .mcount I observed cache misses costing 26 cycles each. For a send(2) syscall that makes about 70 function calls, the cost of these cache misses alone increased the syscall time from about 4000 cycles to about 7000 cycles. 4000 is for a profiling (GUPROF) kernel with profiling disabled; after this fix, configuring profiling only costs about 600 cycles in the 4000, which is consistent with almost perfect branch prediction in the mcounting calls.
* Remove entry points for -finstrument functions since they are currentlybde2007-11-291-4/+0
| | | | | | | | unused except to obfuscate disassemblies. -mprofiler-epilogue is currently with gcc-4 (it does too little), but -finstrument-functions is broken in a different way (it does too much). amd64 version: meger whitespace fixes from i386 version.
* MFamd64: 1.109 of pci_cfgreg.c which changes pci_cfgdisable() into a nopjhb2007-11-281-2/+6
| | | | | | for type #1 similar to what other OS's do. MFC after: 3 days
* Adjust the code to probe for the PCI config mechanism to use.jhb2007-11-281-25/+25
| | | | | | | | | | | | | | - On amd64, just assume type #1 is always used. PCI 2.0 mandated deprecated type #2 and required type #1 for all future bridges which was well before amd64 existed. - For i386, ignore whatever value was in 0xcf8 before testing for type #1 and instead rely on the other tests to determine if type #1 works. Some newer machines leave garbage in 0xcf8 during boot and as a result the kernel doesn't find PCI at all (which greatly confuses ACPI which expects PCI to exist when PCI busses are in the namespace). MFC after: 3 days Discussed with: scottl
* Make ADAPTIVE_GIANT as the default in the kernel and remove the option.attilio2007-11-282-2/+0
| | | | | | | | | | Currently, Giant is not too much contented so that it is ok to treact it like any other mutexes. Please don't forget to update your own custom config kernel files. Approved by: cognet, marcel (maintainers of arches where option is not enabled at the moment)
* Remove the 'needbounce' variable from the _bus_dmamap_load_buffer()jhb2007-11-271-9/+4
| | | | | | | | | routine. It is not needed as the existing tests for segment coalescing already handle bounced addresses and it prevents legal segment coalescing in certain edge cases. MFC after: 1 week Reviewed by: scottl
* Implement read_default_ldt in linux_modify_ldt(). It copies out zeroedkib2007-11-261-0/+9
| | | | | | | | descriptor, like real Linux does. Tested by: Yuriy Tsibizov <yuriy.tsibizov at gmail com> Submitted by: rdivacky MFC after: 1 week
* MFP4: Add assembly language symbols used by hwpmc(4)'s callchain capture.jkoshy2007-11-231-0/+3
|
* Extend critical section coverage in the low-level interrupt handlers toscottl2007-11-211-1/+1
| | | | | | | | | | | | | | | | | | include the ithread scheduling step. Without this, a preemption might occur in between the interrupt getting masked and the ithread getting scheduled. Since the interrupt handler runs in the context of curthread, the scheudler might see it as having a such a low priority on a busy system that it doesn't get to run for a _long_ time, leaving the interrupt stranded in a disabled state. The only way that the preemption can happen is by a fast/filter handler triggering a schduling event earlier in the handler, so this problem can only happen for cases where an interrupt is being shared by both a fast/filter handler and an ithread handler. Unfortunately, it seems to be common for this sharing to happen with network and USB devices, for example. This fixes many of the mysterious TCP session timeouts and NIC watchdogs that were being reported. Many thanks to Sam Lefler for getting to the bottom of this problem. Reviewed by: jhb, jeff, silby
* Prevent the leakage of wired pages in the following circumstances:alc2007-11-171-0/+31
| | | | | | | | | | | | | | | | | | | | | | First, a file is mmap(2)ed and then mlock(2)ed. Later, it is truncated. Under "normal" circumstances, i.e., when the file is not mlock(2)ed, the pages beyond the EOF are unmapped and freed. However, when the file is mlock(2)ed, the pages beyond the EOF are unmapped but not freed because they have a non-zero wire count. This can be a mistake. Specifically, it is a mistake if the sole reason why the pages are wired is because of wired, managed mappings. Previously, unmapping the pages destroys these wired, managed mappings, but does not reduce the pages' wire count. Consequently, when the file is unmapped, the pages are not unwired because the wired mapping has been destroyed. Moreover, when the vm object is finally destroyed, the pages are leaked because they are still wired. The fix is to reduce the pages' wired count by the number of wired, managed mappings destroyed. To do this, I introduce a new pmap function pmap_page_wired_mappings() that returns the number of managed mappings to the given physical page that are wired, and I use this function in vm_object_page_remove(). Reviewed by: tegge MFC after: 6 weeks
* o Rename cpu_thread_setup() to cpu_thread_alloc() to bettermarcel2007-11-141-1/+8
| | | | | | | | | | | | | communicate that it relates to (is called by) thread_alloc() o Add cpu_thread_free() which is called from thread_free() to counter-act cpu_thread_alloc(). i386: Have cpu_thread_free() call cpu_thread_clean() to preserve behaviour. ia64: Have cpu_thread_free() call mtx_destroy() for the mutex initialized in cpu_thread_alloc(). PR: ia64/118024
* A bunch more files that should probably print out a thread namejulian2007-11-141-2/+2
| | | | instead of a process name.
* generally we are interested in what thread did something asjulian2007-11-141-2/+2
| | | | | | opposed to what process. Since threads by default have teh name of the process unless over-written with more useful information, just print the thread name instead.
* Apply the same sort of locking done injulian2007-11-141-0/+10
| | | | | | | | | | | | | | sys/dev/acpica/acpi.c rev 1.196 a while ago: Grab Giant around calls to DEVICE_SUSPEND/RESUME in acpi_SetSleepState(). If we are resuming non-MPSAFE drivers, they need Giant held for them. This may fix some obscure suspend/resume problems. It has fixed keyrate setting problems that were triggered by cardbus (MPSAFE) changing the ordering for syscons resume (non-MPSAFE). Also, add some asserts that Giant is held in our suspend/resume and shutdown methods. Submitted by: Marko Zec
* Drastically simplify the i386 pcpu backend by merging parts of thepeter2007-11-135-141/+25
| | | | | | | | | | | | | | | | | | amd64 mechanism over. Instead of page table hackery that isn't actually needed, just use 'struct pcpu __pcpu[MAXCPU]' for backing like all the other platforms do. Get rid of 'struct privatespace' and a while mess of #ifdef SMP garbage that set it up. As a bonus, this returns the 4MB of KVA that we stole to implement it the old way. This also allows you to read the pcpu data for each cpu when reading a minidump. Background information: Originally, pcpu stuff was implemented as having per-cpu page tables and magic to make different data structures appear at the same actual address. In order to share page tables, we switched to using the GDT and %fs/%gs to access it. But we still did the evil magic to set it up for the old way. The "idle stacks" are not used for the idle process anymore and are just used for a few functions during bootup, then ignored. (excercise for reader: free these afterwards).
* Link wpi(4) into the build.benjsc2007-11-081-0/+2
| | | | | | | | | | This includes: o mtree (for legal/intel_wpi) o manpage for i386/amd64 archs o module for i386/amd64 archs o NOTES for i386/amd64 archs Approved by: mlaier (comentor)
* Add comments explaining why all stores updating a non-kernel page tablealc2007-11-051-1/+22
| | | | | | | | | | | | must be globally performed before calling any of the TLB invalidation functions. With one exception, on amd64, this requirement was already met. Fix this one case. Also, as a clarification, change an existing atomic op into a release. (Suggested by: jhb) Reported and reviewed by: ups MFC after: 3 days
* Fix for the panic("vm_thread_new: kstack allocation failed") andkib2007-11-054-4/+15
| | | | | | | | | | | | | | | | | | | | silent NULL pointer dereference in the i386 and sparc64 pmap_pinit() when the kmem_alloc_nofault() failed to allocate address space. Both functions now return error instead of panicing or dereferencing NULL. As consequence, vmspace_exec() and vmspace_unshare() returns the errno int. struct vmspace arg was added to vm_forkproc() to avoid dealing with failed allocation when most of the fork1() job is already done. The kernel stack for the thread is now set up in the thread_alloc(), that itself may return NULL. Also, allocation of the first process thread is performed in the fork1() to properly deal with stack allocation failure. proc_linkup() is separated into proc_linkup() called from fork1(), and proc_linkup0(), that is used to set up the kernel process (was known as swapper). In collaboration with: Peter Holm Reviewed by: jhb
* fix build: when usb was enabled wireless drivers were brought in sosam2007-11-031-8/+0
| | | | remove the nodevice lines that elided wlan support
* Remove zyd as wireless is not supported on PAE.thompsa2007-11-031-0/+1
|
* Eliminate spurious "Approaching the limit on PV entries, ..."alc2007-11-031-6/+4
| | | | | | | | | | | | | | | warnings. Specifically, whenever vm_page_alloc(9) returned NULL to get_pv_entry(), we issued a warning regardless of the number of pv entries in use. (Note: The older pv entry allocator in RELENG_6 does not have this problem.) Reported by: Jeremy Chadwick Eliminate the direct call to pagedaemon_wakeup() by get_pv_entry(). This was a holdover from earlier times when the page daemon was responsible for the reclamation of pv entries. MFC after: 5 days
* Move nvram out of DEFAULTS. There really isn't a lot of justificationpeter2007-10-292-1/+3
| | | | | for consuming the memory. The module works just fine in the unlikely case that this is needed. It can still be compiled into a custom kernel.
* - Add constants for the different memory types in the SMAP table.jhb2007-10-282-3/+9
| | | | | - Use the SMAP types and constants from <machine/pc/bios.h> in the boot code rather than duplicating it.
* Split /dev/nvram driver out of isa/clock.c for i386 and amd64. I have notpeter2007-10-263-97/+4
| | | | | | | | refactored it to be a generic device. Instead of being part of the standard kernel, there is now a 'nvram' device for i386/amd64. It is in DEFAULTS like io and mem, and can be turned off with 'nodevice nvram'. This matches the previous behavior when it was first committed.
* Add usb serial devices by default. I'm tired of telling people how toimp2007-10-261-0/+12
| | | | do this that should know better :-).
* Update copyright attribution.jhb2007-10-241-1/+2
| | | | MFC after: 3 days
* Merge first in a series of TrustedBSD MAC Framework KPI changesrwatson2007-10-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | from Mac OS X Leopard--rationalize naming for entry points to the following general forms: mac_<object>_<method/action> mac_<object>_check_<method/action> The previous naming scheme was inconsistent and mostly reversed from the new scheme. Also, make object types more consistent and remove spaces from object types that contain multiple parts ("posix_sem" -> "posixsem") to make mechanical parsing easier. Introduce a new "netinet" object type for certain IPv4/IPv6-related methods. Also simplify, slightly, some entry point names. All MAC policy modules will need to be recompiled, and modules not updates as part of this commit will need to be modified to conform to the new KPI. Sponsored by: SPARTA (original patches against Mac OS X) Obtained from: TrustedBSD Project, Apple Computer
* Slightly cleanup the 'bootdev' concept on x86 by changing the variousjhb2007-10-241-12/+6
| | | | | | | | macros to treat the 'slice' field as a real part of the bootdev instead of as hack that spans two other fields (adaptor (sic) and controller) that are not used in any modern FreeBSD boot code. MFC after: 1 week
* Stop disabling USB in the PAE kernel config. The USB code has beenjhb2007-10-241-21/+0
| | | | | | | using bus_dma(9) for quite a while now and has been used on 64-bit archs as well. MFC after: 1 month
* Rename the kthread_xxx (e.g. kthread_create()) callsjulian2007-10-201-2/+2
| | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls.
* Fold multiple asm statements into one so that the compiler at a certainbz2007-10-202-50/+91
| | | | | | | | | | | | | | | optimization level (-march=pentium-mmx for example) does not insert intermediate ops which would trash the carry. Change both sys/i386/i386/in_cksum.c[1] and sys/i386/include/in_cksum.h. To my best understanding the same problem was addressed in rev. 1.16 of src/sys/i386/include/in_cksum.h for just a single function 3y ago. Reviewed by: jhb Submitted by: Zhouyi ZHOU <zhouzhouyi FreeBSD.org> (intial version of [1]) MFC after: 5 days PR: 115678, 69257
* Switch over to ULE as the default scheduler for amd64 and i386kensmith2007-10-191-1/+1
| | | | architectures.
* Backout sensors framework.netchild2007-10-151-8/+0
| | | | | Requested by: phk Discussed on: cvs-all
* Import it(4) and lm(4), supporting most popular Super I/O Hardware Monitors.netchild2007-10-141-0/+8
| | | | | | | | | Submitted by: Constantine A. Murenin <cnst@FreeBSD.org> Sponsored by: Google Summer of Code 2007 (GSoC2007/cnst-sensors) Mentored by: syrinx Tested by: many OKed by: kensmith Obtained from: OpenBSD (parts)
* Make the PCI code aware of PCI domains (aka PCI segments) so we canmarius2007-09-303-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | support machines having multiple independently numbered PCI domains and don't support reenumeration without ambiguity amongst the devices as seen by the OS and represented by PCI location strings. This includes introducing a function pci_find_dbsf(9) which works like pci_find_bsf(9) but additionally takes a domain number argument and limiting pci_find_bsf(9) to only search devices in domain 0 (the only domain in single-domain systems). Bge(4) and ofw_pcibus(4) are changed to use pci_find_dbsf(9) instead of pci_find_bsf(9) in order to no longer report false positives when searching for siblings and dupe devices in the same domain respectively. Along with this change the sole host-PCI bridge driver converted to actually make use of PCI domain support is uninorth(4), the others continue to use domain 0 only for now and need to be converted as appropriate later on. Note that this means that the format of the location strings as used by pciconf(8) has been changed and that consumers of <sys/pciio.h> potentially need to be recompiled. Suggested by: jhb Reviewed by: grehan, jhb, marcel Approved by: re (kensmith), jhb (PCI maintainer hat)
* Use the correct expanded name for SCTP.brueffer2007-09-261-1/+1
| | | | | | | PR: 116496 Submitted by: koitsu Reviewed by: rrs Approved by: re (kensmith)
* Change the management of cached pages (PQ_CACHE) in two fundamentalalc2007-09-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ways: (1) Cached pages are no longer kept in the object's resident page splay tree and memq. Instead, they are kept in a separate per-object splay tree of cached pages. However, access to this new per-object splay tree is synchronized by the _free_ page queues lock, not to be confused with the heavily contended page queues lock. Consequently, a cached page can be reclaimed by vm_page_alloc(9) without acquiring the object's lock or the page queues lock. This solves a problem independently reported by tegge@ and Isilon. Specifically, they observed the page daemon consuming a great deal of CPU time because of pages bouncing back and forth between the cache queue (PQ_CACHE) and the inactive queue (PQ_INACTIVE). The source of this problem turned out to be a deadlock avoidance strategy employed when selecting a cached page to reclaim in vm_page_select_cache(). However, the root cause was really that reclaiming a cached page required the acquisition of an object lock while the page queues lock was already held. Thus, this change addresses the problem at its root, by eliminating the need to acquire the object's lock. Moreover, keeping cached pages in the object's primary splay tree and memq was, in effect, optimizing for the uncommon case. Cached pages are reclaimed far, far more often than they are reactivated. Instead, this change makes reclamation cheaper, especially in terms of synchronization overhead, and reactivation more expensive, because reactivated pages will have to be reentered into the object's primary splay tree and memq. (2) Cached pages are now stored alongside free pages in the physical memory allocator's buddy queues, increasing the likelihood that large allocations of contiguous physical memory (i.e., superpages) will succeed. Finally, as a result of this change long-standing restrictions on when and where a cached page can be reclaimed and returned by vm_page_alloc(9) are eliminated. Specifically, calls to vm_page_alloc(9) specifying VM_ALLOC_INTERRUPT can now reclaim and return a formerly cached page. Consequently, a call to malloc(9) specifying M_NOWAIT is less likely to fail. Discussed with: many over the course of the summer, including jeff@, Justin Husted @ Isilon, peter@, tegge@ Tested by: an earlier version by kris@ Approved by: re (kensmith)
* Fix some entries in the locks static table of witness.attilio2007-09-201-1/+0
| | | | | | | | | | | | | | | | | | | | In particular: - smp_tlb_mtx is no longer used, so it is axed. - smp rendezvous lock isn't really a leaf spin-mutex. Its bad placement in the table, however, has been the source of a false positive LOR reporting with the dt_lock. However, smp rendezvous lock would have had sched_lock there for older lock, so it wasn't still a leaf lock. - allpmaps is only used in ia32 architecture, so it is inserted in the appropriate stub. Addictionally: - kse_zombie_lock is no longer present, so its definition is axed out. - zombie_lock doesn't need to have an exported symbol, so just let's it be declared as static. Tested by: kris Approved by: jeff (mentor) Approved by: re
* Fill in cr2 in the signal context from ksi->ksi_addr.kib2007-09-201-0/+2
| | | | | | | | | | Together with the sys/i386/i386/trap.c rev. 1.306 it fixes the PR. Submitted by: rdivacky Suggested by: jhb Sponsored by: Google Summer of Code 2007 PR: kern/77710 Approved by: re (kensmith)
* regen.dwmalone2007-09-183-3/+3
| | | | Approved by: re (kensmith)
* The kernel version of Linux statfs64 is actually supposed to takedwmalone2007-09-183-1/+15
| | | | | | | | | | | | | 3 arguments, but we had forgotten the second argument. Also make the Linux statfs64 struct depend on the architecture because it has an extra 4 bytes padding on amd64 compared to i386. The three argument fix is from David Taylor, the struct statfs64 stuff is my fault. With this patch I can install i386 Linux matlab on an amd64 machine. Submitted by: David Taylor <davidt_at_yadt.co.uk> Approved by: re (kensmith)
* Recognize the Soekris NET5501 and configure the error led.phk2007-09-181-3/+84
| | | | | | | Add watchdog(4) support by using the MFGPT0 in the Geode LX CX5536. (Supported range: 2^30 .. 2^44 ns = 1s ... 5h) Approved by: re (bmah)
* Fix an undefined symbol that as/ld neglected to flag as a problem. Itpeter2007-09-171-0/+1
| | | | | | | | | | | | | | | | | | was used in assembler code in such a way that no unresolved relocation records were generated, so ld didn't flag the problem. You can see this with an 'nm' of the kernel. There will be 'U MAXCPU' on SMP systems. The impact of this is that the intrcount/intrnames arrays do not have the intended amount of space reserved. This could lead to interesting problems due to the arrays being present in the middle of kernel code. An overflow would be rather interesting as executable code would be used as per-cpu incrementing interrupt counters. This fixes it for now by exporting MAXCPU to the assembler. A better fix might be to define these data structures in C - they're only referenced in the kernel from C code these days anyway. Approved by: re (kensmith)
* - Move all of the PS_ flags into either p_flag or td_flags.jeff2007-09-172-3/+2
| | | | | | | | | | | | | | - p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or previously the sched_lock. These bugs have existed for some time. - Allow swapout to try each thread in a process individually and then swapin the whole process if any of these fail. This allows us to move most scheduler related swap flags into td_flags. - Keep ki_sflag for backwards compat but change all in source tools to use the new and more correct location of P_INMEM. Reported by: pho Reviewed by: attilio, kib Approved by: re (kensmith)
* This is a follow-up, cleaning-up commit about recent changes involvingattilio2007-09-112-2/+2
| | | | | | | | | | | | | | | | topology foo functions. Working at the patch for topology problems in ia32/amd64 evicted some problems regarding functions ordering in the SI_SUB_CPU family of SYSINIT'ed subsystems. In order to avoid problems with new modified to involved functions, a correct ordering is not semantically specified for SI_SUB_CPU functions (for a larger view of the issue please visit: http://lists.freebsd.org/pipermail/freebsd-current/2007-July/075409.html ) Discussed with: peter Tested by: kris, Rui Paulo <rpaulo@FreeBSD.org> Approved by: jeff Approved by: re
* Fix a kernel panic due to a NULL pointer access on pc98.nyan2007-09-011-5/+7
| | | | | | | When any PnP device exists, isa_release_resource() is called with no activated resource. So a bushandle is not allocated yet. Approved by: re (kensmith)
* Regenerate.kib2007-08-283-4/+19
| | | | Approved by: re (kensmith)
* Implement fake linux sched_getaffinity() syscall to enable java to workkib2007-08-281-1/+2
| | | | | | | | | | with Linux 2.6 emulation. This shall be reimplemented once FreeBSD gets native scheduler affinity syscalls. Submitted by: rdivacky Reviewed by: jkim Sponsored by: Google Summer of Code 2007 Approved by: re (kensmith)
* Assign sizes to assembly language support functions.jkoshy2007-08-222-4/+43
| | | | Approved by: re (kensmith)
OpenPOWER on IntegriCloud