History log of /openbsd/sys/arch/mips64/mips64/clock.c (Results 1 – 25 of 54)
Revision Date Author Comments
# bb00e811 24-Oct-2023 claudio <claudio@openbsd.org>

Normally context switches happen in mi_switch() but there are 3 cases
where a switch happens outside. Cleanup these code paths and make the
machine independent.

- when a process forks (fork, tfork,

Normally context switches happen in mi_switch() but there are 3 cases
where a switch happens outside. Cleanup these code paths and make the
machine independent.

- when a process forks (fork, tfork, kthread), the new proc needs to
somehow be scheduled for the first time. This is done by proc_trampoline.
Since proc_trampoline is machine dependent assembler code change
the MP specific proc_trampoline_mp() to proc_trampoline_mi() and make
sure it is now always called.
- cpu_hatch: when booting APs the code needs to jump to the first proc
running on that CPU. This should be the idle thread for that CPU.
- sched_exit: when a proc exits it needs to switch away from itself and
then instruct the reaper to clean up the rest. This is done by switching
to the idle loop.

Since the last two cases require a context switch to the idle proc factor
out the common code to sched_toidle() and use it in those places.

Tested by many on all archs.
OK miod@ mpi@ cheloha@

show more ...


# 0ed1bf01 17-Sep-2023 cheloha <cheloha@openbsd.org>

clockintr: remove clockintr_init(), clockintr_flags

All the state initialization once done in clockintr_init() has been
moved to other parts of the kernel. It's a dead function. Remove it.

Likewi

clockintr: remove clockintr_init(), clockintr_flags

All the state initialization once done in clockintr_init() has been
moved to other parts of the kernel. It's a dead function. Remove it.

Likewise, the clockintr_flags variable no longer sports any meaningful
flags. Remove it. This frees up the CL_* flag namespace, which might
be useful to the clockintr frontend if we ever need to add behavior
flags to any of those functions.

show more ...


# b3ef18bd 14-Sep-2023 cheloha <cheloha@openbsd.org>

clockintr: replace CL_RNDSTAT with global variable statclock_is_randomized

In order to separate the statclock from the clock interrupt subsystem
we need to move all statclock state out into the broa

clockintr: replace CL_RNDSTAT with global variable statclock_is_randomized

In order to separate the statclock from the clock interrupt subsystem
we need to move all statclock state out into the broader kernel.

Start by replacing the CL_RNDSTAT flag with a new global variable,
"statclock_is_randomized", in kern_clock.c. Update all clockintr_init()
callers to set the boolean instead of passing the flag.

Thread: https://marc.info/?l=openbsd-tech&m=169428749720476&w=2

show more ...


# 11d1f9b2 23-Aug-2023 cheloha <cheloha@openbsd.org>

all platforms: separate cpu_initclocks() from cpu_startclock()

To give the primary CPU an opportunity to perform clock interrupt
preparation in a machine-independent manner we need to separate the
"

all platforms: separate cpu_initclocks() from cpu_startclock()

To give the primary CPU an opportunity to perform clock interrupt
preparation in a machine-independent manner we need to separate the
"initialization" parts of cpu_initclocks() from the "start the clock
interrupt" parts. Currently, cpu_initclocks() does everything all at
once, so there is no space for this MI setup.

Many platforms have more-or-less already done this separation by
implementing a separate routine named "cpu_startclock()". This patch
promotes cpu_startclock() from de facto standard to mandatory API.

- Prototype cpu_startclock() in sys/systm.h alongside cpu_initclocks().
The separation of responsibility between the two routines is a bit
fuzzy but the basic guidelines are as follows:

+ cpu_initclocks() must initialize hz, stathz, and profhz, and call
clockintr_init().

+ cpu_startclock() must call clockintr_cpu_init() and start the clock
interrupt cycle on the calling CPU.

These guidelines will shift in the future, but that's the way things
stand as of *this* commit.

- In initclocks(): first call cpu_initclocks(), then do MI setup, and
last call cpu_startclock().

- On platforms where cpu_startclock() already exists: don't call
cpu_startclock() from cpu_initclocks() anymore.

- On platforms where cpu_startclock() doesn't yet exist: implement it.
Usually this is as simple as dividing cpu_initclocks() in two.

Tested on amd64 (i8254, lapic), arm64, i386 (i8254, lapic), macppc,
mips64/octeon, and sparc64. Tested on arm/armv7 (agtimer(4)) by
phessler@ and jmatthew@. Tested on m88k/luna88k by aoyama@. Tested
on powerpc64 by gkoehler@ and mlarkin@. Tested on riscv64 by
jmatthew@.

Thread: https://marc.info/?l=openbsd-tech&m=169195251322149&w=2

show more ...


# 53687035 18-Jan-2023 cheloha <cheloha@openbsd.org>

mips64: simplify cp0_rearm_int5(), cp0_trigger_int5_masked()

The tangle of branches in cp0_rearm_int5() can be simplified to:

if cycles <= t1 - t0, we missed

We can simplify cp0_trigger_int5_mask

mips64: simplify cp0_rearm_int5(), cp0_trigger_int5_masked()

The tangle of branches in cp0_rearm_int5() can be simplified to:

if cycles <= t1 - t0, we missed

We can simplify cp0_trigger_int5_masked() in the same way.

ok visa@

show more ...


# a5b656f8 05-Dec-2022 visa <visa@openbsd.org>

Use evcount_percpu() with mips64 clock and ipi interrupt counters.

OK jca@ cheloha@


# f124c57c 19-Nov-2022 cheloha <cheloha@openbsd.org>

mips64, loongson, octeon: switch to clockintr

- Remove mips64-specific clock interrupt scheduling bits from cpu_info.
- Add missing tick_nsec initialization to cpu_initclocks().
- Disable the glxclk

mips64, loongson, octeon: switch to clockintr

- Remove mips64-specific clock interrupt scheduling bits from cpu_info.
- Add missing tick_nsec initialization to cpu_initclocks().
- Disable the glxclk interrupt clock on loongson. visa@/miod@ say it
can be removed later if it isn't useful for anything else.
- Wire up cp0_intrclock.

Notes:

- The loongson apm_suspend() changes are untested, but deraadt@ claims
APM suspend/resume on loongson doesn't work anyway.
- loongson and octeon now have a randomized statclock(), stathz = hz.

With input from miod@, visa@. Tested by miod@, visa@.

Link: https://marc.info/?l=openbsd-tech&m=166776379603497&w=2

ok visa@ mlarkin@

show more ...


# 1cad7fde 31-Oct-2022 visa <visa@openbsd.org>

mips64: Raise SPL for hardclock()

This lets the MI clock interrupt code see the correct SPL.

The full splx() is skipped because the updating of the hardware interrupt
masks should not be needed her

mips64: Raise SPL for hardclock()

This lets the MI clock interrupt code see the correct SPL.

The full splx() is skipped because the updating of the hardware interrupt
masks should not be needed here.

Prompted by and OK cheloha@

show more ...


# 85caa4b9 22-Aug-2022 cheloha <cheloha@openbsd.org>

mips64, octeon, loonson: trigger deferred clock interrupts from splx(9)

As with powerpc, powerpc64, and riscv64, on mips64 platforms we need
to isolate the clock interrupt schedule from the MD clock

mips64, octeon, loonson: trigger deferred clock interrupts from splx(9)

As with powerpc, powerpc64, and riscv64, on mips64 platforms we need
to isolate the clock interrupt schedule from the MD clock interrupt
code. To do this, we need to stop deferring clock interrupt work
until the next tick and instead defer the work until we logically
unmask the clock interrupt from splx(9).

Add a boolean (ci_clock_deferred) to the cpu_info struct to note
whether we need to trigger the clock interrupt by hand, and then
do so from splx(9) by calling md_triggerclock().

Currently md_triggerclock is only ever set to cp0_trigger_int5(). The
routine takes great care to ensure that INT5 has fired or will fire
before returning.

There are some loongson machines that use glxclk instead of CP0. They
can be switched to use CP0 later.

With input and advice from visa@ and miod@.

Compiled and extensively tested by visa@ and miod@ on various octeon
and loongson machines. No issues seen on octeon machines. miod@ saw
some odd things on loongsoon, but suggests that all issues are
probably unrelated to this patch.

Link: https://marc.info/?l=openbsd-tech&m=165929192702632&w=2

ok visa@, miod@

show more ...


# 471aeecf 06-Apr-2022 naddy <naddy@openbsd.org>

constify struct cfattach


# bfc185c1 01-May-2021 visa <visa@openbsd.org>

Retire OpenBSD/sgi.

OK deraadt@


# ce81117b 04-Mar-2021 visa <visa@openbsd.org>

Update clock interrupt count atomically.

This avoids errors that can arise when multiple cores update the
variable at the same time.


# f7542e3c 30-Jun-2020 visa <visa@openbsd.org>

Retire unused <mips64/dev/clockvar.h> interface.


# b43ebd13 06-Mar-2016 mpi <mpi@openbsd.org>

Rename mips64's trap_frame into trapframe.

For coherency with other archs and in order to use it in MI code.

ok visa@, tobiasu@


# 989cf5dc 01-May-2015 miod <miod@openbsd.org>

Do not grab the kernel lock for clock interrupts. Help and ok kettenis@


# 08be1c18 03-Jun-2013 guenther <guenther@openbsd.org>

Convert some internal APIs to use timespecs instead of timevals

ok matthew@ deraadt@


# 7b6ae6a5 03-Oct-2012 miod <miod@openbsd.org>

Split ever-growing mips <machine/cpu.h> into what 99% of the kernel needs,
which will remain in <machine/cpu.h>, and a new mips_cpu.h containing only the
goriest md details, which are only of interes

Split ever-growing mips <machine/cpu.h> into what 99% of the kernel needs,
which will remain in <machine/cpu.h>, and a new mips_cpu.h containing only the
goriest md details, which are only of interest to a handful set of files; this
is similar in spirit to what alpha does, but here <machine/cpu.h> does not
include the new file.

show more ...


# 19fc6073 14-Jul-2012 miod <miod@openbsd.org>

Split the existing mips64 clock code into time-of-day and generic duties in
machdep.c, and internal clock interrupting on level 5, still in clock.c; this
will allow other clock sources to be used in

Split the existing mips64 clock code into time-of-day and generic duties in
machdep.c, and internal clock interrupting on level 5, still in clock.c; this
will allow other clock sources to be used in the near future. (delay() will
remain tied to the internal clock)

show more ...


# 7db2ec6c 10-Jul-2011 miod <miod@openbsd.org>

Do not register the per-cpu counter as a system timecounter on MULTIPROCESSOR
kernels, as there is no way to sync the counters between all processors.


# 09ba1a9d 10-May-2011 syuu <syuu@openbsd.org>

octeon's internal counter clock speed is same as the processor clock. ok miod@


# 4667bebb 20-Sep-2010 matthew <matthew@openbsd.org>

Get rid of evcount's support for arranging counters in a tree
hierarchy. Everything attached to a single root node anyway, so at
best we had a bush.

"i think it is good" deraadt@


# 1c8c6138 28-Feb-2010 miod <miod@openbsd.org>

Add an explicit `delay constant' member to struct cpu_info, so that it can
be decoupled from the nominal processor speed.
While there, make sure delay() gets a proper delay constant if invoked before

Add an explicit `delay constant' member to struct cpu_info, so that it can
be decoupled from the nominal processor speed.
While there, make sure delay() gets a proper delay constant if invoked before
cpu0 attaches (how could I miss that when introducing struct cpu_hwinfo?!?)

show more ...


# c301e791 09-Jan-2010 miod <miod@openbsd.org>

Define struct cpu_hwinfo, to hold hardware specific information about each
processor (instead of sys_config.cpu[]), and pass it in the attach_args
when attaching cpu devices.

This allows per-cpu inf

Define struct cpu_hwinfo, to hold hardware specific information about each
processor (instead of sys_config.cpu[]), and pass it in the attach_args
when attaching cpu devices.

This allows per-cpu information to be gathered late in the bootstrap process,
and not be limited by an arbitrary MAX_CPUS limit; this will suit IP27 and
IP35 systems better.

While there, use this information to make sure delay() uses the speed
information from the cpu it is invoked on.

show more ...


# 7d157f4a 28-Dec-2009 syuu <syuu@openbsd.org>

MP-safe pmap implemented, enable IPI in interrupt handler to avoid deadlock.
ok miod@


# 05dbc6e4 26-Nov-2009 syuu <syuu@openbsd.org>

Now IPI can interrupt to clock interrupt handler.
It prevents deadlock with TLB shootdown and clock interrupt.
ok miod@


123