From owner-svn-src-head@FreeBSD.ORG Thu Sep 5 00:44:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 667CEC3B; Thu, 5 Sep 2013 00:44:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EECA62667; Thu, 5 Sep 2013 00:44:35 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r850iUb7073565; Thu, 5 Sep 2013 03:44:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r850iUb7073565 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r850iUZu073564; Thu, 5 Sep 2013 03:44:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 5 Sep 2013 03:44:30 +0300 From: Konstantin Belousov To: John Baldwin Subject: Re: svn commit: r255192 - in head: contrib/binutils/gas/config contrib/binutils/opcodes sys/amd64/amd64 Message-ID: <20130905004430.GM41229@kib.kiev.ua> References: <201309032121.r83LLlI5026519@svn.freebsd.org> <20130904042535.GX41229@kib.kiev.ua> <201309040756.45464.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KQVDJCmBkPV8WfA9" Content-Disposition: inline In-Reply-To: <201309040756.45464.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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 version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Sep 2013 00:44:36 -0000 --KQVDJCmBkPV8WfA9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 04, 2013 at 07:56:45AM -0400, John Baldwin wrote: > On Wednesday, September 04, 2013 12:25:35 am Konstantin Belousov wrote: > > On Tue, Sep 03, 2013 at 09:21:47PM +0000, John Baldwin wrote: > > > Author: jhb > > > Date: Tue Sep 3 21:21:47 2013 > > > New Revision: 255192 > > > URL: http://svnweb.freebsd.org/changeset/base/255192 > > >=20 > > > Log: > > > Add support for the 'invpcid' instruction to binutils and DDB's > > > disassembler on amd64. > > > =20 > > > MFC after: 1 month > >=20 > > Nice, thank you. > >=20 > > Do you agree with me that it is premature to start using the mnemonics > > in the kernel source until the changes are merged into stable/9 at leas= t ? >=20 > That is fine. Can you test that using them directly works fine with GCC? > I know clang already supported this instruction. Hmm, tried make buildkernel CC=3Dgcc for the world (and builworld area) built after your commit. I get gcc -c -x assembler-with-cpp -DLOCORE -O2 -frename-registers -pipe -fno-str= ict-a liasing -std=3Dc99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-pr= ototype s -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-= point er-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-opti= on =20 -nostdinc -I. -I/usr/home/kostik/work/build/bsd/DEV/src/sys -I/usr/home/ko= stik/ work/build/bsd/DEV/src/sys/contrib/altq -I/usr/home/kostik/work/build/bsd/D= EV/sr c/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_gl= obal. h -fno-common -finline-limit=3D8000 --param inline-unit-growth=3D100 --para= m large-f unction-growth=3D1000 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer= -mcmod el=3Dkernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous= -unwind -tables -ffreestanding -fstack-protector -Werror /usr/home/kostik/work/bui= ld/bsd/DEV/src/sys/amd64/amd64/exception.S /usr/home/kostik/work/build/bsd/DEV/src/sys/amd64/amd64/apic_vector.S: Asse= mbler messages: /usr/home/kostik/work/build/bsd/DEV/src/sys/amd64/amd64/apic_vector.S:224: = Error: no such instruction: `invpcid (%rdx),%rax' /usr/home/kostik/work/build/bsd/DEV/src/sys/amd64/amd64/apic_vector.S:312: = Error: no such instruction: `invpcid (%rdx),%rax' /usr/home/kostik/work/build/bsd/DEV/src/sys/amd64/amd64/apic_vector.S:409: = Error: no such instruction: `invpcid (%rdx),%rax' *** Error code 1 On the other hand, with the target machine, I successfully did the config/make style of the kernel build and verified that the assembled byte sequences for the invpcid are the same as manually assembled. I have no haswell machine to test this at runtime, but I believe that what was done is enough. diff --git a/sys/amd64/amd64/apic_vector.S b/sys/amd64/amd64/apic_vector.S index d002b4d..0e00549 100644 --- a/sys/amd64/amd64/apic_vector.S +++ b/sys/amd64/amd64/apic_vector.S @@ -221,8 +221,7 @@ IDTVEC(invltlb_pcid) je 1f /* Use invpcid if available. */ movl $1,%eax /* INVPCID_CTX */ - /* invpcid (%rdx),%rax */ - .byte 0x66,0x0f,0x38,0x82,0x02 + invpcid (%rdx),%rax jmp invltlb_ret_clear_pm_save 1: /* Otherwise reload %cr3 twice. */ @@ -309,8 +308,7 @@ IDTVEC(invlpg_pcid) */ 2: xorl %eax,%eax -/* invpcid (%rdx),%rax */ - .byte 0x66,0x0f,0x38,0x82,0x02 + invpcid (%rdx),%rax jmp invltlb_ret_rdx =20 /* @@ -406,8 +404,7 @@ invlrng_invpcid: subq %rax,%rcx shrq $PAGE_SHIFT,%rcx 1: -// invpcid (%rdx),%rax - .byte 0x66,0x0f,0x38,0x82,0x02 + invpcid (%rdx),%rax addq $PAGE_SIZE,8(%rsp) dec %rcx jne 1b diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index 3d381c6..f1b8209 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -487,9 +487,8 @@ static __inline void invpcid(struct invpcid_descr *d, int type) { =20 - /* invpcid (%rdx),%rax */ - __asm __volatile(".byte 0x66,0x0f,0x38,0x82,0x02" - : : "d" (d), "a" ((u_long)type) : "memory"); + __asm __volatile("invpcid (%0),%1" + : : "r" (d), "r" ((u_long)type) : "memory"); } =20 static __inline u_short --KQVDJCmBkPV8WfA9 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (FreeBSD) iQIcBAEBAgAGBQJSJ9PtAAoJEJDCuSvBvK1B/9QP/3Tex+554ueh15zJUeuw0AXd 5e9/r9h7SeNeZEX8yOJIjYyHVQxvVRv13yLGFrekQSBriTU0MH8IX4OapdJGkYGy uwlt1a6HXOReYmPxFwuczt7JS/RajqhADc76X6qfa2VLaVewLMM2DhN4kY7JPaLZ Yoq/7Iam3nMvYCVf39JTacyqOxXYsAhEAKOFfH77tfKKAUlmHgWbVhNxFqTiZaNZ OWXRhnaUggJ0Vf0wWMoYou9UkoxjzN72UtluZyo5fICJDJdtG/zHUZAWgo6k2sfZ vNzWydvdO73tT8bp8rgjneu+Q7+9MOffmw56ENzVQF12HQBmFjlElRM1w/FQikVx S6fbQOnogoQy7BmRmqqxA3b7rRE44OAwai2qXgCCKvkKT0CGqtO978C/dPT5Ke/P SI1fvZHYZy7H6o8TuOBSase9W5dkV/8qcD8gkAnHTfEqpOgXiZmPKFingFw/2GeN 4vj0YFByiElOLheQhq0QTKXBdr54G50A8H/A2wVa4AkUUGqp8Fxtr5NcN5KGQ0Qc TwNnsDafVnQSYNm4gGydEUUT/XPn1NQ9Be+hkMoJENBIT+5E6vRajz3XAwnkSop3 VtZ8LtdnhuRdr/QSYSgKK0FWp/eK73BFdPFbn3FsjFXP3U2qr2EwpeJ+98Xly7rS QwAthbt0hsAcK82siEMf =LTI9 -----END PGP SIGNATURE----- --KQVDJCmBkPV8WfA9--