when appending to a directory, the copy of the offset in the dent was
set to the offset that the write was supposed to happen at -- however,
for DMAPPEND files the offset is always at the end of the file. Until
the file was closed, stat would show the wrong directory info.
Implement a hangup ctl command that flushes the
queues, but keeps the filter around.
This can be usefull for low-overhead traffic blocking,
as only the file-descriptor needs to be kept around
and the queues can be flushed.
No user-space process is needed to consume packets
and no buffers are wasted.
example:
aux/dial -e -o hangup 'ipmux!ver=4;src=8.8.8.8' rc -c 'echo 0 > /srv/blocked'
rm /srv/blocked
It seems some protocols are unprepared to
deal with ipoput*() raising an error
(thrown from ifc->m->bwrite()).
so catch it and return -1 (no route) instead.
We were accidentally searching the key for '&', instead of the value.
Inferno received this exact fix at some point, but it never made it back to Plan 9.
the installed version of git has a bug; removing
this file will trigger some spurious removals of
test files, so hold off deleting it until people
have time to install a fixed git
directories need to sort as though they end with a '/',
when running through them for comparison, otherwise we
flag files as added and removed spuriously, leading to
them incorrectly getting deleted when merging commits.
Instead of Proc { Mach *mp; Mach *wired; },
track affinity by an integer representing
the mach number instead.
This simplifies the code as it avoids needing
to compare with MACHP(m->machno).
Wiering a process to a processor is now done
by just assigning affinity and then set a flag
that it should not change.
Call procpriority() when we want to change
priority of a process instead of managing
the fields directly.
The idea is:
When we call sched() with interrupts disabled,
it must not return with them re-enabled.
The code becomes easier to reason about if
we make sched() preserve interrupt status,
which lets us call sched() from an interrupt
handler (with interrupts disabled) without
risking preemption by another interrupt once
sched() returns which can pump-up the stack.
This allows removing Proc.preempted flag as
it is now impossible for interrupts to
preempt each other in preempted().
Extra cleanups:
make interrupted() _Noreturn void
and remove unused Proc.yield flag.
the symptom is that ping is apparently skipping
transmits which recover with the next send,
resulting in exactly send-period spikes in
the ping rtt.
It appears that the core seems to reorder writes
to uncached memory, which can result in the doorbell
being written before the descriptor status bits
are written.
put a coherence() barrier before writing doorbell
fixes it.
thanks sigrid for reporting the issue!
On a multiprocessor, the scheduler can run into
a very unfair distribution of processes to cpus
when there are more long-running processes than cpus.
Say we have a 4 cpu machine and we run 4 long-running
proesses, each cpu will pick up a single process
and each process will get 100% of its fair share.
Everything is good so far.
If we start more long-running processes, all these
processes are going to be picked up by the cpu core
that runs most sporanic / bursty work loads as it
is calling sched() more often.
This results in all the extra long-running prcoesses
to cluster around the same core resulting in very
unfair sharing of load.
The problem is that once a process runs on a cpu,
it stays on that cpu as processor affinity
is never reset.
Process migration only happens when a cpu cannot
find any process to run, given the affinity
constrains, but this can never happen when
the system is under full load and each cpu
always has a low-priority long running
process to run.
How do we fix this?
The idea of this hack is to reset processor
affinity in ready() when its priority changes or,
when it appears to be a long-running process.
That way, we give every cpu a chance to pick
it up and share the load.
This is not a ideal solution of course. Long term,
we should probably have separate runqueues per cpu
and do the balancing explicitely.
In the sched() function, the call to reprioritize()
must be done before we set up, as reprioritize()
calls updatecpu(), which determines if the process
was running or not based on p == up. So move
the call to runproc() itself.
while rehashing the same files over and over will work
just fine, it can be slow with a large number of large
files; this makes 'git/comit .' perform much better in
repos with a large number of large binary blobs.
compress when the log doubles in size, rather than
using a fixed size heuristic; this means that we
don't start compressing frequently as the log gets
big and the file system gets fragmented.
this happens in libframe:
/sys/src/libframe/frutil.c:80: x -= (x-f->r.min.x)%f->maxtab;
but there's no way to control when the user changes the
maxtab value, so it's samterm's responsibility to
sanitize it.
we were copying the owner and group of the parent dir into the fid
on create, but we forgot the mode; fix that, so that we don't check
perms against the wrong dir.
The Italian keyboard layout is ISO, and unlike the ANSI layout,
it has an extra key between Shift and Z, and the key above Enter,
which becomes vertical, is moved to the bottom left of it.
- the key between Shift and Z is mapped to `<`, and shift+`<` is mapped to `>`
- the old `>` (at the bottom left of Enter) is mapped to `ù`
- shift+`ù` is mapped to `§`
- the old shift+`"` is mapped to `°`
- altgr+`'` is mapped to backtick
- altgr+`ì` is mapped to `~`
- altgr+`e` is mapped to `€`
- shiftaltgr+`[` is mapped to `{`
- shiftaltgr+`]` is mapped to `}`
This seems to have been around but not compiled since the third edition.
Remove it and the accompanying SMBus machinery that is only used
for this driver.
When modifying a sparse file, it's possible to get
clobbers and clears to item s that don't exist; in
this case, we try to apply to an empty kvp, and
assert -- we should just not apply.
void
main(void)
{
uchar a[3];
float f = a[2] | a[1] | (a[0]/1.2);
USED(f);
}
the code above used to generate impossible
code in the linker like:
main: doasm: notfound from=34 to=35 (872) ORL X0,X1
main: doasm: notfound from=34 to=35 (872) ORL X0,X1
main: doasm: notfound from=34 to=35 (872) ORL X0,X1
with the change, the compiler correctly rejects it:
incompatible types: "UINT" and "DOUBLE" for op "OR"
i assume the BNUMBER in the type matrix must have been
a oversight.
do not add default route when address is
deprecated (preflt == 0).
delete previous default route on router change.
implement rfc4862 section 5.5.3 processing rules
in regard to remaining valid lifetime.
In addition to removing expired default routes,
ask devip to clean out expired addresses as well.
In the future, devip might do something more
sophisticated than just checking the valid life time
like also considering if the address is still begin
used by active connections.
we shouldn't need to defer reclamation for procs that
don't actually interact with the tree directly, especially
since if they send on a channel they can stall for a while.
This change covers three improvements:
- inline the limbo entry into the objects
being freed, meaning we don't need to
allocate, and thus can't fail to free
an object when we're out of memory
- Preallocate Bfree objects, for the same
reason above.
the build process could be cleaned up a lot more. the default.*.h headers are
basically only used in cross-compilation, but every usable arch has its default
header already, so all the mkfile effectively does is copy it to $objtype.h. it
would perhaps make more sense to just run mk on any new arch and copy to a new
default.$objtype.h and get rid of a lot of this stuff. but then it's not really
worth messing with this further, so leaving it as is.
We were inserting very oversized deletion messages when
removing a file, instead of inserting the right size
message. This also batches the insertions, reducing the
number of upserts.
37e65b331b
Was to adjust the compiler to better match the ISA w.r.t.
subtraction, but was overzelous and rewrote all additions instead of
just those with constants.
5390130426
Intended to restrict compiler generated immediate operations to only
those of which can be encodable by the ISA. However the check for
signed constants was incorrect and resulted in constants that do not
properly encode.
0c6fd079ce
Attempted to classify address literals to save on instruction
encoding, but this is actually not possible. We have to walk the
program first to derive some of the constants (INITDAT depends on
etext) so we can not classify them here. Instead we should just limit
address literals to 32 bits (with sign extension) as a worst case. It
would be possible in the future to do a pass over to program later and
find address literals that only need one instruction instead of two
but this works for now.
The peeophole optimizer was removing MOVL R0, A0
instructions before BSR (A0) because copyu()
decided all registers are being written (because
function calls clobber the registers).
For indirect calls, the register operand must
be correctly reported as being used (and then
clobbered).
Filesystems should ensure that the mount
spec (aname) is valid before handing out
an auth fid.
This avoids pointless authenticaiton
protocols being run just for the
mount later to fail.
This happens with our current /lib/namespace
file for the opportunistic line:
mount /srv/boot /n/other other
i got rid of redundant code, and added routines
to get the xform matrix out of an rframe, so it
can be stored and used separately or as part of
a composition of xforms.
also replaced the big example in the man page for
more concise, useful ones.
with a global dent cache, directory entries from different
trees can be cached. This almost works, but QID state can
change as the files get modified -- ownership, permissions,
and similar can get changed.
A global mount cache means that changes to a qid may leak
across mount boundaries. Don't do that.
when writing back data blocks, we didn't
read the data back from disk, and instead
just enqueued the block pointer; This means
that we don't have the Blk struct to set
the freed flag on, so we would commit every
IO operation to a data block.
This change opportunistically reaches into
the cache and flags the data block as dead,
so we can skip writeback.
we only need to enforce ordering or syncedness to disk when
writing out the blocks during sync, we don't need to prevent
mutation on the tree once the arenas and superblock are
serialized.
When churning through data blocks and writing out of order, we would
copy blocks and release them often, leading to gaps at the back of
the file. Retrying an allocation could also lead to allocating a block
in the same arena as the metadata.
This would leave gaps in the allocated files, which would cause seeks
when accessing the data later.
This set of changes allocates blocks that are expected to be accessed
sequentially from the start of the arena, and blocks that are expected
to be accessed out of order at the end of the arena.
For full data blocks (ie, where the write is at the end of the block),
we assume that the accesses will be sequential. For partial data blocks,
when the write offset is not at the end of the data block, we assume
that future appends are inbound, and we allocate the block in the non
sequential part of the arena. As a result, when we eventuall fill the
block, we will allocate the sequential block.
This doesn't help us too much if we have writes to files interleaved,
or we overwrite the same section of a file over and over, but it's
better than nothing.
len is ulong, hence &l[-len] makes no sense.
&l[-(uintptr)len] and l - len are correct.
igfx uses a fixed segment to extend its memory when stolen memory is
insufficient for the requested mode. this caused segment allocation
to always fail since no page in the loop would fall within the range.
modesetting then fails but the bottom of the screen stays garbled.
This is a kernel for the NXP LX2160A, specifically the SolidRun
Honeycomb board which is available for sale on the SolidRun
website.
It currently boots on U-Boot. UEFI support is planned. Build or
download the U-Boot firmware from the SolidRun site and then write
it to the on-board SD card. Then, plug in a USB with the honeycomb
image and proceed to install as normal. Only NVMe or USB storage
is supported (SATA is planned).
This kernel supports PCIe and USB. On-board ethernet and SFP are
not supported (yet). It uses 2GB of memory by default, but that
can be increased using *maxmem depending on how much RAM you have
in the system. As well, SMP is currently disabled until an
uncommon deadlock issue is fixed (could be a hardware issue, unknown
at this point).
we copied and pasted the structure of this from
cwfs, but they lay out the bits differently. We
fixed this for the other cases, but forgot this
one, which lead to exec being permitted when it
shouldn't have been.
in out of memory situations, clunkfid could run
out of memory and error; preallocating moves the
error to fscreate/fsopen, which are prepared to
handle them.
vertical scrolling now works in a line-wise manner,
just like in rio(1), sam(1) and friends. horizontal
scrolling showed problems with some line widths
where they got cut before showing the last
characters.
finally, pressing LMB or RMB and swiping while going
through any of the blocks caused a storm of plumbs
and visibility toggling (when over the expander line).
this doesn't happen anymore.
Currently we use millisecond ticks for time spent in each function.
This is not good enough for modern machines where fast functions could
be completed in a handful of nanoseconds. Instead let us just use the
raw ticks and store the cyclecfreq in the output prof data. This
requires that we enlargen the time section in the data to 8 bytes,
which broke the assumptions for struct allignment and required a
slight refactor of the code used to read it in prof(1). Since this is
a breaking change, we've devised a small format to communicate the
version for future revision of this format and this patch includes a
modification to file(1) for recognizing this format. Additionally
some minor improvements were made across the board.
When a function calls itself, the execution slot of its child is now
just added to its own time. This makes conceptual sense and also
reduces a big cause of depth inflation.
Current profiling size was 128k, and causes more frustration than it
is worth as demand paging makes this cheap. Assuming 64 bytes at
worst per Plink this will use ~16M of virtual address space on 64bit
systems.
POWER does not provided subtract immediate functions and
instead rely on negative addition. It was such that the linker
was the one who would go through and rewrite these to be negative
but it really should be done in the compiler while we still have
the width information.
* Add a handful of 64 bit classifications to 9l, along with instruction generation for each.
* 9c should avoid generating immediate instructions for 64 constants.
* libmach should know about 9l's generation to present a better disassembly.
* libmach now properly displays MOVD for moves between registers on 64 bit.
This was leftover from before 6c was
in /sys/src/cmd, as the mkfile adds this
to the include path. Now that we have 6c,
this subdirectory is never used.
Commit 9f755671fb broke
webseeding with the last block.
The haveiece() call at the end was because the inner
is not calling havepiece() on the last block as it
does not take the piece length into account.
Now, instead, fix the inner loop, making the code
more setright foward so we call havepiece() on the
last block.
The transition time in the timezone info file is,
confusingly, in local time and not UTC, so we need
to translate it before we do the comparison.
While we're here, revert the Australian timezone
change that made the offsets UTC, and add some test
to make sure we get this right.
This global "Mss" MIB element does not really exists,
and it makes no sense as the MSS is negotiated
per connection.
Put the InLimbo in the statistics table.
In limbo() function, once tpriv->nlimbo
reaches Maxlimbo, we'd try to re-use
Limbo entries from the head of the hash
chain. However, theres a special case
where our current chain contains only
a single entry. Then Limbo **l; points
to its next pointer, and writing:
*l = lp; would just yield in the entry
being linked to itself, leaking it.
The for(;;) loop in limborexmit() was wrong,
as the "continue" case would not advance
the lp pointer at all, (such as when
tpriv->nlimbo reaches > 100), we'd stop
cleaning out entries.
Handle Fsnewcall() returning nil case,
have to free Limbo *lp as we just removed
it from the hash table.
Add tpriv->nlimbo as "InLimbo" at the
end of /net/tcp/stats.
We where allocating the dialid and acceptid using:
rand()<<16 + rand()
this gives a biased values as rand() retuns a 15-bit
number. Instead, use two calls to nrand() to get
the full 32-bit unsigned range.
the start generation was allocated by calling rand(),
which gives a value between 0 and 2^15.
Instead, make a newgen() function that returns a new
generation id in the full 32-bit range, but also
avoids 0 and Hangupgen special values.
Cleanup and make all helper functions static.
Using > causes the kbmap file to get truncated,
which resets to the default keymap and *THEN*
applies the new change. Which is probably not
what was intended.
The default behaviour of the key labelled as Caps Lock is
to be a Ctrl key, but in some cases in can be desirable
to have it like an actual Caps Lock. A new kbmap file is
added and the keyboard documentation is updated.
git/commit /sys/lib/kbmap/caps /sys/man/6/keybo
We used to only allow a single report per interface,
ignoring queries if a interfce already had a report
in flight.
However, this is not correct. Imagine if there is
a query specific query for a group, we add the
report and then we will ignore all further
queries (general or specific) until that
report times out.
Instead, we should maintain the timeout (report)
for each group (and interface) individually.
This means, Report.multi must point to a *single*
Ipmulti. When we handle general queries,
we must create individual Reports for
each of our multicast addresses, but check if
such a report already exists (for that interface).
Because the individual check is basically
quadratic, organise the reports in a hash table
to make finding the existing reports per group
per interface cheaper.
The semacquire allocates a Rendez struct on its stack,
and publishes it on the semaphore linked list in the
segment.
Before returning, it removes it again, properly taking
the locks protecting the linked list, so whats the issue?
The issue happens when procinterrupt() does the wakeup,
which does not care about the spinlock of the segment
lined list, and it does it in the following way:
p->r = nil;
r->p = nil;
ready(p);
unlock(r);
Note that the unlock happens *after* the ready.
So the process could'v already run on another core, remove
itself from the segment list and get out of semacquire()
alltogether, but we still have one line to execute here,
which is the unlock() of the now free'd Rendez.
And that was causing the stack corruption!
So wakeup() and procinterrupt() always had this issue.
If the Rendez memory stays valid after the wakeup,
here is no issue. Most code just uses &up->sleep,
which will stay valid as Proc's are never freed.
The solution for now is to do the ready() as the
last step, not touching the resource after the final
unlock.
up->nerrlab is initialized to zero in newproc(),
and we make sure that the syscall handler returns
with up->nerrlan == 0 as well.
If we are paranoid, we can put a check in kenter().
I have a edirol usb 1.1 soundcard:
ep4.0: audio csp 0x000101 vid 0x08bb did 0x2902 'Burr-Brown from TI ' 'USB Audio CODEC ' 76dd2 xhci
Recent code changes produce the following errors
and seems to leave some volume controls empty,
causing later a division by zero crash.
getvalue: mute: cur: Stall Error
getvalue: volume: cur: Stall Error
getvalue: volume: cur: Stall Error
...
audio 269: suicide: sys: trap: divide error pc=0x201b25
The device doesnt appear to have digital
volume controls or anything so i'm not really
interested in getting it to work :)
Just getting rid of the crash. The device works
otherwise fine:
% for(i in /dev/audioctlU* /dev/audiostatU*){echo $i; cat $i;}
/dev/audioctlU76dd2
out on
in on
/dev/audiostatU76dd2
bufsize 0 buffered 0
fmtout u8c1r32000 u8c1r44100 u8c1r48000 u8c2r32000 u8c2r44100 u8c2r48000 s8c1r32000 s8c1r44100 s8c1r48000 s8c2r32000 s8c2r44100 s8c2r48000 s16c1r32000 s16c1r44100 s16c1r48000 s16c2r32000 s16c2r44100 s16c2r48000
fmtin s8c1r11025 s8c2r11025 s16c1r11025 s16c2r11025 s8c1r8000 s8c2r8000 s8c1r16000 s8c2r16000 s16c1r16000 s16c2r16000 s16c1r22050 s16c2r22050 s16c1r32000 s16c2r32000 s16c1r44100 s16c2r44100 s16c1r48000 s16c2r48000
* copy _callmain structure from libc
* assembly functions without a prelude can not be profiled
* add missing files for profiling on some archs
* reduce minor style differences between ape/libc profile code
This is pleminary work of replacing "speed" with "fmtout"/"fmtin"
through the entire system.
Switching between output devices with different PCM formats
back and forth now works as expected.
To implement keyboard input timeout, we used
to poll the keyboard in a loop with a 100ms
sleep in between using INT 0x15 WAIT BIOS call.
But it seems iPXE breaks the BIOS call, making
it just hang.
The BIOS has a 32-bit tick counter at
040:006C that has a period of 54.9254ms.
Using that instead of the WAIT call appears to be
more reliable and makes it work in iPXE.
Implementation note:
Because the counter has a wrap around value
at non-power-of-two, only check if the counter changed
and counting down the millisecond timeout when it did.
When the interface is specified as "-",
we should find the interface based on
the gateway and source ip.
As another improvement, also allow
specifying the interface as the bound
device name (for example "/net/ether0").
- automatically choose configuration with the format closest to the
s16c2r44100
- allow independent in/out formats to be configured (mono mic with
lower rate will work)
- provide "fmtout" and "fmtin" via /dev/volumeU*; those can be changed
by writing to /dev/volumeU*
- expose some of the useful controls (volume, mute etc), if available,
via /dev/volumeU
- add "in on/off" and "out on/off" via /dev/audioctlU* for
input/output toggling, which helps with headsets that force low
quality on both
- expose supported intput/output formats via /dev/audiostatU*
Tested with:
- vid 0x1b3f did 0x2008 GeneralPlus 'USB Audio Device'
(audio 1.0, in + out)
- vid 0x14ed did 0x3004 Shure 'Shure AONIC 50 USB Hi-Res'
(audio 2.0, out only)
- vid 0x14ed did 0x3003 'Shure Inc' 'Shure AONIC 50 USB'
(audio 1.0, headset, in + out)
Known issues:
- on MNT Reform, changing rate to 48kHz on GeneralPlus results in
silence on the output if the device is connected to either of the
closest (to the user) usb ports; it works well with the one closer to
the back
full speed assumes 1ms between the frames, but with high
speeds the (micro)frames are 125us between.
Adjust accordingly.
This fixed playback on my usb audio 2.0 headset connected
to Reform's xhci hub port.
This patch implements two specific behaviors of Dubeolsik layout.
dubeollkup function makes Jongseong(final consonant) to be treated as
Choseong(initial consonant) when possible. For example, QWERTY input
"zhem" in Dubeolsik has to be "코드", not "콛ㅡ" where switched
Jongseong is "ㄷ".
dubeolbksp function emits out syllable remaining after single
backspace. So when user presses backspace on "코드", the expected output
is "코ㄷ", still allowing user to edit latter syllable, rather than
"코" without dubeolbksp. This should only apply to last syllable
considering it's de facto in Dubeolsik implementations.
* scrollbar and mouse selection of candidate
* arrow keys for moving selection cursor after first completion
* user defined dictionaries that are merged on top
* document using the plumber to change languages
* loop candidates when reaching the start/end of the list.
* skk2ktrans was using the wrong from encoding
On modern machines, doing a empty loop
is too fast, resulting in us using the
maximum loopconst of 1000000 and getting
wrong delay() timings.
To fix the timings, use a chain of IDIVQ
instructions instead.
The loop timings is going to be measured
using the TSC, so the exact timing doesnt
need to be known.
Rename aamloop() to delayloop() as it does
different things depending on 386 or amd64.
Both qflush() and qdiscard() appear to
be interrupt level, and must not call
the kick routine of the queue, see
the deadlock in tcp:
0xffffffff80f2fb10 304: loopbackread cinap_lenrek pc 0xffffffff8019a053 kproc (Queueing) ut 0 st 1959 qpc 0xffffffff8014f98e
gotolabel()+0x0 /sys/src/9/pc64/l.s:573
procswitch()+0x50 /sys/src/9/port/proc.c:161
sched()+0xed /sys/src/9/port/proc.c:214
qlock(q=0xffffffff8283ab48)+0x14f /sys/src/9/port/qlock.c:108
tcpkick()+0x5a /sys/src/9/ip/tcp.c:593
iunlock_reader(q=0xffffffff820d1e48)+0x3b /sys/src/9/port/qio.c:480
qdiscard(q=0xffffffff820d1e48,len=0xffffffff00000001)+0x53 /sys/src/9/port/qio.c:1188
update(seg=0xffffffff80f2f968,s=0xffffffff8283ab48)+0x16b /sys/src/9/ip/tcp.c:2032
tcpiput(tcp=0xffffffff809ea2b8,bp=0xffffffff823150c8,ifc=0xffffffff80f39850)+0x1107 /sys/src/9/ip/tcp.c:2387
ipmuxiput(bp=0xffffffff823150c8,ifc=0xffffffff80f39850)+0xa6 /sys/src/9/ip/ipmux.c:765
ipiput4(bp=0xffffffff823150c8,ifc=0xffffffff80f39850,f=0xffffffff809ef7f8)+0x5d9 /sys/src/9/ip/ip.c:408
loopbackread()+0x100 /sys/src/9/ip/loopbackmedium.c:100
linkproc()+0x19 /sys/src/9/port/proc.c:1569
There is a unlikely race condition when a
process does addbroken(). Due to the
state being set *after* qunlock().
If the process gets preempted just after qunlock(),
it gets put back in the runqueue in Ready state.
Another process can then unbreak() or
release the process, calling ready()
again on the process (causing a warning
for double-ready) and removing the process
from the broken.p list.
Now the original process resumes and
puts itself in Broken state. Now it is out
of the broken list but in Broken state.
So becomes un-killable by unbreak().
The fix is to mark the process as Broken
before unlocking and changing the QLock
into a Lock which inhibits preemption.
The up->ureg pointer points to the last delivered
note in the user-space stack.
On exec(), all the notes are cleared and the
ureg pointer should be zeroed as well as it
points into the previous programs stack.
Note, this can only happen if someone does
exec() from a note handler.
When we pexit(), also zero the up->ureg and up->dbgreg
as we are about to release the memory segments
and nobody should debugging user-space anymore.
In commit eaffa1ef55
(which fixed some bugs in the efd scheduling code),
the cooperating scheduling got removed accidentially.
This was not the intention, so bring it back.
Try to pick the closest (but higher) rate. If there are none,
pick a lower one.
Mixfs is able to convert to whichever rate, so this should
make plenty of new audio devices work.