On Fri, Jul 21 2023, Mike Larkin <mlar...@nested.page> wrote: > On Fri, Jul 21, 2023 at 05:46:32PM +0200, Jeremie Courreges-Anglas wrote: >> On Thu, Jul 20 2023, Scott Cheloha <scottchel...@gmail.com> wrote: >> > On Wed, Jul 19, 2023 at 05:09:04AM +0000, Mike Larkin wrote: >> >> On Tue, Jul 18, 2023 at 08:21:41AM -0500, Scott Cheloha wrote: >> >> > This patch moves the profil(2)- and GPROF-specific parts of >> >> > statclock() out into into separate clock interrupt routines. The >> >> > profil(2) part moves into profclock() and is enabled/disabled as >> >> > needed during mi_switch(). The GPROF part moves into gmonclock() and >> >> > is enabled/disabled as needed via sysctl(2). >> >> > >> >> > Moving those parts out of statclock() eliminates the need for an >> >> > effective statclock frequency and we can delete all the junk related >> >> > to that: psratio/psdiv/pscnt and corresponding members of >> >> > schedstate_percpu, clockintr_setstatclockrate(), a bunch of other >> >> > clockintr-internal code >> >> > >> >> > In separate commits I have addressed: >> >> > >> >> > - General GPROF instability on amd64 >> >> > - GPROF causing a crash during suspend/resume >> >> > - CTASSERT breakage on amd64 related to schedstate_percpu >> >> > changes in this patch >> >> > >> >> > This has been kicking around for over two months. Personally, I have >> >> > tested it on amd64, arm64, macppc, octeon, and sparc64. >> >> > >> >> > Compile- and boot-tests on other platforms (alpha, i386, luna88k, >> >> > riscv64, sh) would be appreciated, but the last time I asked for tests >> >> > I got zero reports back. >> >> >> >> i386 compiles and boots. >> > >> > Great! >> > >> >> as reported in separate mail, riscv64 doesn't compile. >> > >> > I think we're missing a 'struct user' definition on riscv64. Can you >> > try this? >> >> GENERIC.MP with option GPROF doesn't build on riscv64, but this diff >> doesn't introduce any new error. Runtime untested. >> >> -- >> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE >> > > Yes, I should have pointed out I did a normal build and not a GPROF build > which I have no idea how to test, nor do I use. Same disclaimer applies to > i386.
To test-build this, I merely added: makeoptions PROF="-pg" option GPROF to a GENERIC.MP copy and then booted that kernel. Scott, your statclock diff doesn't seem to make the runtime behavior any worse on riscv64 (ie it's broken, but maybe my profile.h fix isn't right). [...] nvme0 at pci6 dev 0 function 0 "Samsung PM991 NVMe" rev 0x00: intx, NVMe 1.4 nvme0: Samsung SSD 980 500GB, firmware 1B4QFXO7, serial S64DNF0R618716X scsibus0 at nvme0: 2 targets, initiator 0 sd0 at scsibus0 targ 1 lun 0: <NVMe, Samsung SSD 980, 1B4Q> sd0: 476940MB, 512 bytes/sector, 976773168 sectors ppb6 at pci2 dev 8 function 0 "ASMedia ASM2824" rev 0x01: intx pci7 at ppb6 bus 7 "hfclk" at mainbus0 not configured "rtcclk" at mainbus0 not configured "gpio-poweroff" at mainbus0 not configured Profiling kernel, textsize=7925768 [ffffffc000000000..ffffffc00078f008] uhub1 at uhub0 port 2 configuration 1 interface 0 "ASMedia AS2107" rev 3.00/0.01 addr 2 uhub2 at uhub0 port 4 configuration 1 interface 0 "ASMedia AS2107" rev 2.10/0.01 addr 3 vscsi0 at root scsibus1 at vscsi0: 256 targets softraid0 at root scsibus2 at softraid0: 256 targets root on sd0a (c92bac01c037a788.a) swap on sd0b dump on sd0b <seemingly hangs for a few minutes> panic: kernel diagnostic assertion "(csr_read(sstatus) & (SSTATUS_SPP | SSTATUS _SIE)) == 0" failed: file "/sys/arch/riscv64/riscv64/trap.c", line 123 Came fro m U mode with interrupts enabled Stopped at db_enter+0x10: c.ebreak TID PID UID PRFLAGS PFLAGS CPU COMMAND -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE