svn commit: r257216 - head/sys/amd64/amd64

Konstantin Belousov kib at FreeBSD.org
Sun Oct 27 16:31:13 UTC 2013


Author: kib
Date: Sun Oct 27 16:31:12 2013
New Revision: 257216
URL: http://svnweb.freebsd.org/changeset/base/257216

Log:
  Several small fixes for the amd64 minidump code.
  
  In report_progress(), use nitems(progress_track) instead of manually
  hard-coding array size.  Wrap long line.
  
  In blk_write(), code verifies that ptr and pa cannot be non-zero
  simultaneously.  The later check for the page-alignment of the ptr
  argument never triggers due to pa != 0 always implying ptr == NULL.  I
  believe that the intent was to ensure that physicall address passed is
  page-aligned, since the address is (temporary) mapped for the duration
  of the page write.
  
  Clear the progress_track.visited fields when starting minidump.  If
  minidump is restarted or taken second time during the system lifetime,
  progress is not printed otherwise, making operator suspectible to the
  dump status.
  
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/amd64/amd64/minidump_machdep.c

Modified: head/sys/amd64/amd64/minidump_machdep.c
==============================================================================
--- head/sys/amd64/amd64/minidump_machdep.c	Sun Oct 27 16:25:57 2013	(r257215)
+++ head/sys/amd64/amd64/minidump_machdep.c	Sun Oct 27 16:31:12 2013	(r257216)
@@ -127,8 +127,9 @@ report_progress(size_t progress, size_t 
 	int sofar, i;
 
 	sofar = 100 - ((progress * 100) / dumpsize);
-	for (i = 0; i < 10; i++) {
-		if (sofar < progress_track[i].min_per || sofar > progress_track[i].max_per)
+	for (i = 0; i < nitems(progress_track); i++) {
+		if (sofar < progress_track[i].min_per ||
+		    sofar > progress_track[i].max_per)
 			continue;
 		if (progress_track[i].visited)
 			return;
@@ -157,8 +158,8 @@ blk_write(struct dumperinfo *di, char *p
 		printf("cant have both va and pa!\n");
 		return (EINVAL);
 	}
-	if (pa != 0 && (((uintptr_t)ptr) % PAGE_SIZE) != 0) {
-		printf("address not page aligned\n");
+	if ((((uintptr_t)pa) % PAGE_SIZE) != 0) {
+		printf("address not page aligned %p\n", ptr);
 		return (EINVAL);
 	}
 	if (ptr != NULL) {
@@ -230,6 +231,8 @@ minidumpsys(struct dumperinfo *di)
  retry:
 	retry_count++;
 	counter = 0;
+	for (i = 0; i < nitems(progress_track); i++)
+		progress_track[i].visited = 0;
 	/* Walk page table pages, set bits in vm_page_dump */
 	pmapsize = 0;
 	for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR,


More information about the svn-src-head mailing list