Skip to content

Commit

Permalink
When initial placement of the new entry crosses the boundary,
Browse files Browse the repository at this point in the history
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 <[email protected]>, running nvme(4)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
  • Loading branch information
kostikbel committed Mar 17, 2015
1 parent 35ed3d4 commit 263fec4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sys/x86/iommu/intel_gas.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,15 @@ dmar_gas_match_one(struct dmar_gas_match_args *a, struct dmar_map_entry *prev,
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
Expand Down

0 comments on commit 263fec4

Please sign in to comment.