From owner-freebsd-current@freebsd.org Thu Jul 5 19:37:03 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C557B1028500 for ; Thu, 5 Jul 2018 19:37:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42A0672991; Thu, 5 Jul 2018 19:37:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w65Jalfl032662 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 5 Jul 2018 22:36:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w65Jalfl032662 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w65Jak51032661; Thu, 5 Jul 2018 22:36:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 5 Jul 2018 22:36:46 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: Pete Wright , John Baldwin , Niclas Zeising , "O. Hartmann" , FreeBSD Current Subject: Re: atomic changes break drm-next-kmod? Message-ID: <20180705193646.GM5562@kib.kiev.ua> References: <845aca10-8c01-fa3b-087f-f957df4e7531@nomadlogic.org> <063ae5c3-0584-1284-dd9d-ab8b5790baf1@FreeBSD.org> <0bf8e57b-fdb4-4c1a-3d0d-a734f8187ca8@nomadlogic.org> <4c5411dd-9f6b-7245-6ade-e11040f74687@FreeBSD.org> <24f5d737-a205-6fcc-0a33-a84601d2ff7a@nomadlogic.org> <29ce4eab-6667-d2ca-b5d8-3deeef28f142@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2018 19:37:04 -0000 On Thu, Jul 05, 2018 at 09:12:24PM +0200, Hans Petter Selasky wrote: > On 07/05/18 20:59, Hans Petter Selasky wrote: > > On 07/05/18 19:48, Pete Wright wrote: > >> > >> > >> On 07/05/2018 10:10, John Baldwin wrote: > >>> On 7/3/18 5:10 PM, Pete Wright wrote: > >>>> > >>>> On 07/03/2018 15:56, John Baldwin wrote: > >>>>> On 7/3/18 3:34 PM, Pete Wright wrote: > >>>>>> On 07/03/2018 15:29, John Baldwin wrote: > >>>>>>> That seems like kgdb is looking at the wrong CPU.š Can you use > >>>>>>> 'info threads' and look for threads not stopped in 'sched_switch' > >>>>>>> and get their backtraces?š You could also just do 'thread apply > >>>>>>> all bt' and put that file at a URL if that is easiest. > >>>>>>> > >>>>>> sure thing John - here's a gist of "thread apply all bt" > >>>>>> > >>>>>> https://gist.github.com/gem-pete/d8d7ab220dc8781f0827f965f09d43ed > >>>>> That doesn't look right at all.š Are you sure the kernel matches the > >>>>> vmcore?š Also, which kgdb version are you using? > >>>>> > >>>> yea i agree that doesn't look right at all.š here is my setup: > >>>> > >>>> $ which kgdb > >>>> /usr/bin/kgdb > >>>> $ kgdb > >>>> GNU gdb 6.1.1 [FreeBSD] > >>>> $ ls -lh /var/crash/vmcore.1 > >>>> -rw-------š 1 rootš wheelšš 1.6G Julš 3 15:03 /var/crash/vmcore.1 > >>>> $ ls -l /usr/lib/debug/boot/kernel/kernel.debug > >>>> -r-xr-xr-xš 1 rootš wheelš 87840496 Julš 3 13:54 > >>>> /usr/lib/debug/boot/kernel/kernel.debug > >>>> > >>>> and i invoke kgdb like so: > >>>> $ sudo kgdb /usr/lib/debug/boot/kernel/kernel.debug /var/crash/vmcore.1 > >>>> > >>>> here's a gist of my full gdb session: > >>>> http://termbin.com/krsn > >>>> > >>>> dunno - maybe i have a bad core dump?š regardless, more than happy to > >>>> help so let me know if i should try anything else or patches etc.. > >>> Can you try installing gdb from ports and using /usr/local/bin/kgdb? > >>> > >> > >> that seems to have done the trick, at least the output looks more > >> encouraging. > >> > >> šš--- trap 0, rip = 0, rsp = 0, rbp = 0 --- > >> KDB: enter: panic > >> > >> __curthread () at ./machine/pcpu.h:231 > >> 231ššš ššš __asm("movq %%gs:%1,%0" : "=r" (td) > >> > >> > >> here's my full kgdb session: > >> http://termbin.com/qa4f > >> > >> i don't see any threads not in "sched_switch" though :( > > > > Hi, > > > > The problem may be that the patch to enable atomic inlining of all > > macros forgot to set the SMP keyword which means SMP is not defined at > > all for KLD's so all non-kernel atomic usage is with MPLOCKED empty! Problem is that out-of-tree modules build does not have opt*.h files from the kernel. UP config is a valid one, flipping some option's default value does not solve the problem. The build invocation for such modules needs to provide KERNBUILDDIR variable pointing to the kernel build directory, where all opt*.h files are located. > > > > /* > > š* For userland, always use lock prefixes so that the binaries will run > > š* on both SMP and !SMP systems. > > š*/ > > #if defined(SMP) || !defined(_KERNEL) > > #define MPLOCKEDššššššš "lock ; " > > #else > > #define MPLOCKED > > #endif > > > > Can you try to recompile the LinuxKPI /sys/modules/linuxkpi with > > DEBUG_FLAGS="-DSMP" ? > > > > and similarly the drm-next package? > > > > Also please find attached a patch for amd64. > > --HPS > > Index: sys/amd64/include/atomic.h > =================================================================== > --- sys/amd64/include/atomic.h (revision 335974) > +++ sys/amd64/include/atomic.h (working copy) > @@ -132,7 +132,7 @@ > * For userland, always use lock prefixes so that the binaries will run > * on both SMP and !SMP systems. > */ > -#if defined(SMP) || !defined(_KERNEL) > +#if defined(SMP) || !defined(_KERNEL) || defined(KLD_MODULE) > #define MPLOCKED "lock ; " > #else > #define MPLOCKED > @@ -354,7 +354,7 @@ > */ > #define OFFSETOF_MONITORBUF 0x100 > > -#if defined(SMP) > +#if defined(SMP) || defined(KLD_MODULE) > static __inline void > __storeload_barrier(void) > { > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"