From nobody Wed Sep 01 01:54:50 2021 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7B97817A61F9 for ; Wed, 1 Sep 2021 01:55:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GznF32pXNz4XhC for ; Wed, 1 Sep 2021 01:55:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x932.google.com with SMTP id g16so501779uam.7 for ; Tue, 31 Aug 2021 18:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+zaC2vEdLSmK6XpOkpGu2Vv253zsSa8ZZMb08h8TrMc=; b=DEuRnFQI1Ovm1WxSYHV8ZIGbYqlp0Op+lacnKnBBVCn6aG+iRx3T01lhhR6WJFlvSp y/KrzzSMM46v0ehrC/MwXYP+WfAB6JE5g7nSk5YW40mJPSqJVwRr7RXmOQHMCX3JgcDC Z6hulClv/snpUDRIjvuUu+pHDhl27Su5eIYdWjPZZmBHBySJe48L/i7EjSWni+xuSxuO JZ+6MDJeQY79W2B+5Jbgz9G9ybWatagJbP9SGQtWc//evC+SEKeLm6p/8/diu/qLS4uN 42y1DZa6QoVN1TkjE+83qYRs02j7VNY+yZ+zFSmAj47m/bNvHYVwWhrrHSCsBMYmzJ6K kiFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+zaC2vEdLSmK6XpOkpGu2Vv253zsSa8ZZMb08h8TrMc=; b=ItTOjcwQGNbbS/DMkEUoneq0TgKp311NL1wFwkL5+wb7+2NRduYxc4AgMtQN2fNI5C LFBPAW4jSRZp0pM/JpxgMTVUe75Df/m073z8+p1vnWgwcyl4M7rvKC7gs5rKlOQl/oQ0 Go7yk4y2MvV2WGEjzz3i4HUWVgVWcVl/knudQjles/xlM5z/mGpDXeFNYjhxx0xdjUeH WtLPBbNEHqOKay69AjPIHZY8thcZd7Qv5L7GK1ZfVhiNf5krmmtq5wHzC2h0AFQCQfzZ 6zywrvI25jtSfssf35xXKBGPpmED9PzZoQ45wXnE4iIQjpR1GnleRqWdCJf2d1c4dST9 ViBw== X-Gm-Message-State: AOAM530z8zBi9aOfGvnrgQ75HN7kbzEsfZgAqVIBpcTLSfz0m6ci4l9V peiBZdhI6cUHAA6wkfBw5+wsnFAl8cGuU1AYNgDS4vKquaM= X-Google-Smtp-Source: ABdhPJyEzcnGC1WGwNrUxXCm5YVigtvQDmz9ICLH2d+17IAP1fKvRfaULbQkvjILC4q0z9uGLtK/jnbhFjrRqidEQ5U= X-Received: by 2002:a9f:23d0:: with SMTP id 74mr21745946uao.69.1630461302757; Tue, 31 Aug 2021 18:55:02 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Warner Losh Date: Tue, 31 Aug 2021 19:54:50 -0600 Message-ID: Subject: Re: Patched gpsd and /dev/pps0 results in "sleeping thread" kernel panic To: Craig Leres Cc: FreeBSD Hackers Content-Type: multipart/alternative; boundary="000000000000c56e5a05cae55aa3" X-Rspamd-Queue-Id: 4GznF32pXNz4XhC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: Y --000000000000c56e5a05cae55aa3 Content-Type: text/plain; charset="UTF-8" On Tue, Aug 31, 2021, 7:28 PM Craig Leres wrote: > I have many FreeBSD based ntp time servers using half a dozen different > kinds of receivers. Now I have a Javad Alpha2 satellite receiver I'd > like to use. Since gpsd knows how to talk GREIS to it I'm pretty deep > into trying to figure out how to configure that. > > gpsd appears to know a lot about the RFC 2783 pps api but incorrectly > assumes only tty-like devices can support it. It tries to use time_pps_* > functions with /dev/gps0 (a symlink to cuau0) which fail and doesn't > even open /dev/pps0. My gpsd rc.conf config is: > > gpsd_enable="YES" > gpsd_flags="-D1 -n -s 115200" > gpsd_devices="/dev/gps0 /dev/pps0" > > The relevant part of my ntp.conf is (driver 46 is the GPSD-NG driver): > > server 127.127.46.0 > fudge 127.127.46.0 flag4 1 > > Running with these two configs, the gpsd tool cgps shows the radio > happily is tracking ~20 satellites. ntpd shows "GPSD" running about 10 > us fast but because this so far off it eventually discards it (ntpq -p > show 'x' before it). I know /dev/pps0 works because if I add pps clock > config (driver 22) for it to ntp.conf: > > server 127.127.22.0 prefer > fudge 127.127.22.0 flag3 1 > > ntpd is then able to poll for data and shows a reasonable offset that is > comparable to ntpd running on nearby servers. > > So I'm pretty close, I just need to get gpsd working with /dev/pps0. To > that end, I made a copy of the source and made some changes to > ppsthread.c (see attached patch.txt) which basically forces an open() on > /dev/pps0. This gets further: > > gpsd:INFO: KPPS:/dev/pps0 pps_caps 0x1151 > gpsd:INFO: KPPS:/dev/pps0 have PPS_CANWAIT > gpsd:WARN: KPPS:/dev/pps0 missing PPS_CAPTURECLEAR, pulse may be > offset > gpsd:INFO: KPPS:/dev/pps0 kernel PPS will be used > [New LWP 101408 of process 2046] > gpsd:PROG: PPS:/dev/pps0 thread launched > gpsd:INFO: PPS:/dev/pps0 ntpshm_link_activate: 0 > gpsd:INFO: device /dev/pps0 activated > > and gpsd starts to talk GREIS protocol to the radio and then the kernel > panics with "sleeping thread". > > Here are more details about my setup. I have 12.2-RELEASE-p10 kernel > with these options: > > device pps > options PPS_SYNC > options P1003_1B_MQUEUE > > I'm building the ports version of net/ntp with these options: > > ATOM DEBUG IPV6 JUPITER NMEA ONCORE PERL_UTILS SHM SSL THREADS > > I'm building the ports version of astro/gpsd with these options: > > GPSCLOCK IPV6 NCURSES NMEA0183 NTP NTPSHM ONCORE PPS RECONFIG > SHMEXPORT SOCKEXPORT > > My gpsd source tree is just a copy of patched version of the astro/gpsd > port. (Which caused me to have to learn how to use scons...) When > testing I start gpsd with: > > ./gpsd -N -D5 -n -s 115200 -P /var/run/gpsd.pid /dev/gps0 /dev/pps0 > > The Alpha2 is connected to /dev/cuau0 at 115200 baud, its pps is > connected to a parallel printer port. > > Can anyone help me with gpsd+pps and/or the kernel panic? > Can you post a traceback? We recently tightened up the sleeping conditions and many of the panics are straight forward to fix... Warner Craig > --000000000000c56e5a05cae55aa3--