#
344905 |
|
08-Mar-2019 |
jhb |
MFC 340020: Don't enter DDB for fatal traps before panic by default.
Add a new 'debugger_on_trap' knob separate from 'debugger_on_panic' and make the calls to kdb_trap() in MD fatal trap handlers prior to calling panic() conditional on this new knob instead of 'debugger_on_panic'. Disable the new knob by default. Developers who wish to recover from a fatal fault by adjusting saved register state and retrying the faulting instruction can still do so by enabling the new knob. However, for the more common case this makes the user experience for panics due to a fatal fault match the user experience for other panics, e.g. 'c' in DDB will generate a crash dump and reboot the system rather than being stuck in an infinite loop of fatal fault messages and DDB prompts.
|
#
333204 |
|
03-May-2018 |
avg |
MFC r332752: set kdb_why to "trap" when calling kdb_trap from trap_fatal
This will allow to hook a ddb script to "kdb.enter.trap" event. Previously there was no specific name for this event, so it could only be handled by either "kdb.enter.unknown" or "kdb.enter.default" hooks. Both are very unspecific.
Having a specific event is useful because the fatal trap condition is very similar to panic but it has an additional property that the current stack frame is the frame where the trap occurred. So, both a register dump and a stack bottom dump have additional information that can help analyze the problem.
I have added the event only on architectures that have trap_fatal() function defined. I haven't looked at other architectures. Their maintainers can add support for the event later.
Sample script: kdb.enter.trap=bt; show reg; x/aS $rsp,20; x/agx $rsp,20
Sponsored by: Panzura
|
#
333200 |
|
03-May-2018 |
avg |
MFC r332730: don't check for kdb reentry in trap_fatal(), it's impossible
Sponsored by: Panzura
|
#
327551 |
|
04-Jan-2018 |
markj |
MFC r326774, r326811: Pass the trap frame to fasttrap hooks.
|
#
321343 |
|
21-Jul-2017 |
kib |
MFC r319873: Move struct syscall_args syscall arguments parameters container into struct thread.
|
#
316369 |
|
01-Apr-2017 |
jhibbits |
MFC r310146,r311912,r312369,r312617,r312614,r312659,r312974,r312977,r313005,r314826:
A series of Clang-related powerpc commits
r310146: Use the right bitwise OR operation for clearing single-step at trap time. r311912: Force all TOC references in asm to include '@toc' r312369: Use the explicit expanded form of cmp. r312617: Hide the 'MOREARGS' macro, it conflicts with contrib code, and is only used in one file. r312614: Don't pass -Wa,-many through clang, the integrated as doesn't support it. r312659: Avoid using non-zero argument for __builtin_frame_address(). r312974: Add a INTR_TRIG_INVALID, and use it in the powerpc interrupt code. r312977: Force the setting of bit 7 in the sysmouse packet byte 1 to be unsigned. r313005: Update CFLAGS for clang compatibility r314826: Clang in base now supports -mlongcall, so remove this hack
|
#
302408 |
|
07-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
298560 |
|
25-Apr-2016 |
jhibbits |
OR in the unsigned form of the MCAR lower register.
When ORing in a register_t to a wider integer (vm_paddr_t), it gets sign extended, so high addresses overwrite the upper word with all 0xf. Cast to the unsigned form (u_register_t), to avoid this problem, and get correct addresses printed.
|
#
295880 |
|
22-Feb-2016 |
skra |
As <machine/pmap.h> is included from <vm/pmap.h>, there is no need to include it explicitly when <vm/pmap.h> is already included.
Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D5373
|
#
293636 |
|
10-Jan-2016 |
nwhitehorn |
Use setjmp() instead of the identical-except-for-having-a-wrong-prototype setfault() when testing for faults. This should also help the compiler do the right thing with this complicated-to-optimize function.
|
#
292072 |
|
10-Dec-2015 |
jhibbits |
Follow up to r292071. Actually handle the Altivec Assist for book-e.
|
#
291463 |
|
30-Nov-2015 |
jhibbits |
Print machine check address for Book-E.
Bits in mcsr indicate if the address is valid, and whether it's a physical address or effective address.
Sponsored by: Alex Perez/Inertial Computing
|
#
287625 |
|
10-Sep-2015 |
kib |
Do not hold the process around the vm_fault() call from the trap()s. The only operation which is prevented by the hold is the kernel stack swapout for the faulted thread, which should be fine to allow.
Remove useless checks for NULL curproc or curproc->p_vmspace from the trap_pfault() wrappers on x86 and powerpc.
Reviewed by: alc (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
#
287242 |
|
28-Aug-2015 |
jhibbits |
Fix text alignment. mcsr was indented one too many spaces.
|
#
287188 |
|
27-Aug-2015 |
jhibbits |
Use the macro definition for EXC_PGM_TRAP, instead of the magic number.
|
#
286821 |
|
15-Aug-2015 |
jhibbits |
SRR1 and DSISR aren't pointers, print them as integers.
|
#
285227 |
|
07-Jul-2015 |
jhibbits |
style(9) cleanups.
Don't use PRIxPTR, these registers are 32-bits, cast to u_long instead.
Pointed out by: bde
|
#
285168 |
|
05-Jul-2015 |
bz |
Fix GENERIC64 and LINT64 powerpc builds after r285144.
|
#
285144 |
|
04-Jul-2015 |
jhibbits |
Add machine check register printing
This will print out the Memory Subsystem Status Register on MPC745x (G4+ class), and the Machine Check Status Register on Book-E class CPUs, to aid in debugging machine checks. Other relevant registers, for other CPUs, can be added in the future.
|
#
284214 |
|
10-Jun-2015 |
mjg |
Generalised support for copy-on-write structures shared by threads.
Thread credentials are maintained as follows: each thread has a pointer to creds and a reference on them. The pointer is compared with proc's creds on userspace<->kernel boundary and updated if needed.
This patch introduces a counter which can be compared instead, so that more structures can use this scheme without adding more comparisons on the boundary.
|
#
281262 |
|
08-Apr-2015 |
jhibbits |
Clean up printtrap a little.
* Sort exceptions * Add printing of ESR on book-e, and only print DSISR on AIM
|
#
281261 |
|
08-Apr-2015 |
jhibbits |
Add DTrace support for Book-E PowerPC.
Book-E got DTrace support for free with r281096&related. This adds the bits to the db_trap_glue() to support FBT.
Relnotes: Yes
|
#
281158 |
|
06-Apr-2015 |
jhibbits |
Fix the index for FAULTBUF_R13, missed during merge/cleanup.
|
#
281096 |
|
05-Apr-2015 |
jhibbits |
Unify Book-E and AIM trap.c
Summary: Book-E and AIM trap.c are almost identical, except for a few bits. This is step 1 in unifying them.
This also renumbers EXC_DEBUG, to not conflict with AIM vector numbers. Since this is the only one thus far that is used in the switch statement in trap(), it's the only one renumbered. If others get added to the switch, which conflict with AIM numbers, they should also be renumbered.
Reviewers: #powerpc, marcel, nwhitehorn
Reviewed By: marcel
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D2215
|
#
279601 |
|
04-Mar-2015 |
nwhitehorn |
The AIM DAR (data access fault address register) and Book-E DEAR registers have the same meaning and occupy the same memory address in the trapframe courtesy of union. Avoid some pointless #ifdef by spelling them both 'DAR' in the trapframe.
|
#
279189 |
|
22-Feb-2015 |
nwhitehorn |
Kernel support for the Vector-Scalar eXtension (VSX) found on the POWER7 and POWER8. This instruction set unifies the 32 64-bit scalar floating point registers with the 32 128-bit vector registers into a single bank of 64 128-bit registers. Kernel support mostly amounts to saving and restoring the wider version of the floating point registers and making sure that both scalar FP and vector registers are enabled once a VSX instruction is executed. get_mcontext() and friends currently cannot see the high bits, which will require a little more work.
As the system compiler (GCC 4.2) does not support VSX, making use of this from userland requires either newer GCC or clang.
Relnotes: yes Sponsored by: FreeBSD Foundation
|
#
276142 |
|
23-Dec-2014 |
markj |
Restore the trap type argument to the DTrace trap hook, removed in r268600. It's redundant at the moment since it can be obtained from the trapframe on the architectures where DTrace is supported, but this won't be the case with ARM.
|
#
275683 |
|
10-Dec-2014 |
andreast |
Fix build for powerpc(32|64) kernels.
|
#
275268 |
|
29-Nov-2014 |
jhibbits |
Add support for dtrace:fbt on modules for PowerPC
Summary: Revert the initial FBT-with-KDB changes for trap_subr*.S, and instead use the db_trap filter function to handle dtrace trap filtering. With this, the MMU is enabled by the support code, simplifying the codepath altogether.
Test Plan: Tested on my G4 PowerBook
Reviewers: #powerpc, nwhitehorn
Reviewed By: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D1207
MFC after: 3 weeks
|
#
269701 |
|
08-Aug-2014 |
jhibbits |
Set the si_code appropriately for exception-caused signals.
LLDB checks the si_code, and aborts if a code isn't known.
MFC after: 2 weeks Relnotes: yes
|
#
268880 |
|
19-Jul-2014 |
nwhitehorn |
Allow mappings of memory not previously direct-mapped by the kernel when calling mmap on /dev/mem and add a handler for the possible userland machine checks that may result. Remove some pointless and wrong copy/paste that has been in here for a decade as well.
This results in a /dev/mem with identical semantics to the x86 version.
MFC after: 1 week
|
#
268600 |
|
14-Jul-2014 |
markj |
Invoke the DTrace trap handler before calling trap() on amd64. This matches the upstream implementation and helps ensure that a trap induced by tracing fbt::trap:entry is handled without recursively generating another trap.
This makes it possible to run most (but not all) of the DTrace tests under common/safety/ without triggering a kernel panic.
Submitted by: Anton Rang <anton.rang@isilon.com> (original version) Phabric: D95
|
#
266827 |
|
28-May-2014 |
markj |
Commit the rest of the changes that were intended to be part of r266826.
X-MFC-with: r266826
|
#
259245 |
|
12-Dec-2013 |
jhibbits |
FBT now does work fully on PowerPC.
MFC after: 2 weeks
|
#
258696 |
|
27-Nov-2013 |
nwhitehorn |
badaddr() is used only in the grackle PCI driver, so move its definition there. Clean up a spurious setfault() declaration as well.
|
#
258541 |
|
25-Nov-2013 |
attilio |
- For kernel compiled only with KDTRACE_HOOKS and not any lock debugging option, unbreak the lock tracing release semantic by embedding calls to LOCKSTAT_PROFILE_RELEASE_LOCK() direclty in the inlined version of the releasing functions for mutex, rwlock and sxlock. Failing to do so skips the lockstat_probe_func invokation for unlocking. - As part of the LOCKSTAT support is inlined in mutex operation, for kernel compiled without lock debugging options, potentially every consumer must be compiled including opt_kdtrace.h. Fix this by moving KDTRACE_HOOKS into opt_global.h and remove the dependency by opt_kdtrace.h for all files, as now only KDTRACE_FRAMES is linked there and it is only used as a compile-time stub [0].
[0] immediately shows some new bug as DTRACE-derived support for debug in sfxge is broken and it was never really tested. As it was not including correctly opt_kdtrace.h before it was never enabled so it was kept broken for a while. Fix this by using a protection stub, leaving sfxge driver authors the responsibility for fixing it appropriately [1].
Sponsored by: EMC / Isilon storage division Discussed with: rstone [0] Reported by: rstone [1] Discussed with: philip
|
#
258424 |
|
21-Nov-2013 |
jhibbits |
Remove stale comment. The PID provider is handled elsewhere already.
|
#
258259 |
|
17-Nov-2013 |
nwhitehorn |
Unify handling of illegal instruction faults between AIM and Book-E. This allows FPU emulation on AIM as well as providing support for the mfpvr and lwsync instructions from userland on e500 cores. lwsync, in particular, is required for many C++ programs to work correctly.
MFC after: 1 week
|
#
257417 |
|
31-Oct-2013 |
markj |
Remove references to an unused fasttrap probe hook, and remove the corresponding x86 trap type. Userland DTrace probes are currently handled by the other fasttrap hooks (dtrace_pid_probe_ptr and dtrace_return_probe_ptr).
Discussed with: rpaulo
|
#
256543 |
|
15-Oct-2013 |
jhibbits |
Add fasttrap for PowerPC. This is the last piece of the dtrace/ppc puzzle. It's incomplete, it doesn't contain full instruction emulation, but it should be sufficient for most cases.
MFC after: 1 month
|
#
256542 |
|
15-Oct-2013 |
jhibbits |
Move the PMC handling to the first level interrupt handler where it belongs. Also add the pmc_hook use, to handle callchain tracing.
MFC after: 1 week
|
#
255165 |
|
02-Sep-2013 |
jhibbits |
Enable PMC interrupt handling, and fix a DTrace trap handling bug.
|
#
249129 |
|
05-Apr-2013 |
jhibbits |
Print out DSISR in a fatal DSI trap.
Sponsored by:
|
#
248457 |
|
18-Mar-2013 |
jhibbits |
Add FBT for PowerPC DTrace. Also, clean up the DTrace assembly code, much of which is not necessary for PowerPC.
The FBT module can likely be factored into 3 separate files: common, intel, and powerpc, rather than duplicating most of the code between the x86 and PowerPC flavors.
All DTrace modules for PowerPC will be MFC'd together once Fasttrap is completed.
|
#
242723 |
|
07-Nov-2012 |
jhibbits |
Implement DTrace for PowerPC. This includes both 32-bit and 64-bit.
There is one known issue: Some probes will display an error message along the lines of: "Invalid address (0)"
I tested this with both a simple dtrace probe and dtruss on a few different binaries on 32-bit. I only compiled 64-bit, did not run it, but I don't expect problems without the modules loaded. Volunteers are welcome.
MFC after: 1 month
|
#
240244 |
|
08-Sep-2012 |
attilio |
userret() already checks for td_locks when INVARIANTS is enabled, so there is no need to check if Giant is acquired after it.
Reviewed by: kib MFC after: 1 week
|
#
230123 |
|
14-Jan-2012 |
nwhitehorn |
Rework SLB trap handling so that double-faults into an SLB trap handler are possible, and double faults within an SLB trap handler are not. The result is that it possible to take an SLB fault at any time, on any address, for any reason, at any point in the kernel.
This lets us do two important things. First, it removes the (soft) 16 GB RAM ceiling on PPC64 as well as any architectural limitations on KVA space. Second, it lets the kernel tolerate poorly designed hypervisors that have a tendency to fail to restore the SLB properly after a hypervisor context switch.
MFC after: 6 weeks
|
#
228869 |
|
24-Dec-2011 |
jhibbits |
Implement hwpmc counting PMC support for PowerPC G4+ (MPC745x/MPC744x). Sampling is in progress.
Approved by: nwhitehorn (mentor) MFC after: 9.0-RELEASE
|
#
225474 |
|
11-Sep-2011 |
kib |
Inline the syscallenter() and syscallret(). This reduces the time measured by the syscall entry speed microbenchmarks by ~10% on amd64.
Submitted by: jhb Approved by: re (bz) MFC after: 2 weeks
|
#
223485 |
|
23-Jun-2011 |
nwhitehorn |
Use the ABI-mandated thread pointer register (r2 for ppc32, r13 for ppc64) instead of a PCPU field for curthread. This averts a race on SMP systems with a high interrupt rate where the thread looking up the value of curthread could be preempted and migrated between obtaining the PCPU pointer and reading the value of pc_curthread, resulting in curthread being observed to be the current thread on the thread's original CPU. This played merry havoc with the system, in particular with mutexes. Many thanks to jhb for helping me work this one out.
Note that Book-E is in principle susceptible to the same problem, but has not been modified yet due to lack of Book-E hardware.
MFC after: 2 weeks
|
#
217896 |
|
26-Jan-2011 |
dchagin |
Add macro to test the sv_flags of any process. Change some places to test the flags instead of explicit comparing with address of known sysentvec structures.
MFC after: 1 month
|
#
217341 |
|
13-Jan-2011 |
nwhitehorn |
Fix handling of NX pages on capable CPUs. Thanks to kib for prodding me in the right direction.
|
#
214749 |
|
03-Nov-2010 |
nwhitehorn |
Fix two mistakes on 32-bit systems. The slbmte code in syscall() is 64-bit only, and should be protected with an ifdef, and the no-execute bit in 32-bit set_user_sr() should be set before the comparison, not after, or it will never match.
|
#
214739 |
|
03-Nov-2010 |
nwhitehorn |
Clean up the user segment handling code a little more. Now that set_user_sr() itself caches the user segment VSID, there is no need for cpu_switch() to do it again. This change also unifies the 32 and 64-bit code paths for kernel faults on user pages and remaps the user SLB slot on 64-bit systems when taking a syscall to avoid some unnecessary segment exception traps.
|
#
214574 |
|
30-Oct-2010 |
nwhitehorn |
Restructure the way the copyin/copyout segment is stored to prevent a concurrency bug. Since all SLB/SR entries were invalidated during an exception, a decrementer exception could cause the user segment to be invalidated during a copyin()/copyout() without a thread switch that would cause it to be restored from the PCB, potentially causing the operation to continue on invalid memory. This is now handled by explicit restoration of segment 12 from the PCB on 32-bit systems and a check in the Data Segment Exception handler on 64-bit.
While here, cause copyin()/copyout() to check whether the requested user segment is already installed, saving some pipeline flushes, and fix the synchronization primitives around the mtsr and slbmte instructions to prevent accessing stale segments.
MFC after: 2 weeks
|
#
213456 |
|
05-Oct-2010 |
nwhitehorn |
Handle vector assist traps without a kernel panic, by setting denormalized values to zero. A correct solution would involve emulating vector operations on denormalized values, but this has little effect on accuracy and is much less complicated for now.
MFC after: 2 weeks
|
#
212722 |
|
16-Sep-2010 |
nwhitehorn |
Split the SLB mirror cache into two kinds of object, one for kernel maps which are similar to the previous ones, and one for user maps, which are arrays of pointers into the SLB tree. This changes makes user SLB updates atomic, closing a window for memory corruption. While here, rearrange the allocation functions to make context switches faster.
|
#
212715 |
|
15-Sep-2010 |
nwhitehorn |
Replace the SLB backing store splay tree used on 64-bit PowerPC AIM hardware with a lockless sparse tree design. This marginally improves the performance of PMAP and allows copyin()/copyout() to run without acquiring locks when used on wired mappings.
Submitted by: mdf
|
#
211515 |
|
19-Aug-2010 |
jhb |
Remove unused KTRACE includes.
|
#
209975 |
|
13-Jul-2010 |
nwhitehorn |
MFppc64:
Kernel sources for 64-bit PowerPC, along with build-system changes to keep 32-bit kernels compiling (build system changes for 64-bit kernels are coming later). Existing 32-bit PowerPC kernel configurations must be updated after this change to specify their architecture.
|
#
208453 |
|
23-May-2010 |
kib |
Reorganize syscall entry and leave handling.
Extend struct sysvec with three new elements: sv_fetch_syscall_args - the method to fetch syscall arguments from usermode into struct syscall_args. The structure is machine-depended (this might be reconsidered after all architectures are converted). sv_set_syscall_retval - the method to set a return value for usermode from the syscall. It is a generalization of cpu_set_syscall_retval(9) to allow ABIs to override the way to set a return value. sv_syscallnames - the table of syscall names.
Use sv_set_syscall_retval in kern_sigsuspend() instead of hardcoding the call to cpu_set_syscall_retval().
The new functions syscallenter(9) and syscallret(9) are provided that use sv_*syscall* pointers and contain the common repeated code from the syscall() implementations for the architecture-specific syscall trap handlers.
Syscallenter() fetches arguments, calls syscall implementation from ABI sysent table, and set up return frame. The end of syscall bookkeeping is done by syscallret().
Take advantage of single place for MI syscall handling code and implement ptrace_lwpinfo pl_flags PL_FLAG_SCE, PL_FLAG_SCX and PL_FLAG_EXEC. The SCE and SCX flags notify the debugger that the thread is stopped at syscall entry or return point respectively. The EXEC flag augments SCX and notifies debugger that the process address space was changed by one of exec(2)-family syscalls.
The i386, amd64, sparc64, sun4v, powerpc and ia64 syscall()s are changed to use syscallenter()/syscallret(). MIPS and arm are not converted and use the mostly unchanged syscall() implementation.
Reviewed by: jhb, marcel, marius, nwhitehorn, stas Tested by: marcel (ia64), marius (sparc64), nwhitehorn (powerpc), stas (mips) MFC after: 1 month
|
#
204197 |
|
22-Feb-2010 |
nwhitehorn |
Allow user programs to execute mfpvr instructions. Linux allows this, and some math-related software like GMP expects to be able to use it to pick a target appropriately.
MFC after: 1 week
|
#
199868 |
|
27-Nov-2009 |
alc |
Simplify the invocation of vm_fault(). Specifically, eliminate the flag VM_FAULT_DIRTY. The information provided by this flag can be trivially inferred by vm_fault().
Discussed with: kib
|
#
199669 |
|
22-Nov-2009 |
nwhitehorn |
Garbage collect some code that was never compiled in to handle Altivec during traps. It predates actual Altivec support and was never used.
|
#
199135 |
|
10-Nov-2009 |
kib |
Extract the code that records syscall results in the frame into MD function cpu_set_syscall_retval().
Suggested by: marcel Reviewed by: marcel, davidxu PowerPC, ARM, ia64 changes: marcel Sparc64 tested and reviewed by: marius, also sunv reviewed MIPS tested by: gonzo MFC after: 1 month
|
#
198722 |
|
31-Oct-2009 |
nwhitehorn |
Garbage collect set_user_sr(), which is declared static inline and never called.
|
#
191261 |
|
19-Apr-2009 |
nwhitehorn |
Fix a typo in the SRR1 comparison for program exceptions. While here, replace magic numbers with constants to keep this from happening again.
Without this fix, some programs would occasionally get SIGTRAP instead of SIGILL on an illegal instruction. This affected Altivec detection in pixman, and possibly other software.
Reported by: Andreas Tobler MFC after: 1 week
|
#
188860 |
|
20-Feb-2009 |
nwhitehorn |
Add Altivec support for supported CPUs. This is derived from the FPU support code, and also reducing the size of trapcode to fit inside a 32 byte handler slot.
Reviewed by: grehan MFC after: 2 weeks
|
#
179533 |
|
04-Jun-2008 |
grehan |
Add link register to fatal trap printout to better diagnose NULL function pointer derefs.
|
#
177091 |
|
12-Mar-2008 |
jeff |
Remove kernel support for M:N threading.
While the KSE project was quite successful in bringing threading to FreeBSD, the M:N approach taken by the kse library was never developed to its full potential. Backwards compatibility will be provided via libmap.conf for dynamically linked binaries and static binaries will be broken.
|
#
176742 |
|
02-Mar-2008 |
raj |
Unify and generalize PowerPC headers, adjust AIM code accordingly.
Rework of this area is a pre-requirement for importing e500 support (and other PowerPC core variations in the future). Mainly the following headers are refactored so that we can cover for low-level differences between various machines within PowerPC architecture:
<machine/pcpu.h> <machine/pcb.h> <machine/kdb.h> <machine/hid.h> <machine/frame.h>
Areas which use the above are adjusted and cleaned up.
Credits for this rework go to marcel@
Approved by: cognet (mentor) MFp4: e500
|
#
174599 |
|
14-Dec-2007 |
marcel |
Forced commit to record that this file was repocopied from src/sys/powerpc/powerpc and modified for its new location.
|
#
173601 |
|
14-Nov-2007 |
julian |
A bunch more files that should probably print out a thread name instead of a process name.
|
#
173600 |
|
14-Nov-2007 |
julian |
generally we are interested in what thread did something as 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.
|
#
171783 |
|
07-Aug-2007 |
marcel |
Remove redundant prototype.
Approved by: re (blanket)
|
#
171670 |
|
31-Jul-2007 |
marcel |
Fix backward compatibility of the "old" (i.e. FreeBSD6) lseek syscall. It was broken when a new lseek syscall was introduced. The problem is that we need to swap the 32-bit td_retval values for the __syscall indirect syscall when the actual syscall has a 32-bit return value. Hence, we need to exclude lseek(2). And this means the "old" lseek(2) as well -- which we didn't.
Based on a patch from: grehan@ Approved by: re (rwatson)
|
#
170291 |
|
04-Jun-2007 |
attilio |
Rework the PCPU_* (MD) interface: - Rename PCPU_LAZY_INC into PCPU_INC - Add the PCPU_ADD interface which just does an add on the pcpu member given a specific value.
Note that for most architectures PCPU_INC and PCPU_ADD are not safe. This is a point that needs some discussions/work in the next days.
Reviewed by: alc, bde Approved by: jeff (mentor)
|
#
167352 |
|
09-Mar-2007 |
mohans |
Over NFS, an open() call could result in multiple over-the-wire GETATTRs being generated - one from lookup()/namei() and the other from nfs_open() (for cto consistency). This change eliminates the GETATTR in nfs_open() if an otw GETATTR was done from the namei() path. Instead of extending the vop interface, we timestamp each attr load, and use this to detect whether a GETATTR was done from namei() for this syscall. Introduces a thread-local variable that counts the syscalls made by the thread and uses <pid, tid, thread syscalls> as the attrload timestamp. Thanks to jhb@ and peter@ for a discussion on thread state that could be used as the timestamp with minimal overhead.
|
#
163709 |
|
26-Oct-2006 |
jb |
Make KSE a kernel option, turned on by default in all GENERIC kernel configs except sun4v (which doesn't process signals properly with KSE).
Reviewed by: davidxu@
|
#
162361 |
|
16-Sep-2006 |
rwatson |
Add audit hooks for ppc, ia64 system call paths.
Reviewed by: marcel (ia64) Obtained from: TrustedBSD Project MFC after: 3 days
|
#
160801 |
|
28-Jul-2006 |
jhb |
Retire SYF_ARGMASK and remove both SYF_MPSAFE and SYF_ARGMASK. sy_narg is now back to just being an argument count.
|
#
160798 |
|
28-Jul-2006 |
jhb |
Now that all system calls are MPSAFE, retire the SYF_MPSAFE flag used to mark system calls as being MPSAFE: - Stop conditionally acquiring Giant around system call invocations. - Remove all of the 'M' prefixes from the master system call files. - Remove support for the 'M' prefix from the script that generates the syscall-related files from the master system call files. - Don't explicitly set SYF_MPSAFE when registering nfssvc.
|
#
160773 |
|
27-Jul-2006 |
jhb |
Unify the checking for lock misbehavior in the various syscall() implementations and adjust some of the checks while I'm here: - Add a new check to make sure we don't return from a syscall in a critical section. - Add a new explicit check before userret() to make sure we don't return with any locks held. The advantage here is that we can include the syscall number and name in syscall() whereas that info is not available in userret(). - Drop the mtx_assert()'s of sched_lock and Giant. They are replaced by the more general checks just added.
MFC after: 2 weeks
|
#
160764 |
|
27-Jul-2006 |
jhb |
Add missing ptrace(2) system-call stops to various syscall() implementations.
MFC after: 1 week
|
#
155455 |
|
08-Feb-2006 |
phk |
Simplify system time accounting for profiling.
Rename struct thread's td_sticks to td_pticks, we will need the other name for more appropriately named use shortly. Reduce it from uint64_t to u_int.
Clear td_pticks whenever we enter the kernel instead of recording its value as reference for userret(). Use the absolute value of td->pticks in userret() and eliminate third argument.
|
#
151316 |
|
14-Oct-2005 |
davidxu |
1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, most changes in MD code are trivial, before this change, trapsignal and sendsig use discrete parameters, now they uses member fields of ksiginfo_t structure. For sendsig, this change allows us to pass POSIX realtime signal value to user code.
2. Remove cpu_thread_siginfo, it is no longer needed because we now always generate ksiginfo_t data and feed it to libpthread.
3. Add p_sigqueue to proc structure to hold shared signals which were blocked by all threads in the proc.
4. Add td_sigqueue to thread structure to hold all signals delivered to thread.
5. i386 and amd64 now return POSIX standard si_code, other arches will be fixed.
6. In this sigqueue implementation, pending signal set is kept as before, an extra siginfo list holds additional siginfo_t data for signals. kernel code uses psignal() still behavior as before, it won't be failed even under memory pressure, only exception is when deleting a signal, we should call sigqueue_delete to remove signal from sigqueue but not SIGDELSET. Current there is no kernel code will deliver a signal with additional data, so kernel should be as stable as before, a ksiginfo can carry more information, for example, allow signal to be delivered but throw away siginfo data if memory is not enough. SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can not be caught or masked. The sigqueue() syscall allows user code to queue a signal to target process, if resource is unavailable, EAGAIN will be returned as specification said. Just before thread exits, signal queue memory will be freed by sigqueue_flush. Current, all signals are allowed to be queued, not only realtime signals.
Earlier patch reviewed by: jhb, deischen Tested on: i386, amd64
|
#
148568 |
|
30-Jul-2005 |
grehan |
Temporary band-aid to fix hang when a process exec's Altivec instructions.
trap_subr.S: declare a stub for the a-unavailable trap that does an absolute jump to the vector-assist trap. This is due to the fact that the vec-unavail trap doesn't start at a 256-byte boundary, so the trick of masking the bottom 8 bits of the link register to identify the interrupt doesn't work, so let the vec-assist case handle Altivec-disabled for the time being.
Note that this will be fixed in the future with a much smaller vector code-stub (< 16 bytes) that will allow use of strange vector offsets that are also present in 4xx processors, and also allow smaller differences in vector codepaths on the G5.
trap.c: Treat altivec-unavailable/assist process traps as SIGILL. Not quite correct, since altivec-assist should really be a panic, but it is fine for the moment due to the above measure.
machdep.c Install the stub code for the altivec-unavailable trap, and the standard trap code at the altivec-assist.
Reported by: Andreas Tobler <toa at pop agri ch> MFC after: 3 days
|
#
145343 |
|
20-Apr-2005 |
ps |
Don't enter the debugger if KDB_UNATTENDED is set or if debug.debugger_on_panic=0.
MFC after: 2 weeks
|
#
144971 |
|
12-Apr-2005 |
jhb |
Use PCPU_LAZY_INC() for cnt.v_{intr,trap,syscalls} rather than atomic operations in some places and simple non-per CPU math in others.
|
#
143633 |
|
15-Mar-2005 |
grehan |
Include <sys/signalvar.h> for trapsignal prototype.
|
#
139825 |
|
07-Jan-2005 |
imp |
/* -> /*- for license, minor formatting changes
|
#
138129 |
|
27-Nov-2004 |
das |
Don't include sys/user.h merely for its side-effect of recursively including other headers.
|
#
134571 |
|
31-Aug-2004 |
julian |
Remove an unneeded argument.. The removed argument could trivially be derived from the remaining one. That in turn should be the same as curthread, but it is possible that curthread could be expensive to derive on some syste,s so leave it as an argument. Having both proc and thread as an argumen tjust gives an opportunity for them to get out sync.
MFC after: 3 days
|
#
134568 |
|
31-Aug-2004 |
julian |
Remove sched_free_thread() which was only used in diagnostics. It has outlived its usefulness and has started causing panics for people who turn on DIAGNOSTIC, in what is otherwise good code.
MFC after: 2 days
|
#
132994 |
|
02-Aug-2004 |
grehan |
Kernel traps were not being passed to trap_fatal in some circumstances.
Spotted by: gallatin
|
#
132074 |
|
12-Jul-2004 |
grehan |
Bring into KDB new order.
|
#
131867 |
|
09-Jul-2004 |
grehan |
- correctly set the return value for the copyin/out fault buffer to 1 so setfault would return correctly when a page fault was invalid (e.g. a syscall with a bad parameter).
This caused an endless DSI loop, seen when running sendmail which does a setlogin() call with a NULL pointer.
- introduce KTR_SYSC tracing. expose the syscallnames[] array to make the tracing more readable.
|
#
131698 |
|
06-Jul-2004 |
grehan |
- trailing white-space cleanup - add call to thread_user_enter for P_SA processes before trap processing ala all other arches
|
#
129416 |
|
19-May-2004 |
grehan |
trap_pfault() shouldn't be acquiring Giant. Found to blow up with MUTEX_PROFILING.
Submitted by: Suleiman Souhlal <refugee@segfaulted.com>
|
#
114305 |
|
30-Apr-2003 |
jhb |
Range check the syscall number before looking it up in the syscallnames[] array.
Submitted by: pho
|
#
113038 |
|
03-Apr-2003 |
obrien |
Use __FBSDID rather than rcsid[].
|
#
112883 |
|
31-Mar-2003 |
jeff |
- Change trapsignal() to accept a thread and not a proc. - Change all consumers to pass in a thread.
Right now this does not cause any functional changes but it will be important later when signals can be delivered to specific threads.
|
#
112429 |
|
20-Mar-2003 |
grehan |
Enable the FPU on first use per-thread and save state across context switches. Not as lazy as it could be. Changing FPU state with sigcontext still TODO.
fpu.c - convert some asm to inline C, and macroize fpu loads/stores swtch.S - call out to save/restore fpu routines trap.c - always call enable_fpu, since this shouldn't be called once the FPU has been enabled for a thread genassym.c - define for pcb fpu flag
|
#
111883 |
|
04-Mar-2003 |
jhb |
Replace calls to WITNESS_SLEEP() and witness_list() with equivalent calls to WITNESS_WARN().
|
#
111024 |
|
17-Feb-2003 |
jeff |
- Move ke_sticks, ke_iticks, ke_uticks, ke_uu, ke_su, and ke_iu back into the proc. These counters are only examined through calcru.
Submitted by: davidxu Tested on: x86, alpha, UP/SMP
|
#
110190 |
|
01-Feb-2003 |
julian |
Reversion of commit by Davidxu plus fixes since applied.
I'm not convinced there is anything major wrong with the patch but them's the rules..
I am using my "David's mentor" hat to revert this as he's offline for a while.
|
#
109918 |
|
27-Jan-2003 |
benno |
Use td->td_sticks, not td->td_kse->ke_sticks.
Forgotten by: davidxu
|
#
104435 |
|
03-Oct-2002 |
grehan |
Clean up ddb warnings/errors and enable in GENERIC
Approved by: benno Motivated by: gallatin
|
#
103607 |
|
19-Sep-2002 |
grehan |
- worked around 32-bit big-endian syscall return value problem - syscall register spills weren't copied in correctly - removed VM_PROT_READ from the fault type on write protect faults
Approved by: benno
|
#
99900 |
|
13-Jul-2002 |
mini |
Add additional cred_free_thread() calls that I had missed the first time.
Pointed out by: jhb
|
#
98727 |
|
24-Jun-2002 |
mini |
Remove unused diagnostic function cread_free_thread().
Approved by: alfred
|
#
98001 |
|
07-Jun-2002 |
jhb |
- Fixup / remove obsolete comments. - ktrace no longer requires Giant so do ktrace syscall events before and after acquiring and releasing Giant, respectively. - For i386, ia32 syscalls on ia64, powerpc, and sparc64, get rid of the goto bad hack and instead use the model on ia64 and alpha were we skip the actual syscall invocation if error != 0. This fixes a bug where if we the copyin() of the arguments failed for a syscall that was not marked MP safe, we would try to release Giant when we had not acquired it.
|
#
97398 |
|
28-May-2002 |
benno |
Remove an assertion as to whether the current thread already had the FPU or not. It may be desirable to put something similar back, but it's getting in the way in it's current form.
|
#
97397 |
|
28-May-2002 |
benno |
- Move macros that represent where syscall args are kept in a trapframe from trap.c to frame.h - Use the macros in vm_machdep.c:cpu_fork() to set up the trap frame of the new thread.
|
#
97395 |
|
28-May-2002 |
benno |
Remove the old prototype for kcopy. It's in cpu.h now.
|
#
97384 |
|
28-May-2002 |
benno |
Move the kcopy() function from trap.c to machdep.c. Add a prototype.
|
#
97347 |
|
27-May-2002 |
benno |
Print srr1 in printtrap()
Submitted by: Peter Grehan <peterg@ptree32.com.au>
|
#
96938 |
|
19-May-2002 |
benno |
Make this more FreeBSD-ish.
Requested by: jhb
|
#
96906 |
|
19-May-2002 |
benno |
- Do a quick style pass. - Correct the implementation of fix_unaligned to use a thread, not a proc. - GC some #if 0'd stuff.
|
#
96499 |
|
13-May-2002 |
benno |
FPU support.
Obtained from: NetBSD (portions)
|
#
96452 |
|
12-May-2002 |
benno |
More locking fixes.
|
#
96443 |
|
12-May-2002 |
benno |
Do the correct locking on processes for DSI and ISI traps.
Copied from: sparc64
|
#
96333 |
|
10-May-2002 |
benno |
Remove a debugging printf that escaped.
|
#
96255 |
|
09-May-2002 |
benno |
Update to newer trap code from NetBSD.
Obtained from: NetBSD
|
#
95564 |
|
27-Apr-2002 |
alc |
MFi386 1.222: Remove vm_map_growstack() and acquisition and release of Giant around vm_fault() in trap_pfault().
|
#
93452 |
|
30-Mar-2002 |
alc |
Use the MI vm_map_growstack() instead of the MD grow_stack() in trap(). Remove the MD grow_stack().
|
#
92916 |
|
21-Mar-2002 |
benno |
Collect all functions for copying to and from userspace into the one file.
This allows me to reimplement [sf]u{byte,word} as separate functions and not as calls to copy{in,out}.
|
#
92842 |
|
20-Mar-2002 |
alfred |
Remove __P.
Reveiwed by: benno
|
#
92824 |
|
20-Mar-2002 |
jhb |
Change the way we ensure td_ucred is NULL if DIAGNOSTIC is defined. Instead of caching the ucred reference, just go ahead and eat the decerement and increment of the refcount. Now that Giant is pushed down into crfree(), we no longer have to get Giant in the common case. In the case when we are actually free'ing the ucred, we would normally free it on the next kernel entry, so the cost there is not new, just in a different place. This also removse td_cache_ucred from struct thread. This is still only done #ifdef DIAGNOSTIC.
Tested on: i386, alpha
|
#
92520 |
|
17-Mar-2002 |
benno |
Lowercase all of the trap names.
|
#
92519 |
|
17-Mar-2002 |
benno |
Clean up and fix up copyin and copyout.
|
#
91504 |
|
28-Feb-2002 |
arr |
- Move a comment from being on the same line as a #ifdef to the line following it. This should have gone in the previous commit, but misviewed Bruce's patch.
Requested by: bde
|
#
91475 |
|
28-Feb-2002 |
arr |
- Fix panic() message and a couple style nits that snuck in from the recent diagnostics commit (rev. 1.84).
|
#
91090 |
|
22-Feb-2002 |
julian |
Add some DIAGNOSTIC code. While in userland, keep the thread's ucred reference in a shadow field so that the usual place to store it is NULL. If DIAGNOSTIC is not set, the thread ucred is kept valid until the next kernel entry, at which time it is checked against the process cred and possibly corrected. Produces a BIG speedup in kernels with INVARIANTS set. (A previous commit corrected it for the non INVARIANTS case already)
Reviewed by: dillon@freebsd.org
|
#
90895 |
|
19-Feb-2002 |
julian |
Add change to teh PPC to keep it in step with i386 and MI code
Pointy hat this direction please...
|
#
90643 |
|
13-Feb-2002 |
benno |
Complete rework of the PowerPC pmap and a number of other bits in the early boot sequence.
The new pmap.c is based on NetBSD's newer pmap.c (for the mpc6xx processors) which is 70% faster than the older code that the original pmap.c was based on. It has also been based on the framework established by jake's initial sparc64 pmap.c.
There is no change to how far the kernel gets (it makes it to the mountroot prompt in psim) but the new pmap code is a lot cleaner.
Obtained from: NetBSD (pmap code)
|
#
86067 |
|
04-Nov-2001 |
mp |
Clean up the trap handling code and make it consistent with the other platforms.
Submitted by: jhb
|
#
83870 |
|
24-Sep-2001 |
mp |
Catch up to recent removal of curpcb from globals.h.
|
#
81493 |
|
10-Aug-2001 |
jhb |
- Close races with signals and other AST's being triggered while we are in the process of exiting the kernel. The ast() function now loops as long as the PS_ASTPENDING or PS_NEEDRESCHED flags are set. It returns with preemption disabled so that any further AST's that arrive via an interrupt will be delayed until the low-level MD code returns to user mode. - Use u_int's to store the tick counts for profiling purposes so that we do not need sched_lock just to read p_sticks. This also closes a problem where the call to addupc_task() could screw up the arithmetic due to non-atomic reads of p_sticks. - Axe need_proftick(), aston(), astoff(), astpending(), need_resched(), clear_resched(), and resched_wanted() in favor of direct bit operations on p_sflag. - Fix up locking with sched_lock some. In addupc_intr(), use sched_lock to ensure pr_addr and pr_ticks are updated atomically with setting PS_OWEUPC. In ast() we clear pr_ticks atomically with clearing PS_OWEUPC. We also do not grab the lock just to test a flag. - Simplify the handling of Giant in ast() slightly.
Reviewed by: bde (mostly)
|
#
78983 |
|
29-Jun-2001 |
jhb |
Move ast() and userret() to sys/kern/subr_trap.c now that they are MI.
|
#
77957 |
|
10-Jun-2001 |
benno |
Bring in NetBSD code used in the PowerPC port.
Reviewed by: obrien, dfr Obtained from: NetBSD
|