From owner-svn-src-all@FreeBSD.ORG Tue Mar 17 22:00:12 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 498B9179; Tue, 17 Mar 2015 22:00:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (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 34C90182; Tue, 17 Mar 2015 22:00:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2HM0C7H038530; Tue, 17 Mar 2015 22:00:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2HM0CYu038513; Tue, 17 Mar 2015 22:00:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201503172200.t2HM0CYu038513@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 17 Mar 2015 22:00:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280196 - head/sys/x86/iommu X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2015 22:00:12 -0000 Author: kib Date: Tue Mar 17 22:00:11 2015 New Revision: 280196 URL: https://svnweb.freebsd.org/changeset/base/280196 Log: When initial placement of the new entry crosses the boundary, allocator tries to move the entry up, after the boundary. The new location may still fail to satisfy boundary requirement, for instance, if the boundary is set to page size, and allocation is of multiple pages. Recheck that boundary is not crossed after the move. If it is crossed, give up on allocating the whole entry and split it. Reported by: Michael Fuckner , running nvme(4) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/x86/iommu/intel_gas.c Modified: head/sys/x86/iommu/intel_gas.c ============================================================================== --- head/sys/x86/iommu/intel_gas.c Tue Mar 17 21:55:33 2015 (r280195) +++ head/sys/x86/iommu/intel_gas.c Tue Mar 17 22:00:11 2015 (r280196) @@ -327,13 +327,15 @@ dmar_gas_match_one(struct dmar_gas_match start = roundup2(bs, a->common->alignment); /* DMAR_PAGE_SIZE to create gap after new entry. */ if (start + a->size + DMAR_PAGE_SIZE <= prev->end + prev->free_after && - start + a->size <= end) { + start + a->size <= end && dmar_test_boundary(start, a->size, + a->common->boundary)) { a->entry->start = start; return (true); } /* - * Not enough space to align at boundary, but allowed to split. + * Not enough space to align at the requested boundary, or + * boundary is smaller than the size, but allowed to split. * We already checked that start + size does not overlap end. * * XXXKIB. It is possible that bs is exactly at the start of