Commit graph

660 commits

Author SHA1 Message Date
cinap_lenrek f104cc9d79 usbehci: portreset timing
assert port reset for 50ms, not 10ms.
2013-08-30 16:00:03 +02:00
cinap_lenrek 12ecb3e568 usbehci: fix portreset.
Port Reset R/W. 1=Port is in Reset. 0=Port is not in Reset. Default = 0. When
software writes a one to this bit (from a zero), the bus reset sequence as defined in the
USB Specification Revision 2.0 is started. Software writes a zero to this bit to terminate
the bus reset sequence. Software must keep this bit at a one long enough to ensure the
reset sequence, as specified in the USB Specification Revision 2.0, completes. Note:
when software writes this bit to a one, it must also write a zero to the Port Enable bit.
Note that when software writes a zero to this bit there may be a delay before the bit
status changes to a zero. The bit status will not read as a zero until after the reset
has completed.
2013-08-27 19:01:41 +02:00
cinap_lenrek 43d3c87294 devproc: properly handle exclusive refcount for /proc/trace 2013-08-27 23:57:17 +02:00
cinap_lenrek 84109a3159 devshr, devaudio: openmode()/devopen() error handling 2013-08-27 23:27:46 +02:00
cinap_lenrek 52a84514ac devmouse: fix openmode() handling
openmode() can raise error with invalid mode passed, but we already
incremented the exclusive mouse refcount at that point! call openmode()
early to avoid this.
2013-08-27 23:26:30 +02:00
cinap_lenrek 808480f76b usbehci, usbuhci: paranoia
double the td abort delay and make sure the tsleep() isnt
shortened by a pending note. in that case, tsleep() would
raise error(Eintr); immidiately and would not sleep the
requested amount potentially cauing us to release active
dma memory too early! so we wrap the tsleep() call in a
while(waserror()) so we will at least wait the Abortdelay
amount if error is raised.

also, only try to idle the still active td's.

do not copy data in epio() when there was an error, theres
no reason to touch user buffer in that case.

for uhci, we also check that theres not more data in the
buffers than requested to avoid overflowing user buffer
in epio(). this should not happen but we'r paranoid.

for ehci, we also halt the queue head first in aborttds().
mark the queue heads as Qfree after unlinking and remove
some silly nil checks that are impossible.
2013-08-25 22:03:02 +02:00
cinap_lenrek aa671181e8 add ricoh pci sdmmc host controller driver for X230
the driver should work for standard sdhc
(see http://www.sdcard.org/) controllers,
but matches for the ricoh controller only
as it was the only one i have for testing.
2013-07-14 01:33:07 +02:00
cinap_lenrek 58f8d7874b alarm: run checkalarms() only on cpu0 (from eriks alarm-once patch) 2013-06-22 09:53:14 +02:00
cinap_lenrek 769fcc82ef devcons: change /dev/kmesg buffer back to normal 16K
this makes it consistent with the manual again.
2013-06-22 01:18:27 +02:00
cinap_lenrek d7c7c7e4b3 devsrv, devshr: wstat permissions
update permissions last in wstat so it will only get changed when there was
no error.
2013-06-18 22:09:40 +02:00
cinap_lenrek 4b9845d942 devshr: fix wstat, style
- same problem with wstat, if we error then owner has been already updated...
- avoid smalloc while holding qlock in wstat, do it before
- pikeshedd style...
2013-06-18 22:02:07 +02:00
cinap_lenrek b302cc1097 devsrv: fix wstat(), srvname(), avoid smalloc() while holding srv qlock, style
- wstat would half update the Srv data structure if name was too long
- srvname() walked the linked srv list without holding srv qlock
- dont access sp->chan while not holding srv qlock in srvopen()
- dont modify sp->owner while not holding srv qlock in srvcreate()
- avoid smalloc() allocations while holding srv qlock
- style pikeshedding, sorry
2013-06-17 21:58:38 +02:00
cinap_lenrek d84aeddee7 devmnt: add debug print for convS2M failing, suspecting this causing zero length writes 2013-06-16 06:16:43 +02:00
cinap_lenrek 177c175fda kernel: allow sysr1 debugging only for hostowner 2013-06-10 01:09:52 +02:00
cinap_lenrek 723018c1de merge 2013-05-28 23:42:59 +02:00
cinap_lenrek 8cce104fcb kernel: sysrfork abortion
when we fail to fork resources for the child due to resource
exhaustion, make the half forked child process call pexit()
to free the resources that where allocated and error out.
2013-05-28 23:41:54 +02:00
cinap_lenrek 71a3ab3f13 kernel: make imagereclaim() skip notext pages (prevent it from blowing the mount cache)
imagereclaim would happily uncache pages from the mountcache (port/cache.c)
without ever getting a Image* released from it. simple fix, just check for
p->image->notext but make sure todo it under the page lock :)
2013-05-27 03:26:53 +02:00
cinap_lenrek 44e4aad870 kernel: dont copy fpsave on fork, simplify freeing waitq in pexit(), remove unused semlock from Proc sturcure 2013-05-27 01:17:11 +02:00
cinap_lenrek 410d6bea6a devfs/devsd: fix waserror() and unused variable compiler problem
the compiler optimizes setting unused variables out, which is
problematic if they are used in waserror() handler which the
compiler isnt aware of. rearrange the code to avoid this problem.
2013-05-27 01:12:21 +02:00
cinap_lenrek c4153b7755 kernel: closechanq error
catch potential interrupt error from kproc(). this can happen when
we run out of processes, then newproc() will call rsrcwait()
which does tsleep(). if the process gets a note, this might
raise a interrupt error.
2013-05-27 01:09:34 +02:00
cinap_lenrek 24b908be8a kernel: image reclaim pauses
get a bit more verbose about process image exhaustion and make
imagreclaim() try to get at least one image on the freelist.

use rsrcwait() to notify the state, and call freebroken() in
case imagereclaim() couldnt free any images.
2013-05-27 01:04:53 +02:00
cinap_lenrek 3e567afed5 kernel: fix sysexec() error handling compiler problem, sysrendez() busyloop
the variables elem and file0 and commited are explicitely
set to avoid that they get freed in ther waserror() handlers.

but it turns out the compiler optimizes this out as he
thinks the variables arent used any further. (the compiler
is not aware of the waserror() / longjmp() semantics).

rearrange the code to account for this. instead of using
a local variable to check for point of no return (commited),
we use up->seg[SSEG] to figure it out.

for file0 and elem, we just rearrange the code. elem can be
checked in the error handler if it was already assigned to
up->text, and file0 is just free()'d after the poperror().

remove silly busy loop in sysrendez. it is not needed.
dequeueproc() will make sure that the process has come to
rest.
2013-05-27 00:59:43 +02:00
cinap_lenrek 257c7e958e keep fpregs always in sse (FXSAVE) format, adapt libmach and acid files for new format
we now always use the new FXSAVE format in FPsave structure and fpregs
file, converting back and forth in fpx87save() and fpx87restore().

document that fprestore() is a destructive operation now.

change fp register definition in libmach and adapt fpr() acid funciton.

avoid unneccesary copy of fpstate and fpsave in sysfork(). functions
including syscalls do not preserve the fp registers and copying fpstate
from the current process would mean we had to fpsave(&up->fpsave); first.
simply not doing it, new process starts in FPinit state.
2013-05-26 22:41:40 +02:00
cinap_lenrek 92b550d665 kernel: prevent alarm(2) from returning instantly when the tick timer wraps. (from erik quanstros alarmwrap patch) 2013-05-21 19:31:41 +02:00
cinap_lenrek 8a3a36fc05 kernel: make allocb() wait instead of panic() when possible
as long as our process doesnt hold any locks or ilocks, we
can try to wait for the memory to become available instead of
panicing.
2013-05-21 02:29:46 +02:00
cinap_lenrek 18b8ae56e8 use resrcwait() when waiting for memory to become available
use resrcwait() when waiting for memory to become available. randomize
the sleep time and properly restore old process status in case tsleep()
gets interrupted.
2013-05-20 23:55:38 +02:00
cinap_lenrek f97798e710 devsd: don't raise Enomem error if sdmalloc() fails, instead wait for the memory to become available
filesystems do not handle i/o errors well (cwfs will abandon the blocks),
and temporary exhaustion of kernel memory (because of too many i/o's in
parallel) causes read and write on the partition to fail.

i think it is better to wait for the memory to become available in
this case. the single allocation is at max SDmaxio bytes, which makes
it likely to become available. if we havnt even enought fo that, then
rebooting the machine would be the best option. (aux/reboot)
2013-05-19 20:59:55 +02:00
cinap_lenrek 3cccb8fb12 devaoe: avoid panic on malloc() error by using smalloc() instead. 2013-05-12 19:04:07 +02:00
cinap_lenrek 25bc4e84e9 devmnt: fix mount device leak and allocation error handling in mntversion()
the fist problem is that qopen() might return nil and that kstrdup() will
sleep, so we should try to avoid holding the mntalloc lock. so we move
the kstrdup() and qopen() calls before the Mnt allocation, and properly
recover the memory if we fail later.

the second problem was that we error(Eshort) after we already created the Mnt
when returnlen < sizeof(f.version). this check has to happen *before* we
even attempt to allocate the Mnt structures. note that we only copy the
version string once everything is in the clear, so the semantics of the
user buffer not being modified in case of error is not changed.

a little cleanup in muxclose(), getting rid of mntptfree()...
2013-05-11 20:54:50 +02:00
cinap_lenrek 78794f03dd devsd: initialize unit->sense[0] in sdsetsense() (from erik quanstroms 9atom) 2013-05-02 23:12:37 +02:00
cinap_lenrek d0bb0f7757 chan: fix potential path leak on clone in namec() (from erik quanstroms 9atom) 2013-05-01 21:56:02 +02:00
cinap_lenrek 91818e7081 devpipe: fix channel and queue leaks (from erik quanstroms 9atom) 2013-05-01 19:03:56 +02:00
cinap_lenrek 0124d865a6 aoe: updating aoe driver from erik quanstros 9atom
1  the config string was grabbed Aoehsz too far into the packet due to using the wrong pointer to start.
  2  never accept a response with tag Tmgmt or Tfree.
  3  defend against "malicious" responses; ones with a response Aoehdr.type != request Aoehdr.type. this previously could
 cause the initiator to crash.
  4  vendor commands were improperly filtered out.
2013-05-01 18:50:07 +02:00
cinap_lenrek d4414b3959 devloopback: fix potential channel leak on allocation error (from eriks 9atom) 2013-05-01 18:31:13 +02:00
cinap_lenrek 4fcc5efce5 mouse: fix cursor redraw to prevent screen blanking (thanks erik) 2013-04-16 18:52:49 +02:00
cinap_lenrek c31c4ca7b3 devmouse: remove unneeded reference to kerndate 2013-04-14 18:28:55 +02:00
cinap_lenrek 3045d63969 reduce software cursor flickering
the software cursor starts flickering and reacts bumby if a process
spends most of its time with drawlock acquired because the timer interrupt
thats supposed to redraw the cursor fails to acquire the lock at the time
the timer fires.

instead of trying to draw the cursor on the screen from a timer interrupt
30 times per second, devmouse now creates a process calling cursoron() and
cursoroff() when the cursor needs to be redrawn. this allows the swcursor
to schedule a redraw while holding the drawlock in swcursoravoid() and
cursoron()/cursoroff() are now able to wait for a qlock (drawlock) because
they get called from process context.

the overall responsiveness is also improved with this change as the cursor
redraw rate isnt limited to 30 times a second anymore.
2013-04-14 16:28:54 +02:00
cinap_lenrek 800670da4e usbehci: align page td buffer for >16K transfers, fix isohsinit()
from ehci spec:

The buffer pointer list in the qTD is long enough to support a maximum
transfer size of 20K bytes. This case occurs when all five buffer pointers
are used and the first offset is zero. A qTD handles a 16Kbyte buffer
with any starting buffer alignment.
2013-04-12 22:14:32 +02:00
cinap_lenrek f37465fd7f sysexec: fix possible segment overlap with temporary stack
the kernel uses fixed area (TSTKTOP, TSTKSIZ) of the address
space to temporarily map the new stack segment for exec. for
386 and arm, this area was right below the stack segment which
has the problem that the program can map arbitrary segments
there (even readonly).

alpha and ppc dont have this problem as they map the temporary
exec stack *above* the user reachable stack segement and segattach
prevents one from mapping anything above or overlaping the stack.

lots of arch code assumes USTKTOP being the end of userspace
address space and changing this to TSTKTOP would work, but results
in lots of hard to test changes.

instead, we'r going to map the temporary stack programmatically
finding a hole in the address space where to map it. we also lift
the size limitation for arguments and allow arguments to fill
the whole new stack segement.

the TSTKTOP and TSTKSIZ are not used anymore so they where removed.

references:

http://9fans.net/archive/2013/03/203
http://9fans.net/archive/2013/03/202
http://9fans.net/archive/2013/03/197
http://9fans.net/archive/2013/03/195
http://9fans.net/archive/2013/03/181
2013-03-16 02:37:07 +01:00
cinap_lenrek 5bcc932168 netif: fix stat() on "stats" and "ifstats" files in network interface
the kernel would go into endless loop when stating "stats" and "ifstats"
files and the network interface having no connections, or otherwise return
wrong stat info.
2013-02-21 16:10:28 +01:00
cinap_lenrek 9ba9b846ee etheriwl: add /lib/firmware to bootfs.paq proto file 2013-02-10 05:04:31 +01:00
cinap_lenrek d41f67c2b9 audio: fix delay control, increase default buffer delay to 40ms
just doing a single sleep isnt enougth, as we get woken
up for every block!
2013-02-01 15:23:38 +01:00
cinap_lenrek 5a93a2a983 usbehci: remove panic() calls from interrupts if stuff isnt ready (spurious interrupts?) 2013-01-31 23:43:04 +01:00
cinap_lenrek c1cb685a32 audioac97: fix inverted recgain control, init to zero recgain
some controls are inverted. we reflect this by specifying
negative range in the volume table now and let genaudiovolread()
and genaudiovolwrite() do the conversion.
2013-01-27 17:20:42 +01:00
cinap_lenrek 43e09c468b omap: update omap kernel (from sources)
refactors of the usb ehci code and adds vfp support
2013-01-26 17:32:08 +01:00
cinap_lenrek 44eb643cb2 devuart: export uartenable() 2013-01-26 17:26:28 +01:00
cinap_lenrek 7592fa3e68 kernel: add portable uncached memory allocator (ucalloc) (from sources) 2013-01-26 17:25:23 +01:00
cinap_lenrek 14d663b169 kernel: add portable sd mmc interface (from sources) 2013-01-26 17:06:28 +01:00
cinap_lenrek e4875c1ae7 audiohda: first attempt on audio recording support for intel hda audio, distinguish mode in audio code 2013-01-19 01:12:39 +01:00
cinap_lenrek 6a0e85ad9c audioac97: audio recording 2013-01-18 13:12:41 +01:00
cinap_lenrek aa0627162b remove non standard COM3 (eia2) serial port from i8250 uart.
access to non standard serial port COM3 at i/o port 0x200 causes
kernel panic on some machines (Toshiba Sattelite 1415-S115). also,
some machines have gameport at 0x200.

i readded uartisa to the pcf and pccpuf kernel configurations so
one can use plan9.ini to add non standard uarts like:

uart2=type=isa port=0x200 irq=5
2013-01-13 10:23:31 +01:00
cinap_lenrek 77438f99c8 devtls: fix hmac buffer size for SHA1 hashes (from erik)
the buffer isn't big enough for SHA1 hashes, which are larger than MD5
hashes.
2013-01-09 06:39:20 +01:00
cinap_lenrek 8c81499659 scsi: do only 36 byte inquiry
some devices freeze up with inqiry allocation length
other than 36 bytes. as we do not really care about
the vendor specific part of the inquiry, lets only do
36 byte inquiry for now.
2013-01-03 20:46:25 +01:00
cinap_lenrek 7d8664db07 devmouse: deduplicate some code by using absmousetrack() 2013-01-03 16:05:06 +01:00
cinap_lenrek 6cadd03bbe fix utf and rune handling in preparation for 32bit runes 2012-12-31 21:09:46 +01:00
cinap_lenrek 4a4c8218ee devsd: fix possible sdbio() race with inquiry data changing (due to ahci hotplug)
the unit inquiry data might change in case the drive got pulled
with ahci. so keep track if we locked the ctl in a local stack
variable instead of relying on that the inquiry data stays the
same.
2012-12-26 17:53:12 +01:00
cinap_lenrek 5a138029db move devusb to port
moved devusb to port, shifting the responsibility of how
to enable interrupts to the arch specific hci driver.
2012-12-06 18:53:17 +01:00
cinap_lenrek 0750687012 move usb ethernet in bootfs.paq 2012-12-05 13:53:34 +01:00
cinap_lenrek 96cc3eb2ee devtls: add support for aes_128_cbc and aes_256_cbc (import from sources) 2012-12-04 10:53:53 +01:00
cinap_lenrek b296b96c68 devssl: handle bad secretin/secretout ctl arguments (import from sources) 2012-12-04 10:52:42 +01:00
cinap_lenrek b142e2a308 devpipe: import pipe wstat() support to change permissions (import from sources) 2012-12-04 10:40:08 +01:00
cinap_lenrek a8fc4ddc6d usbehci: route ports to all ehci controllers, not just the first
i belive the seizing up was a side effect of broken
bios handover. ehci will not work on the other controllers
if we do not route the ports to them.
2012-11-28 07:35:28 +01:00
cinap_lenrek 4b4070a8b9 ratrace: fix race conditions and range check
the syscallno check in syscallfmt() was wrong. the unsigned
syscall number was cast to an signed integer. so negative
values would pass the check provoking bad memory access from
kernel. the check also has an off by one. one has to check
syscallno >= nsyscalls instead of syscallno > nsyscalls.

access to the p->syscalltrace string was not protected
from modification in devproc. you could awake the process
and cause it to free the string giving an opportunity for
the kernel to access bad memory. or someone could kill the
process (pexit would just free it).

now the string is protected by the usual p->debug qlock. we
also keep the string arround until it is overwritten again
or the process exists. this has the nice side effect that
one can inspect it after the process crashed.

another problem was that our validaddr() would error() instead
of pexiting the current process. the code was changed to only
access up->s.args after it was validated and copied instead of
accessing the user stack directly. this also prevents a sneaky
multithreaded process from chaning the arguments under us.

in case our validaddr() errors, we cannot assume valid user
stack after the waserror() if block. use up->s.arg[0] for the
noted() call to avoid bad access.
2012-11-23 20:27:09 +01:00
cinap_lenrek 6f1efd37a2 limit clunk queue length for cclose()
dont let the clunk queue grow too large if we are allowed to
block (cclose) as the fileserver might run out of fids.
2012-11-07 22:04:29 +01:00
cinap_lenrek 6c8097a84d fix spurious kproc ppid
newproc() didnt zero parentpid and kproc() didnt set it, so
kprocs ended up with random parent pid. this is harmless as
kprocs have no up->parent but it gives confusing results in
pstree(1).

now we zero parentpid in newproc(), and set it in sysrfork()
unless RFNOWAIT has been set.
2012-11-07 20:46:30 +01:00
cinap_lenrek 2c4a77f21f devproc: remove pgrpid == 1 check for notepg open
assuming that this check tried to prevent the hostowner
from killing init, it is silly because init would just
handle the note.

with kbdfs, we actually want to send interrupt note to
the initial process group so instead of working arround
this with rfork(RFNOTEG|RFNAMEG), we remove the check.
2012-11-07 18:57:02 +01:00
cinap_lenrek 90cbdce8ab devdraw: fix stats for #i/winname (thanks jas) 2012-10-27 22:27:19 +02:00
cinap_lenrek 22c7584780 devproc: fix another channel leak, move the cclose(c) from proctext() to procopen. 2012-10-22 21:59:52 +02:00
cinap_lenrek 6680d50d4b fix devproc text chan leak 2012-10-22 18:51:19 +02:00
cinap_lenrek 1ee5cd7425 kernel: mnt cache rework
avoid double entries in the cache for copen() and properly handle
locking so we wont just give up if we cant lock the Mntcache entry,
but drop the cache lock, qlock the Mntcache entry, and then recheck
the cache.

general cleanup (cdev -> ccache, use eqchantdqid())
2012-10-17 15:48:30 +02:00
cinap_lenrek fcacce0f2f kernel: duppage cleanup
remove the sched() call and retry loop from duppage() and just
drop the page lock, then reacquire it after lock(&palloc).
2012-10-16 16:10:26 +02:00
cinap_lenrek 45b99937be kernel: cachedel() lock order, lookpage, cleanup
the lock order of page.Lock -> palloc.hashlock was
violated in cachedel() which is called from the
pager. change the code to do it in the right oder
to prevent deadlock.

change lookpage to retry on false hit. i assume that
a false hit means:

a) we'r low on memory -> cached page got uncached/reused

b) duppage() got called on the page, meaning theres another
cached copy in the image now.

paging in is expensive compared to the hashtable lookup, so
i think retrying is better.

cleanup fixfault, adding comments.
2012-10-16 14:12:21 +02:00
cinap_lenrek 1335be8276 swap: track swap pages with > 255 references, setswapchan() swapimage.c
swaped pages use a 8bit refcount where as the Page uses a 16bit one.
this might be exploited with having a process having a single page
swaped out and then forking 255 times to make the swap map refcount
overflow and panic the kernel.

this condition is probably very rare. so instead of doubling the
size of the swap map, we add a single 32bit refcount swapalloc.xref
which will keep the combined refcount of all swap map entries who
exceeded 255 references.

zero swapimage.c in setswapchan() after closing it as the stat() call
below might error leaving a dangeling pointer.
2012-10-15 14:04:30 +02:00
cinap_lenrek 2f732e9a85 kernel: attachimage / exec error handling
attachimage()'s approach to handling newseg() error is flawed:

a) the the image is on the hash table, but ref is still 0, and
there is no segment/pages attached to it so nobody is going to
reclaim / putimage() it -> leak

b) calling pexit() would deadlock us because exec has acquired
up->seglock when calling attachimage(), so this would just deadlock.

the fix does the following:

attachimage() will putimage() and nexterror() if newseg() fails
instead of pexit(). this is less surprising.

exec now keeps the condition variable commit which is set once
we are commited / reached the point of no return and check this
variable in the highest waserror() handler and pexit() us there.

this way we have released up all the locks and pexit() will
cleanup.

note: this bug shouldnt us hit in with the current newseg()
implementation as it uses smalloc() which would wait to
satisfy the allocation instead of erroring.
2012-10-14 19:48:46 +02:00
cinap_lenrek 16d61d3c97 kernel: try to catch some (rare) mistakes
kstrcpy() did not null terminate for < 4 byte buffers. fixed,
but i dont think there is any case where this can happen in
practice.

always set malloctag in kstrdup(), cleanup.

always use ERRMAX bounded kstrcpy() to set up->errstr, q->err
and note[]->msg. paranoia.

instead of silently truncating interface name in netifinit(),
panic the kernel if interface name is too long as this case
is clearly a mistake.

panic kernel when filename is too long for addbootfile() in
devroot. this might happen if your kernel configuration is
messed up.
2012-10-11 17:29:16 +02:00
cinap_lenrek 73e7e47d5b kenrel: simplify image cache by use of ccloseq() 2012-10-10 08:22:35 +02:00
cinap_lenrek 9e7ecc41d5 devproc buffer overflow, strncpy
in devproc status read handler the p->status, p->text and p->user
could overflow the local statbuf buffer as they where copied into
it with code like: memmove(statbuf+someoff, p->text, strlen(p->text)).
now using readstr() which will truncate if the string is too long.

make strncpy() usage consistent, make sure results are always null
terminated.
2012-10-01 02:52:05 +02:00
cinap_lenrek 5d64e428eb fix devproc and killbig segment race
we have to acquire p->seglock before we lock the individual
segments of the process and lock them. if we dont then pexit()
might free the segments before we can lock them causing the
"qunlock called with qlock not held, from ..." prints.
2012-09-30 16:14:27 +02:00
cinap_lenrek 336df4d4ae Qcoalesce patch to satisfy full read length 2012-09-14 03:35:15 +02:00
cinap_lenrek 9c18f300a4 devshr: honor noattach 2012-09-06 01:05:37 +02:00
cinap_lenrek 0c52215ae3 usb: fix potential isoread overruns, error instead of panic on isoread in ohci 2012-09-03 04:23:02 +02:00
cinap_lenrek cfd25faa28 usb: fix isowrite putsamples race 2012-09-03 01:54:34 +02:00
aiju 5ba4ccd30e fixed RFNOMNT 2012-08-27 17:50:48 +02:00
cinap_lenrek 3ac4524e4a syscallfmt: use up->syserrstr instead of up->errstr (import from sources) 2012-08-24 15:53:35 +02:00
cinap_lenrek 86f323290c wait: always check up->nchild before going to sleep
always make sure that there are child processes we can wait for
before sleeping.

put pwait() sleep into a loop and recheck. this is not strictly
neccesary but prevents accidents if there are spurious wakeups
or a bug.
2012-08-24 13:11:04 +02:00
cinap_lenrek d404e9e9f8 devmnt: more carefull wakeup in mountmux
once we set q->done = 1 in mountmux, the sleeper might return freeing q
so the wakeup might access invalid memory. we change the embedded Rendez
structure in the Mntrpc into a pointer to the sleeping procs up->sleep
rendez so the rendez is always going to be valid even if the rpc has been
freed.

the call to mntstats was moved before we set q->done also to prevent
accessing invalid memory.
2012-08-24 13:00:14 +02:00
aiju b21b9ba89c added hjfs 2012-08-07 17:57:04 +02:00
cinap_lenrek 36adf27af8 add Echange[] error string 2012-08-07 07:15:41 +02:00
cinap_lenrek fcc5e75d07 tsemacquire: manpage and syscallfmt 2012-07-30 22:45:49 +02:00
cinap_lenrek 49ac0b93d3 add tsemacquire syscall for go 2012-07-29 20:26:49 +02:00
cinap_lenrek a360bddee7 qio: raise critical queue bloat threshold from 2 to 10 times to queue limit
the limit for overqueueing was too small for stuff like fcp
on a fileserver connected with a standard 32K limit pipe like
ramfs.

fcp usesd 8K*16procs > 32K*2

the biggest queue limit used in the kernel is 256K making
the maximum queue bloat 2.5MB or 320K for standard pipes.
that should be big enougth to never happen in practice
unless there is a bug which we like to catch before we
exhaust all kernel memory.
2012-07-08 19:11:29 +02:00
cinap_lenrek 1de9ca2de5 bring back il protocol support 2012-05-03 10:47:40 +02:00
cinap_lenrek 7f04d86dfb kernel: move duplicated random.c to port 2012-05-03 08:49:25 +02:00
cinap_lenrek 1d42b2dac1 avoid leaking up->dot into the closeproc 2012-04-28 09:12:04 +02:00
cinap_lenrek e440d414d5 fix missed clunkq wakeup race 2012-04-27 18:51:15 +02:00
cinap_lenrek 6bd82b34fd async clunk for cached mounts, fix closeproc explosion 2012-04-27 17:51:20 +02:00
cinap_lenrek 73b7f5f12c panic: trailing newlines 2012-03-28 18:13:45 +02:00
cinap_lenrek c3004ddf25 port/chan.c: fix locking issue 2012-03-28 18:11:09 +02:00
cinap_lenrek f0facb2ed8 usbehci: import changes from sources (portreset, port handover handling), set interrupt threshold to 1 uframe 2012-03-07 23:50:58 +01:00
cinap_lenrek f2b6ec3140 correcting unicode superscripts for 1 2 and 3 2012-02-23 16:58:53 +01:00
cinap_lenrek 5b07f6238b devdraw: use QLock to serialize sleep on refresh to prevent double sleep 2012-02-20 10:49:14 +01:00
cinap_lenrek 77c21a062c kernel: remove duppage debug, add comments, cleanup 2012-02-16 18:04:08 +01:00
cinap_lenrek 083612b34e kernel: duppage checking 2012-02-16 11:38:50 +01:00
cinap_lenrek 4780a7ff56 devmouse: add twitch mousectl command 2012-02-13 07:06:08 +01:00
cinap_lenrek 061d55111b add Etoolong error string, cleanup genbuf truncation fix 2012-02-08 02:32:03 +01:00
cinap_lenrek 022fd02b96 fix endless devwalk loops caused by genbuf truncation 2012-02-08 00:00:42 +01:00
cinap_lenrek 5acde1e791 make smalloc() uninterruptable as most callers cant handle it anyway 2012-02-06 05:28:57 +01:00
cinap_lenrek 9d60d8262e fix potential double ready in postnote() for rendezvous 2012-02-06 00:23:38 +01:00
cinap_lenrek 3599f733ee more checking for eqlock 2012-02-05 20:52:12 +01:00
cinap_lenrek 8d22d0b165 devuart: fix no memory panic with zero number of uarts 2012-02-04 16:41:46 +01:00
cinap_lenrek 8ef32ed38c fix double free in exec 2012-01-23 05:12:05 +01:00
cinap_lenrek e2bbb41a30 fix unlock(&procalloc) race on mp systems 2012-01-22 22:33:15 +01:00
cinap_lenrek 413ab7785f eqlock: cleanup 2012-01-15 14:31:53 +01:00
cinap_lenrek 577d31ab13 fix race condition of the CCACHE flag by clearing the flag in
attachimage() instead of temporarily reseting in pio().
2012-01-12 12:54:45 +01:00
cinap_lenrek 659943558f kernel: keep segment locked for data2txt 2012-01-09 21:33:22 +01:00
cinap_lenrek 85fd5bf58d eqlock: dont rely on notepending flag when detecting eqlock interruption 2012-01-09 21:18:03 +01:00
cinap_lenrek 2131248411 swap: make sure swapchan doesnt use the mntcache 2011-12-22 02:33:49 +01:00
cinap_lenrek ea5a23d39a kernel: make mntcache effective, be carefull 2011-12-22 02:17:29 +01:00
cinap_lenrek 4fe344847c kernel: better pidalloc() 2011-12-21 23:08:15 +01:00
cinap_lenrek 2450b55c7b kernel: add pidalloc() and reuse pid once the counter wraps arround 2011-12-20 22:22:08 +01:00
cinap_lenrek bef3c5a3c5 devfs: dont raise "no more trees" if malloc fails 2011-12-13 16:12:40 +01:00
cinap_lenrek 1238374df9 killbig(): fix crash if no process could be found 2011-12-13 16:10:37 +01:00
cinap_lenrek 36dc22fd57 panic(): dont print message twice. for terminals, dont auto reboot. 2011-12-13 16:07:52 +01:00
cinap_lenrek f32ef135d4 devbridge: fix 2011-12-12 19:28:21 +01:00
cinap_lenrek 3028437f8b glitch :-) 2011-12-12 19:20:40 +01:00
cinap_lenrek 8cb8043d0e kernel: fix more malloc/smalloc errors 2011-12-12 19:17:58 +01:00
cinap_lenrek 304ee3b2b5 devfs: fix cryptio memory leak 2011-12-12 19:17:24 +01:00
cinap_lenrek bf3476d661 kernel: fix inproper use of malloc/smalloc 2011-12-12 16:55:26 +01:00
cinap_lenrek 589f99915e devssl: tiny fixes (from plan 9) 2011-12-12 14:59:14 +01:00
cinap_lenrek 077537baeb fix cdrom media change 2011-12-06 14:49:40 +01:00
cinap_lenrek 30907f1d00 devmouse: allow multiple writers on /dev/mousein 2011-11-03 02:33:09 +01:00
cinap_lenrek 4c05d129e2 eqlock: fix postnote/qunlock race 2011-11-02 21:39:30 +01:00
cinap_lenrek 3fce94e785 fix _tos->pcycles, make _tos->kcycles actually count cycles executing kernel code on behalf of the process 2011-10-25 20:17:39 +02:00
cinap_lenrek 0089c44663 devcons: readd dummy consctl file so telnetd has something to bind on 2011-09-17 02:35:03 +02:00
cinap_lenrek 513bdcccdc chan: use chanpath() in chan DBG, do more checking in cclose and cclone 2011-09-02 14:12:39 +02:00
cinap_lenrek cd47b3e9d4 bootrc: prefer 9660 filesystem as default on cdboot, restart factotum, delay for usb 2011-08-28 20:37:20 +02:00
cinap_lenrek a6e3c9fd83 calculate the real number of pages used by segments and use it for killbig and proc 2011-08-26 04:47:34 +02:00
cinap_lenrek cf974eb852 fix kernel: pio()/mfreeseg() race 2011-08-24 14:43:15 +02:00
cinap_lenrek 61a0117ea5 swap: do less print spamming, sched after killbig so killed proc can get released 2011-08-24 07:58:14 +02:00
cinap_lenrek 5182bb7ecf dont hang if swap is full 2011-08-24 06:52:24 +02:00
aiju 8434f98cdd added interrupt proc ctl message 2011-08-20 12:30:06 +02:00
cinap_lenrek 79a044e38e usb: fix potential uninterruptable calls 2011-08-19 05:19:10 +02:00
cinap_lenrek c44b78f739 change definition of Chan.create to return a chan like open 2011-08-17 23:27:31 +02:00
cinap_lenrek 72304eb350 fix broken cross platform build 2011-08-17 23:25:22 +02:00
cinap_lenrek f682600440 serial console stuff 2011-08-16 10:15:36 +02:00
cinap_lenrek cb9e638c00 bind devshr to /shr 2011-08-16 01:49:37 +02:00
cinap_lenrek b39d5fbbef devshr: security! 2011-08-15 18:27:30 +02:00
cinap_lenrek 945e2a7aa1 devshr/devsrv 2011-08-14 11:11:51 +02:00
cinap_lenrek 4ec0e921e5 eqlock(): use eqlock when interruption is possible 2011-08-11 04:25:51 +02:00
cinap_lenrek e9d441fccf eqlock(): use separate lock to protect eql, fix missing unlock 2011-08-11 23:02:48 +02:00
cinap_lenrek 4b506cd0ae qio: fix block leak introduced by eqlock change 2011-08-10 17:26:05 +02:00
cinap_lenrek 70e4b8d1f9 added eqlock(), a interruptable version of qlock. addresses issue #81 2011-08-10 16:21:17 +02:00
cinap_lenrek 676a876df6 usb: added buffer delay control 2011-08-01 19:02:50 +02:00
aiju 6aed9711b4 devshr: changed #σc to contain directories
nusb: detaching
2011-07-30 14:30:27 +02:00
cinap_lenrek f9846213d1 nusb: change usbevent format, put nusbrc in bootfs 2011-07-30 07:23:26 +02:00
aiju 27fd88af23 devshr: rename hook 2011-07-28 14:22:39 +02:00
aiju c08f86254e devshr: fixed crash 2011-07-27 10:40:21 +02:00
aiju d2a1d1fb37 devshr: fixed memory leaks / race condition 2011-07-25 10:10:11 +02:00
aiju e1260aa4d6 devshr: added unmounting 2011-07-24 14:51:49 +02:00
aiju 8784d2d0ea added devshr 2011-07-24 22:12:01 +02:00
cinap_lenrek a7a56b9a48 devaudio: ignore non absolute volume items with range 0 2011-07-21 01:24:18 +02:00
aiju 11bf57fb2c add message on OOM kill, fix issue #70 2011-07-18 10:12:45 +02:00
cinap_lenrek c6c2e04d4a segdesc: add /dev/^(ldt gdt) support 2011-07-12 15:46:22 +02:00
cinap_lenrek c2fc2fad13 merge sd changes from 9atom 2011-07-10 14:14:23 +02:00
cinap_lenrek b222c16a38 qio: naive fixing attempt on issue #64 2011-07-09 13:15:39 +02:00
cinap_lenrek b274842f5c audio: cleanup 2011-07-03 05:56:53 +02:00
cinap_lenrek 86f316987d audio: add delay control 2011-07-03 03:42:37 +02:00
aiju 89500cba40 added /proc/*/ppid 2011-06-26 14:15:14 +02:00
cinap_lenrek cde40efb0c boot(8): add cfs support 2011-06-15 14:50:29 +02:00
cinap_lenrek 7827e7ae6f cleanup boot(8), replace read(1), fix cpu kernel configs 2011-06-04 08:07:21 +00:00
cinap_lenrek f55d5517ed boot(8): strip bootfs 2011-06-04 07:18:11 +00:00
cinap_lenrek 792b186b3a boot(8): replace bzfs with paqfs 2011-06-04 05:19:29 +00:00
cinap_lenrek f83d4972db devaudio: interlock reads too 2011-06-04 01:04:14 +00:00
cinap_lenrek 15cdb69f61 devaudio: serialize calls in devaudio, sb16: remove qlock 2011-06-04 00:28:17 +00:00
cinap_lenrek 1bc10a7c93 kproc(): remove the lines and the comment 2011-05-31 17:11:33 +00:00
cinap_lenrek d18a4568a8 kprocs dont share memory with up, see: http://9fans.net/archive/2011/05/159 2011-05-31 17:06:41 +00:00
cinap_lenrek 2def26ce10 add cryptsetup to rootfs.bz2 2011-05-31 15:59:36 +00:00
taruti 9655db2550 devfs crypto code - alpha version 2011-05-24 22:19:33 +00:00
cinap_lenrek e7d3e20912 remove keyboard stuff from other ports, make openssl and python compile on arm 2011-05-21 00:42:08 +00:00
cinap_lenrek 6cd063199d devaudio: audiostat perms 2011-05-20 21:08:10 +00:00
cinap_lenrek a75eb31752 devaudio: attach 2011-05-20 20:45:17 +00:00
cinap_lenrek 4bc74b8aef audioif, mixer control 2011-05-20 18:30:46 +00:00
cinap_lenrek b74418c2ce sb16: new approach, works in qemu 2011-05-18 19:57:31 +00:00
cinap_lenrek be81150bb4 remove audio.h, put stuff in port^(dat fns).h 2011-05-16 22:31:27 +00:00
cinap_lenrek 7b0e90b5d1 sb16: make it work in bochs 2011-05-16 22:09:39 +00:00
cinap_lenrek d11cd06c10 audio.h 2011-05-16 16:29:27 +00:00
cinap_lenrek d642d726ba add ac97 driver 2011-05-16 12:16:43 +00:00
cinap_lenrek 59aaec97ca add rdb message to /dev/reboot 2011-05-12 20:15:39 +00:00
cinap_lenrek fefd557d83 fix bad proto entry for cront/bootes, remove partfs from rootfs 2011-05-10 01:29:42 +00:00
aiju 51c9ad3413 changed Egreg 2011-05-09 09:52:53 +00:00
aiju ed3a999828 added absolute movement for mousein 2011-05-09 08:48:14 +00:00
cinap_lenrek 26c2845917 kbdfs 2011-05-09 08:32:14 +00:00
cinap_lenrek 470eb1c6a8 remove .i files in clean rule 2011-05-04 10:40:12 +00:00
cinap_lenrek fa9a40027b boot(8): merge usb boot method into local 2011-05-02 01:21:55 +00:00
ment 6a4063e245 merge 2011-04-30 16:52:50 +02:00
cinap_lenrek 15656fc79d boot(8): fix boot restarting 2011-04-30 20:17:33 +00:00
ment 012dec1119 boot: partitioning USB disks, mounting 9front.iso from FAT partition 2011-04-30 16:43:54 +02:00
aiju c693f26b2c fixed mordor 2011-04-21 17:31:51 +02:00
cinap_lenrek 19a82a2654 add fstype command to detect 9660, kfs and cwfs filesystems 2011-04-21 10:40:03 +00:00
cinap_lenrek 1b1fac3874 boot(8): fix it 2011-04-19 05:24:46 +00:00
iru b261a0c31b Add /sys/src/9/boot/tread, a tool to read a line with a timeout.
While here, remove boot(8) references to pcload.
2011-04-17 17:25:55 -03:00
cinap_lenrek 0087d42a68 boot(8): add cwfs support to, restart if mount fails, usbd. cwfs: exit code 2011-04-18 05:58:04 +00:00
iru 23b2128da1 Oops, forgot to add port/bootfs.proto and port/mkbootfs. 2011-04-16 17:50:51 -03:00
iru 478d102443 Initial import of the new boot(8). Change pccd and pcf to use it. 2011-04-16 17:42:16 -03:00
aiju 4d4fc2ca34 moved /dev/mordor to devcons 2011-04-16 14:15:01 +02:00
cinap_lenrek 632defb656 vesa-changes 2011-04-11 20:56:59 +00:00
cinap_lenrek 05569f6f2c perms 2011-04-11 15:38:29 +00:00
Taru Karttunen 8f69bf2252 Some more permissions for kernel compile 2011-03-31 09:06:36 +00:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00