Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jan 2016 21:02:31 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r293700 - head/sys/dev/xen/blkfront
Message-ID:  <201601112102.u0BL2VZA096796@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601112102.u0BL2VZA096796>