svn commit: r293700 - head/sys/dev/xen/blkfront
Colin Percival
cperciva at FreeBSD.org
Mon Jan 11 21:02:32 UTC 2016
Author: cperciva
Date: Mon Jan 11 21:02:30 2016
New Revision: 293700
URL: https://svnweb.freebsd.org/changeset/base/293700
Log:
Add two more assertions to catch busdma problems. Each segment provided
by busdma to the blkfront driver must be an integer number of sectors,
and must be aligned in memory on a "sector" boundary.
Having these assertions yesterday would have made finding the bug fixed
in r293698 somewhat easier.
Modified:
head/sys/dev/xen/blkfront/blkfront.c
Modified: head/sys/dev/xen/blkfront/blkfront.c
==============================================================================
--- head/sys/dev/xen/blkfront/blkfront.c Mon Jan 11 20:55:52 2016 (r293699)
+++ head/sys/dev/xen/blkfront/blkfront.c Mon Jan 11 21:02:30 2016 (r293700)
@@ -170,6 +170,11 @@ xbd_mksegarray(bus_dma_segment_t *segs,
int ref;
while (sg < last_block_sg) {
+ KASSERT(segs->ds_addr % (1 << XBD_SECTOR_SHFT) == 0,
+ ("XEN disk driver I/O must be sector aligned"));
+ KASSERT(segs->ds_len % (1 << XBD_SECTOR_SHFT) == 0,
+ ("XEN disk driver I/Os must be a multiple of "
+ "the sector length"));
buffer_ma = segs->ds_addr;
fsect = (buffer_ma & PAGE_MASK) >> XBD_SECTOR_SHFT;
lsect = fsect + (segs->ds_len >> XBD_SECTOR_SHFT) - 1;
More information about the svn-src-all
mailing list