The NetBSD Project

CVS log for src/sys/arch/xen/xen/xen_clock.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / arch / xen / xen

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.18 / (download) - annotate - [select for diffs], Sun Sep 10 15:23:01 2023 UTC (5 months, 1 week ago) by bouyer
Branch: MAIN
CVS Tags: thorpej-ifq-base, thorpej-ifq, thorpej-altq-separation-base, thorpej-altq-separation, HEAD
Changes since 1.17: +20 -8 lines
Diff to previous 1.17 (colored)

If Xen system time went backward, instead of ignoring the event assume
one tick passed and reinitialise the local state.
If we need to call the hardclock timer several time to catch up missed events,
don't do more than one second in a single event; and schedule the next
event faster.

Hopefully fixes occasionnal
panic: cpu1: time has not advanced in 1501 heartbeats
or
panic: cpu0: softints stuck for 16 seconds
seen in daily Xen atf runs.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Aug 1 20:11:13 2023 UTC (6 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.16: +6 -5 lines
Diff to previous 1.16 (colored)

xen: Fix previous commit, forgot to amend it before committing.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Aug 1 19:36:57 2023 UTC (6 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.15: +20 -2 lines
Diff to previous 1.15 (colored)

xen: Report when hardclock jump exceeds timecounter(9) limit.

Revision 1.15 / (download) - annotate - [select for diffs], Fri Jul 28 10:39:14 2023 UTC (6 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.14: +15 -3 lines
Diff to previous 1.14 (colored)

xen_clock(4): New hardclock dtrace probes.

sdt:xen:hardclock:tick(last, now)
  fires on every hardclock tick

sdt:xen:hardclock:jump(last, now, nticks)
  fires on every hardclock tick when (now - last) >= 2*NS_PER_TICK,
  i.e., this call to the timer interrupt handler requires multiple
  hardclock ticks

Revision 1.14 / (download) - annotate - [select for diffs], Fri Jul 28 10:39:01 2023 UTC (6 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.13: +8 -7 lines
Diff to previous 1.13 (colored)

xen_clock(4): Compute NS_PER_TICK only once per call.

This involves a division by an unknown number, so let's cache it.

XXX Could do better by precomputing it in xen_resumeclocks, with some
effort to ensure concurrent calls don't stomp on each other.

Revision 1.13 / (download) - annotate - [select for diffs], Fri Jul 28 10:38:44 2023 UTC (6 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.12: +35 -5 lines
Diff to previous 1.12 (colored)

xen_clock(4): Fix whitespace and sprinkle comments.

No functional change intended.

Revision 1.8.18.1 / (download) - annotate - [select for diffs], Wed Jul 19 14:31:40 2023 UTC (7 months ago) by martin
Branch: netbsd-10
CVS Tags: netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1
Changes since 1.8: +4 -3 lines
Diff to previous 1.8 (colored) next main 1.9 (colored)

Pull up following revision(s) (requested by bouyer in ticket #238):

	sys/arch/xen/xen/xen_clock.c: revision 1.10
	sys/arch/xen/xen/xen_clock.c: revision 1.12

Unmask event after VCPUOP_stop_periodic_timer and
initializing ci->ci_xen_hardclock_systime_ns, to avoid a possible race with
xen_timer_handler()

Unmask event after arming the one-shot timer in clock initialisation,
to avoid a possible race with xen_timer_handler() updating
ci_xen_hardclock_systime_ns while we're reading it.

Pointed out by Taylor R Campbell

Revision 1.12 / (download) - annotate - [select for diffs], Mon Jul 17 10:12:54 2023 UTC (7 months, 1 week ago) by bouyer
Branch: MAIN
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored)

Unmask event after arming the one-shot timer in clock initialisation,
to avoid a possible race with xen_timer_handler() updating
ci_xen_hardclock_systime_ns while we're reading it.
Pointed out by Taylor R Campbell

Revision 1.11 / (download) - annotate - [select for diffs], Thu Jul 13 13:34:15 2023 UTC (7 months, 1 week ago) by riastradh
Branch: MAIN
Changes since 1.10: +26 -7 lines
Diff to previous 1.10 (colored)

xen: Record event when local view of timecounter is behind global.

Revision 1.10 / (download) - annotate - [select for diffs], Fri Jul 7 15:13:41 2023 UTC (7 months, 2 weeks ago) by bouyer
Branch: MAIN
Changes since 1.9: +4 -3 lines
Diff to previous 1.9 (colored)

Unmask event after VCPUOP_stop_periodic_timer and
initializing ci->ci_xen_hardclock_systime_ns, to avoid a possible race with
xen_timer_handler()

Revision 1.9 / (download) - annotate - [select for diffs], Mon May 1 09:03:19 2023 UTC (9 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.8: +78 -11 lines
Diff to previous 1.8 (colored)

xen_clock(4): Sprinkle dtrace probes.

Revision 1.7.2.1 / (download) - annotate - [select for diffs], Mon Dec 14 14:38:04 2020 UTC (3 years, 2 months ago) by thorpej
Branch: thorpej-futex
Changes since 1.7: +5 -5 lines
Diff to previous 1.7 (colored) next main 1.8 (colored)

Sync w/ HEAD.

Revision 1.8 / (download) - annotate - [select for diffs], Mon Nov 30 17:05:02 2020 UTC (3 years, 2 months ago) by bouyer
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, netbsd-10-base, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, bouyer-sunxi-drm-base, bouyer-sunxi-drm
Branch point for: netbsd-10
Changes since 1.7: +5 -5 lines
Diff to previous 1.7 (colored)

Switch some debug/informational printf to device_printf(). Usefull
for multiprocessor environnement.

Revision 1.7 / (download) - annotate - [select for diffs], Fri May 22 17:44:05 2020 UTC (3 years, 9 months ago) by riastradh
Branch: MAIN
Branch point for: thorpej-futex
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

Set frame = NULL in XENPV whether DIAGNOSTIC or not.

For Xen PV, the interrupt logic stores the relevant information in
the CPU's struct cpu_info, and CLKF_USERMODE and CLKF_PC don't use
the frame argument at all.  (For Xen PVH, we behave like normal x86
and use the frame as passed.)

DIAGNOSTIC shouldn't change the data flows that affect non-DIAGNOSTIC
logic, so let's just unconditionally set frame = NULL for XENPV.  If
this makes a difference, that's a bug -- and it's a bug that should
not be concealed by enabling DIAGNOSTIC.

ok bouyer

Revision 1.6 / (download) - annotate - [select for diffs], Thu May 21 21:12:31 2020 UTC (3 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.5: +5 -14 lines
Diff to previous 1.5 (colored)

- Recalibrate the APIC timer using the TSC, once the TSC has in turn been
  recalibrated using the HPET.  This gets the clock interrupt firing more
  closely to HZ.

- Undo change with recent Xen merge and go back to starting the clocks in
  initclocks() on the boot CPU, and in cpu_hatch() on secondary CPUs.

- On reflection don't use HPET delay any more, it works very well but means
  going over the bus.  It's enough to use HPET to calibrate the TSC and
  APIC.

Tested on amd64 native, xen and xen PVH.

Revision 1.5 / (download) - annotate - [select for diffs], Thu May 7 19:48:57 2020 UTC (3 years, 9 months ago) by bouyer
Branch: MAIN
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

Change event_set_handler() to take the target CPU parameter. If ci is NULL,
  event_set_handler() will choose the CPU and bind the event.
  If ci is not NULL the caller is responsible for binding the event.
Use a IPI xcall to register the handlers if needed.
pull in a hack from x86 to force pirq handlers to be mpsafe if registered at
a level != IPL_VM. This is for the com at isa interrupt handler, which
registers at IPL_HIGH and has to way to tell it's mpsafe (taking
KERNEL_LOCK at IPL_HIGH causes deadlocks on MP systems).

Revision 1.4 / (download) - annotate - [select for diffs], Sat May 2 16:44:36 2020 UTC (3 years, 9 months ago) by bouyer
Branch: MAIN
Changes since 1.3: +17 -20 lines
Diff to previous 1.3 (colored)

Introduce Xen PVH support in GENERIC.
This is compiled in with
options XENPVHVM
x86 changes:
- add Xen section and xen pvh entry points to locore.S. Set vm_guest
  to VM_GUEST_XENPVH in this entry point.
  Most of the boot procedure (especially page table setup and switch to
  paged mode) is shared with native.
- change some x86_delay() to delay_func(), which points to x86_delay() for
  native/HVM, and xen_delay() for PVH

Xen changes:
- remove Xen bits from init_x86_64_ksyms() and init386_ksyms()
  and move to xen_init_ksyms(), used for both PV and PVH
- set ISA no-legacy-devices property for PVH
- factor out code from Xen's cpu_bootconf() to xen_bootconf()
  in xen_machdep.c
- set up a specific pvh_consinit() which starts with printk()
  (which uses a simple hypercall that is available early) and switch to
  xencons when we can use pmap_kenter_pa().

Revision 1.3 / (download) - annotate - [select for diffs], Sun Apr 26 20:41:30 2020 UTC (3 years, 9 months ago) by roy
Branch: MAIN
Changes since 1.2: +4 -2 lines
Diff to previous 1.2 (colored)

Guard xen_wallclock with XENPV.

Thanks to riastradh@

Revision 1.2 / (download) - annotate - [select for diffs], Sat Apr 25 15:26:18 2020 UTC (3 years, 9 months ago) by bouyer
Branch: MAIN
Changes since 1.1: +1013 -0 lines
Diff to previous 1.1 (colored)

Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor

Revision 1.1.2.4 / (download) - annotate - [select for diffs], Sun Apr 19 19:39:11 2020 UTC (3 years, 10 months ago) by bouyer
Branch: bouyer-xenpvh
Changes since 1.1.2.3: +3 -3 lines
Diff to previous 1.1.2.3 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

Add per-PIC callbacks for interrupt_get_devname(), interrupt_get_assigned()
and interrupt_get_count(). Implement Xen-specific callbacks for
PIC_XEN and use the x86 one for others.
In event_set_handler(), call intr_allocate_io_intrsource() so that
events appears in interrupt list (intrctl list).

Revision 1.1.2.3 / (download) - annotate - [select for diffs], Sat Apr 18 15:06:18 2020 UTC (3 years, 10 months ago) by bouyer
Branch: bouyer-xenpvh
Changes since 1.1.2.2: +28 -28 lines
Diff to previous 1.1.2.2 (colored) to branchpoint 1.1 (colored)

Add PVHVM multiprocessor support:
We need the hypervisor to be set up before cpus attaches.
Move hypervisor setup to a new function xen_hvm_init(), called at the
beggining of mainbus_attach(). This function searches the cfdata[] array
to see if the hypervisor device is enabled (so you can disable PV
support with
disable hypervisor
from userconf).
For HVM, ci_cpuid doens't match the virtual CPU index needed by Xen.
Introduce ci_vcpuid to cpu_info. Introduce xen_hvm_init_cpu(), to be
called for each CPU in in its context, which initialize ci_vcpuid and
ci_vcpu, and setup the event callback.
Change Xen code to use ci_vcpuid.

Do not call lapic_calibrate_timer() for VM_GUEST_XENPVHVM, we will use
Xen timers.

Don't call lapic_initclocks() from cpu_hatch(); instead set
x86_cpu_initclock_func to lapic_initclocks() in lapic_calibrate_timer(),
and call *(x86_cpu_initclock_func)() from cpu_hatch().
Also call x86_cpu_initclock_func from cpu_attach() for the boot CPU.
As x86_cpu_initclock_func is called for all CPUs, x86_initclock_func can
be a NOP for lapic timer.

Reorganize Xen code for x86_initclock_func/x86_cpu_initclock_func.
Move x86_cpu_idle_xen() to hypervisor_machdep.c

Revision 1.1.2.2 / (download) - annotate - [select for diffs], Thu Apr 16 20:21:44 2020 UTC (3 years, 10 months ago) by bouyer
Branch: bouyer-xenpvh
Changes since 1.1.2.1: +124 -124 lines
Diff to previous 1.1.2.1 (colored) to branchpoint 1.1 (colored)

MOve the #ifdef XENPV block to the end, so that XEN3_DOM0 builds again.

Revision 1.1.2.1 / (download) - annotate - [select for diffs], Thu Apr 16 19:23:50 2020 UTC (3 years, 10 months ago) by bouyer
Branch: bouyer-xenpvh
Changes since 1.1: +1013 -0 lines
Diff to previous 1.1 (colored)

Rename xen/xen/clock.c to xen_clock.c, so that it can be compiled
with x86/isa/clock.c
call events_default_setup() from hypervisor_match to that event
arrays are properly initialised.
Use xen_delay() and xen's timecounter for PVHVM.

Revision 1.1, Thu Apr 16 19:23:50 2020 UTC (3 years, 10 months ago) by bouyer
Branch: MAIN
CVS Tags: phil-wifi-20200421, bouyer-xenpvh-base2, bouyer-xenpvh-base1
Branch point for: bouyer-xenpvh
FILE REMOVED

file xen_clock.c was initially added on branch bouyer-xenpvh.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>