on races... normal forks will all share the /env environment but
not the in memory variables of rc. so when we would normally fork
whoever does an exec (flush) first will override what the values of the
/env variables are, *independent* of the variables that where
actually modified *in* the process.
when we flush *before* fork, then at least both processes start out
with marked clean in memory variables and the processes will flush
only the things they actually change.
the "auth" ctl command only sets the rsne of the current selected
access point. so on deassociation, we wait for the connection to
the potentially new access point and then setup new rsne before
processing eapol messages.
fix the default note handler for event programs. only handle non system
notes or notes in the slave processes. for interrupt in the main process,
just call exits() which will do the cleanup and restore window label
properly.
this makes completely overriding the note handler in gping and
stats uneccesary.
many queued mouse events delay eresize() because
new ebread() takes from the queue first before attempting
to read from the event pipe. this is a waste of memory, so
just process (dequeue) all the events as long as there are
any on each iteration.
from the manual:
Tm2sec converts a broken-down time to seconds since the
start of the epoch. It ignores wday, and assumes the local
time zone if zone is not GMT.
so we can assume localtime if Tm.zone is not set to GMT.
all code that wants no localtime conversion should set
Tm.zone explicitely to GMT. (see previous commits)
tm2sec() now does the reverse of localtime() when Tm.zone[0] == 0
which seems to be what the calling code (dossrv, zipfs) assumes.
this also makes sense because theres no simple way todo it
outside of libc as theres otherwise no access to the timezone
structure with the daylight saving periods.
tm2sec() ignores tm.tzoff and will use the local timezone for
conversion. to make it work right, we convert the dos timestamp
as GMT and then correct timezone with the offset provided by the
server.
instructions like BKPT, BX and BLX. Decoding these correctly allows db/acid to
single step through BX and BLX on armv5t+, and to show a breakpoint instruction
as 'BKPT $#0' instead of 'TEQ R0@>R0,R0'.
using a shared reply queue and a pool of worker procs does
result in replies to be send out of order under some conditions.
the symptoms are mnt errors when interrupting requests (Rflush
arriving before the original requests response).
this change gives each connection its own reply queue and its
own srvo process. so now a connection consists of one reply
queue, a srvi process reading the connections file descriptor
and a srvo process reading the reply queue and writng replies
to the connections file descriptor.
the srvi processes live as long as the connection is established.
the srvo prcoesses live forever and are attached to the chan
(which gets reused).
to avoid excessive process creation, we limit the number of
connections to 30. srvchan() returns nil when all 30 network
channels are in use.
due to the xfid handlers clearing flushtag too early, xfidflush might respond too early
causing spurious replies send later by the handler. now, we clear the flushtag in
filsysrespond *after* the reply was send. xfidflush will wait for us on the active
qlock.
scrollbars used to put the mouse on the scrollbar while scrolling. if latency
is high, this often results to the cursor jumping back. instead, make button 2
srolling work without needing the mouse to be inside the scrollbar and leave
the mouse position alone.
From richard:
A couple of patches applied yesterday should make debugging on ARM a
bit more reliable. Using db or acid on ARM, you may have noticed that
a program being debugged would sometimes execute through a breakpoint
without stopping, or run away while being single stepped. It turns out,
as often happens, that one symptom had two separate causes. For details:
/n/sources/patch/applied/5db-condcode/readme
/n/sources/patch/applied/arm-bkpt-cond/readme
To take advantage of the patches, rebuild libmach.a, then acid and db.
On machines with a kw kernel (sheevaplug et al), you'll also want to
rebuild /arm/9plug; otherwise breakpoints will stop working at all.
The new 9plug will, however, still work with the old libmach; and
the bcm and teg2 kernels are already compatible with the new libmach.
the heuristics that limits kernel memory on a cpu server to
a fixed amout (64MB + size for page tables) makes using devdraw
impractical.
if *imagemaxmb= is specified, we can assume that the draw device
will be used so we want to get a reasonable amount (30% default)
of kernel memory.
link status not working on 82567 was due to wrong phy number
used. instead of hardcoding the phy numbers, probe the phys
by reading id1 and id2 registers (code stolen from ethermii).
on the 82567, reading any phy register just gives 0 back.
however, the card works just fine and no action is required
to (re-)start auto negotiation. so we add maclproc() which just
reads the speed setting and link status from the mac status
register instead of reading the phy registers.
we'v probably seen this symptom on other cards (link: 0) like
82566. we should test if we can make link status work on
these cards as well by just using the maclproc().
rx pool exhaustion causes the system to deadlock when netbooted.
queue management should (etheroq) already makes sure the systen
can keep up with the data thowing away buffers.
icansleep() violates the lock ordering due to the following cases:
rbfree(): ilock(Rbpool.Lock) -> wakeup(): spli(), lock(Rbpool.Rendez)
sleep(): splhi(), lock(Rbpool.Rendez) -> icansleep(): ilock(Rbpool.Lock)
erik fixed this moving the wakeup() out of the ilock() in rbfree(),
but i think it is an error to try acquiering a ilock in sleeps wait
condition function in general.
so this is what we do:
in the icansleep() function, we check for the *real* event we care about;
that is, if theres a buffer available in the Rbpool. this is to handle
the case when rbfree() makes a buffer available *before* it sees us
setting p->starve = 1.
p->starve is now just used to gate rbfree() from calling wakeup() as
an optimization.
this might cause spurious wakeups but they are not a problem. missed
wakeups is the thing we have to prevent.
this patch consists of two bits of work submitted as one
patch.
the first bit fixed a "pacing" problem, where a tcp connection
rate-limited by the reading process would experience 10%
of the expected throughput, and could even get into live
lock. it was noticed at the time of this initial work that
the stack often sent tiny grams. some good bits from nix'
original tcp were merged in. the test program
/n/sources/contrib/quanstro/tcptest.c
will verify that under most conditions, a reader-paced connection
now gets the expected throughput. expected arguments
would be
tcptest -s1 -n 5000 -l
the second bit is a first step in preparing tcp to handle
modest (1-2MB) bandwidth-delay products. the strategy
was to completely implement NewReno. the testing network
was a 7/35/70ms by 100Mbit wan emulator with 0/.05/.1% loss.
here are the performance comparisons from the changes after
the first round "old" to the submitted patch "new". the
smallest improvement was 80%, the largest was 11x.
loss% rtt old new
0.10 7 4.40 7.85
0.10 35 0.88 1.79
0.10 70 0.47 0.84
0.05 7 4.80 9.38
0.05 35 1.00 2.02
0.05 70 0.52 1.77
0.01 7 5.33 11.87
0.01 35 1.14 10.97
0.01 70 0.54 4.75
0.00 7 4.49 11.92
0.00 35 1.04 11.35
0.00 70 0.58 10.56
since the diff is not very easy to read, i wrote a small
paper detailing the changes
http://www.quanstro.net/plan9/tcp/tcp.pdf
- erik
the cmd box is not part of the alt display hirarchy. for command
typing to show the box in alt display, we call pldraw() on it
in eresized() to initialize its cmd->b image so it knows where to
draw itself on typing.
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.
if LocalX or ArgX is a package, the store into
a element should *not* type convert. so when taking
the index reference, we have to carry over the type.
empty href="" attribute in base-tag causes the page to break.
while at it, handle empty attributes in other parts of the
code as well. (mostly stuff like id, name shouldnt be empty)
it could happen that we unblanked while vesaproc was
currently blanking (when manually blanking using vgactl
for example). the wakeup of the unblank is lost.
disabled LAPIC entries overwrote the bootstrap processor
apic causing the machine panic with: "no bootstrap processor".
(problem with lenovo X230)
just ignore entries that are disabled or collide with
entries already found. (should not happen)
the issues with the previous tsc change where not related to the tsc
but where problems with timesync using an old frequency file. a
patch to fix timesync was commited, so so we reintroduce the *notsc=
again.
the frequency tolerance used by timesync was from a 10th to 10 times
the frequency of the system clock! switching a system from tsc to pic
timer changes the system clock frequency from 300MHz to arround 1.8Ghz
on a x200s laptop resulting in time running way too slow or way too fast.
so we change timesync to only accept frequencies from half to double the
system clock which still seems huge, but at least catches the case above
resulting in timesync ignoring the old frequency file.
aux/wpa needs to reset its reply counter on deassociation to
properly restart key negotiation. we signal this with a zero
length read on the connections filtering for eapol protocol.
allow the driver to associate the node with a new aid right after
we receive the association response, not just when we transmit
a packet which usualy does not happen as eapol is initiated by
the access point so there are no transmit calls. we just call
transmit from the wifiproc with a nil block to introduce the node.
the splhi() and apictimerlock in the Mach isnt neccesary, as
portclock always holds the ilock of the per mach timer queue
when calling timerset().
as fastticks() and the portclock timers are all handled on a
per processor basis, i think it should be theoretically possible
for the lapics to run at different frequencies. so we measure
the lapic frequency for each individual lapic and keep them in
a per processor Apictimer structure instead of assuming them
to be the same.
loading the divider before programming one shot mode *sometimes*
gives the wrong frequency. (X200s got 192Mhz vs. 266Mhz, after
5 boot attempts)
also reload the divider after programming periodic mode. (from
http://wiki.osdev.org/APIC_timer)
dnauthdb() would relabel expired rr's as rr->db == 0 to make
them get garbage collected by dnage(). but this doesnt work
due to dn->keep and also causes the deduplication to fail on
rrattach() as rrattach1() handles rr->dn/rr->auth as separate
name spaces.
this causes duplicate entries in the rr's when ndb gets
gets changed. to fix, we just delete the expired (removed from
ndb) rr's immidiately in dnauthdb() instead of trying trick
dnage() to garbage collect it.
doesnt seem to be reliable. also, separate tsc frequency measurement
and cpu loopconst measurement. turned out with *notsc=, the simplcycles()
calls would mess up loopconst.
we previously used tsc only on cpu kernel. now that
we use it on terminal kernel too, there might be some
surprises ahead.
so make it possible to disable tsc for machines where
the tsc rate is not kept constant across cores or is
dynamically adjusted by power management.
depending on the font, poping the menu would move your cursor
one pixel down each time (due to division). this is annoying
when using a trackpoint and trying to repeat some operation
over 9000 times.
the cursor should only be moved when the menu is repositioned
to contain it on the screen.
- 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...
- 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
resizewin() has some extra logic making sure the rect doesnt get too big.
rio would otherwise refuse to create the window and the operation will fail
completely.
on usb ethernet, it can happen that we read truncated packets smaller
than the ethernet header size. this produces a warning in pullupblock()
later like: "pullup negative length packet, called from 0xf0199e46"
we cannot assume theres only one instance of an acpi table. some
bios have multiple SSDT tables and we would only find the first
one.
now, we keep a second array to record the physical address of
the table visited by maptable(). load all instances to the
SSDT.
- fix bogus execution of Else{} blocks
- always allocate Env in amleval()
- add Sleep() and Stall() instructions
- keep package size for packages with empty body
from test(1):
f -older t True if file f is older than (modified before)
time t. If t is a integer followed by the letters
y(years), M(months), d(days), h(hours),
m(minutes), or s(seconds), it represents current
time minus the specified time. If there is no
letter, it represents seconds since epoch. You
can also concatenate mixed units. For example,
3d12h means three days and twelve hours ago.
this means *without* [y M d h m s] unit, t is *absolute* time
in seconds since epoch.
If 64-bit multiply has to save both AX and DX, it could load the wrong value
into DX; also, biggen shouldn't allocate either AX or DX as temporaries
when using the template for MUL.
doing poolcheck should give us better context to figure out
what memory blocks / owners corrupted the blocks after free.
this is for hunting down a memory corruption seen in connection
with usb serial.
this simplifies the arm ports and keeps all the stuff in one place
instead of spreading it thru notify(), trap() and syscall() functions
and prevents useless fp state copying for kernel procs.
also make sure to save fp in notify while still splhi().
the tag-word is not compatible between x87 and sse, have to convert
properly for emulation to work.
we now copy fp state across fork (again!) to preserve FCW and MXCSR
registers. this might not be neccesary as we could probably just
get the current value for the curren process and avoid the fpsave()
call, but become conservative again.
to fix this, make genwww return 0 if w->url is nil and output an error message when attempting to access selection if it's nil. the problem with the w->url fix is that after clicking on the url scroll bar, an empty url history row could be highlighted by clicking on it. fix this by making sure lp->lo is not less than zero.
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.
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 :)
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.
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.
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.
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.
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.
If you run this:
{for (i in `{seq 1 70000}) echo '½•α·'} | mc | wc
mc will eventually suicide. The error comes from
/sys/src/libdraw/font.c:/^agefont which assumes it has a
display. Normally, this is set up by geninitdraw (usually
via initdraw), but mc.c avoids that to avoid the screen
redraws (flicker, at a minimum, but worse in long-running
cases).
graphics(2) does not prohibit this use, so I made the least
intrusive change to make it work.
the fpenv() instruction stores in x87 format, using mathstate()
would interpret fpsave as FPssestate in case it was enabled!
instead, pass the status word and fppc explicitely to mathnote()
in matherror().
get rid of m->fpsavealign buffer, as we can just use FPssesave struct
which has enougth padding so rounding up base pointer will not overflow.
use resrcwait() when waiting for memory to become available. randomize
the sleep time and properly restore old process status in case tsleep()
gets interrupted.
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)
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()...
pread does not guarantee that it would read all the data asked for.
But acme usage of disk assumes that. This issues as many reads as
needed to make acme work when read returns less data than it wanted.