From owner-svn-src-head@freebsd.org Fri Jun 12 21:17:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D05DE3467B0; Fri, 12 Jun 2020 21:17:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kD8h54LGz45CV; Fri, 12 Jun 2020 21:17:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A964510011; Fri, 12 Jun 2020 21:17:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CLHu0L067298; Fri, 12 Jun 2020 21:17:56 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CLHudg067296; Fri, 12 Jun 2020 21:17:56 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <202006122117.05CLHudg067296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 12 Jun 2020 21:17:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362121 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 362121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 12 Jun 2020 21:17:56 -0000 Author: vangyzen Date: Fri Jun 12 21:17:56 2020 New Revision: 362121 URL: https://svnweb.freebsd.org/changeset/base/362121 Log: FPU init: allocate initial state from UMA to ensure alignment The Intel Instruction Set Reference says this about the XSAVE instruction: Use of a destination operand not aligned to 64-byte boundary (in either 64-bit or 32-bit modes) results in a general-protection (#GP) exception. This alignment happens naturally when all malloc buckets are powers of two. However, this change is necessary on some systems when certain non-power-of-two (and non-multiple of 64) malloc buckets are defined. Reviewed by: cem; kib; earlier version by jhb MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D25098 Modified: head/sys/amd64/amd64/fpu.c head/sys/i386/i386/npx.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Fri Jun 12 21:12:26 2020 (r362120) +++ head/sys/amd64/amd64/fpu.c Fri Jun 12 21:17:56 2020 (r362121) @@ -372,8 +372,7 @@ fpuinitstate(void *arg __unused) fpu_save_area_zone = uma_zcreate("FPU_save_area", cpu_max_ext_state_size, NULL, NULL, NULL, NULL, XSAVE_AREA_ALIGN - 1, 0); - fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF, - M_WAITOK | M_ZERO); + fpu_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO); if (use_xsave) { max_ext_n = flsl(xsave_mask); xsave_area_desc = malloc(max_ext_n * sizeof(struct Modified: head/sys/i386/i386/npx.c ============================================================================== --- head/sys/i386/i386/npx.c Fri Jun 12 21:12:26 2020 (r362120) +++ head/sys/i386/i386/npx.c Fri Jun 12 21:17:56 2020 (r362121) @@ -483,8 +483,7 @@ npxinitstate(void *arg __unused) fpu_save_area_zone = uma_zcreate("FPU_save_area", cpu_max_ext_state_size, NULL, NULL, NULL, NULL, XSAVE_AREA_ALIGN - 1, 0); - npx_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF, - M_WAITOK | M_ZERO); + npx_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO); if (use_xsave) { if (xsave_mask >> 32 != 0) max_ext_n = fls(xsave_mask >> 32) + 32;