From owner-freebsd-current@freebsd.org Tue Jul 3 22:12:53 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 9C6F2102D5D1 for ; Tue, 3 Jul 2018 22:12:53 +0000 (UTC) (envelope-from pete@nomadlogic.org) Received: from vps-mail.nomadlogic.org (mail.nomadlogic.org [IPv6:2607:f2f8:a098::2]) (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 1524F739FF; Tue, 3 Jul 2018 22:12:52 +0000 (UTC) (envelope-from pete@nomadlogic.org) Received: from [192.168.1.106] (cpe-75-82-194-8.socal.res.rr.com [75.82.194.8]) by vps-mail.nomadlogic.org (OpenSMTPD) with ESMTPSA id 92c8f76d TLS version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO; Tue, 3 Jul 2018 15:12:49 -0700 (PDT) Subject: Re: atomic changes break drm-next-kmod? From: Pete Wright To: John Baldwin , Niclas Zeising , "O. Hartmann" , FreeBSD Current References: <20180703170223.266dbf5b@thor.intern.walstatt.dynvpn.de> Message-ID: Date: Tue, 3 Jul 2018 15:12:45 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US 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: Tue, 03 Jul 2018 22:12:54 -0000 On 07/03/2018 14:17, Pete Wright wrote: > > > On 07/03/2018 12:02, John Baldwin wrote: >> On 7/3/18 11:28 AM, Niclas Zeising wrote: >>> On 07/03/18 17:02, O. Hartmann wrote: >>>> -----BEGIN PGP SIGNED MESSAGE----- >>>> Hash: SHA512 >>>> >>>> Am Tue, 3 Jul 2018 10:19:57 -0400 >>>> Michael Butler schrieb: >>>> >>>>> It seems recent changes (SVN r335873?) may have broken >>>>> drm-next-kmod .. >>>>> >>>>> --- i915_drv.o --- >>>>> In file included from i915_drv.c:30: >>>>> In file included from >>>>> /usr/ports/graphics/drm-next-kmod/work/kms-drm-a753215/linuxkpi/gplv2/include/linux/acpi.h:26: >>>>> >>>>> In file included from >>>>> /usr/ports/graphics/drm-next-kmod/work/kms-drm-a753215/linuxkpi/gplv2/include/linux/device.h:4: >>>>> >>>>> In file included from >>>>> /usr/src/sys/compat/linuxkpi/common/include/linux/device.h:35: >>>>> In file included from >>>>> /usr/src/sys/compat/linuxkpi/common/include/linux/types.h:37: >>>>> In file included from /usr/src/sys/sys/systm.h:44: >>>>> ./machine/atomic.h:450:29: error: invalid operand for instruction >>>>> ATOMIC_ASM(clear,    long,  "andq %1,%0",  "ir", ~v); >>>>>                               ^ >>>>> :1:7: note: instantiated into assembly here >>>>>           andq $9223372036854775807,40672(%r14) >>>>>                ^~~~~~~~~~~~~~~~~~~~~ >>>>> 1 error generated. >>>>> *** [i915_drv.o] Error code 1 >>>>> >>>>> make[3]: stopped in >>>>> /usr/ports/graphics/drm-next-kmod/work/kms-drm-a753215/i915 >>>>> --- i915_gem.o --- >>>>> In file included from i915_gem.c:28: >>>>> In file included from >>>>> /usr/ports/graphics/drm-next-kmod/work/kms-drm-a753215/include/drm/drmP.h:38: >>>>> >>>>> In file included from /usr/src/sys/sys/malloc.h:42: >>>>> In file included from /usr/src/sys/sys/systm.h:44: >>>>> ./machine/atomic.h:449:29: error: invalid operand for instruction >>>>> ATOMIC_ASM(set,      long,  "orq %1,%0",   "ir",  v); >>>>>                               ^ >>>>> :1:6: note: instantiated into assembly here >>>>>           orq $-9223372036854775808,40672(%r14) >>>>>               ^~~~~~~~~~~~~~~~~~~~~~ >>>>> 1 error generated. >>>>> *** [i915_gem.o] Error code 1 >>>>> >>>>> _______________________________________________ >>>>> 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" >>>> >>>> It breaks also graphics/drm-stable-kmod (see PR 229484, >>>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229484, same >>>> error as you described >>>> above) and also emulators/virtualbox-ose-kmod. As long as CURRENT >>>> revision is < r335873, >>>> those kmod compile well. >>> We are looking into why both the drm ports fail. >>> Regards >>> >> I haven't yet tested an amd64 kernel with this, but I think this >> change to sys/amd64/include/atomic.h >> might fix it: >> >> Index: atomic.h >> =================================================================== >> --- atomic.h    (revision 335896) >> +++ atomic.h    (working copy) >> @@ -446,10 +446,10 @@ ATOMIC_ASM(clear,    int,   "andl %1,%0", "ir", ~ >>   ATOMIC_ASM(add,         int,   "addl %1,%0",  "ir",  v); >>   ATOMIC_ASM(subtract, int,   "subl %1,%0",  "ir",  v); >>   -ATOMIC_ASM(set,         long,  "orq %1,%0",   "ir",  v); >> -ATOMIC_ASM(clear,    long,  "andq %1,%0",  "ir", ~v); >> -ATOMIC_ASM(add,         long,  "addq %1,%0",  "ir",  v); >> -ATOMIC_ASM(subtract, long,  "subq %1,%0",  "ir",  v); >> +ATOMIC_ASM(set,         long,  "orq %1,%0",   "er",  v); >> +ATOMIC_ASM(clear,    long,  "andq %1,%0",  "er", ~v); >> +ATOMIC_ASM(add,         long,  "addq %1,%0",  "er",  v); >> +ATOMIC_ASM(subtract, long,  "subq %1,%0",  "er",  v); >>     #define    ATOMIC_LOADSTORE(TYPE)                    \ >>       ATOMIC_LOAD(TYPE);                    \ >> >> > > i've just built a kernel with this patch applied, rebooted into it and > was able to build the drm-next-kmod port.  i am also running X without > issues so far with this configuration. > oh neat - looks like this may have triggered a kernel panic. fortunately i was able to savecore.  here's the output of my info file: info:   Version String: FreeBSD 12.0-CURRENT #7 d7ac1268f3a(master)-dirty: Tue Jul  3 13:53:50 PDT 2018 pete@duke:/usr/obj/usr/home/pete/git/freebsd/amd64.amd64/sys/GENERIC-EVDEV   Panic String: Duplicate free of 0xfffff8010ac59000 from zone 0xfffff800340935a0(i915_gem_request) slab 0xfffff8010ac43af0(0) i didn't build a kernel.debug file unfortunately, but here's the output of my core.txt file, not sure how helpful it is: BFD: /bootpool/boot/kernel/kernel: invalid relocation type 37 BFD: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/pete/git/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elf64-x86-64.c:276 BFD: /bootpool/boot/kernel/kernel: invalid relocation type 37 BFD: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/pete/git/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elf64-x86-64.c:276 /dev/stdin:1: Error in sourced command file: Cannot access memory at address 0x65657246 BFD: /bootpool/boot/kernel/kernel: invalid relocation type 37 BFD: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/pete/git/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elf64-x86-64.c:276 BFD: /bootpool/boot/kernel/kernel: invalid relocation type 37 BFD: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/pete/git/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elf64-x86-64.c:276 /dev/stdin:1: Error in sourced command file: Cannot access memory at address 0x65657246 BFD: /bootpool/boot/kernel.old/kernel: invalid relocation type 37 BFD: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/pete/git/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elf64-x86-64.c:276 BFD: /bootpool/boot/kernel.old/kernel: invalid relocation type 37 BFD: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/pete/git/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elf64-x86-64.c:276 /dev/stdin:1: Error in sourced command file: Cannot access memory at address 0x65657246 Unable to find matching kernel for /var/crash/vmcore.1 cheers, -pete -- Pete Wright pete@nomadlogic.org @nomadlogicLA