Date: Thu, 30 Aug 2001 12:08:42 -0700 (PDT) From: Matt Dillon <dillon@earth.backplane.com> To: freebsd-current@freebsd.org Subject: heads-up - syscalls.master changes, MPSAFE comments, */*/trap.c:syscall() Message-ID: <200108301908.f7UJ8gq58543@earth.backplane.com>
next in thread | raw e-mail | index | archive | help
(repost, it didn't like me cross-posting to the -alpha and -ia64 lists. sigh). I'm going to be comitting the following changes soon: syscalls.master: (going in now) Instead of having an MPSAFE keyword, existing keywords such as STD can be augmented with an [M] prefix, e.g. MSTD instead of STD, to indicate that a system call is MP safe. This change is being made because over the next few days I will be pushing down Giant for all system calls in the entire system, and keeping MPSAFE will turn the various syscalls.master files into a mess. Eventually, months from now, the original keywords 'STD', 'COMPAT' and so forth... will no longer exist and will be deprecated. MPSAFE comments (going in now) All procedures which are MP safe will have the following comment: /* * (other comments) * MPSAFE */ procedure definition .... I will be adding the MPSAFE comment to system calls as I push Giant down. Do not remove these comments, and add them when appropriate. The comment simply means that the procedure may be called without Giant held (even if the procedure itself obtains Giant). Keep in mind that we cannot arbitrarily remove Giant from higher level routines just because the calls they make are all marked MPSAFE. There are atomicy issues that must still be addressed, such as file descriptor races and such. These comments are not carte-blanc to go on a Giant-removal binge. */*/trap.c:syscall[2]() function changes: (going in now) sv_prepsyscall() is now assumed to be MP SAFE, and it just happens to be that the one user of this vector (the linux emu code) IS MP safe and doesn't even need to obtain Giant. sv_transtrap() is now assumed to be MP SAFE, and it just happens to be that the one user of this vector (the linux emu code) IS MP safe and doesn't even need to obtain Giant. ktrsyscall() and ktrsysret() are now marked MP SAFE (I just pushed Giant down into them). The syscall[2]() code no longer obtains Giant in order to make these calls. trapsignal() is now marked MP SAFE (I just pushed Giant down into it), so syscall[2]() does not have to obtain Giant when making trapsignal() calls. I have removed calls to if (mtx_owned(&Giant) mtx_unlock(&Giant) ... instead syscall[2]() explicitly unlocks Giant if it previously obtained it, and then asserts that Giant is no longer owned. This is to catch broken system calls. The previous code hid broken system calls by silently unlocking a Giant that system call might have left locked. Giant Pushdown work: (ongoing work over the next week) Over the next few days, Giant will be pushed down for *ALL* (or nearly all) system calls. This will effect about a hundred source files. I will be doing this work piecemeal, adjusting the syscalls.master files and associated routines in chunks starting with the FreeBSD core system calls. Some of the system calls may wind up looking fairly weird, for example the system calls that already partially implement jhb's PROC lock code. John will be fixing those up in the coming days as he continues to work on the PROC lock. His work will allow several dozen signal and proc-related (e.g. setuid()) system calls to run without Giant. The pushdown work is going to bloat the codebase a bit, but it is a necessary step. I can't believe that NOBODY other then Alfred has done any work on the Giant syscall pushdown since I first introduced the MPSAFE syscalls.master keyword months ago! So don't complain now if you see a lot of commits from me! -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108301908.f7UJ8gq58543>