Bug 194279 - teach dumpsys / savecore to use dumpdev's sectorsize
Summary: teach dumpsys / savecore to use dumpdev's sectorsize
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-09 21:22 UTC by Ravi Pokala
Modified: 2016-04-15 17:57 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ravi Pokala 2014-10-09 21:22:35 UTC
From freebsd-hackers@, thread "Seeking reviewers for patch; PR 193873"[0]:

As mentioned in another thread ([1], [2]), I'm looking at dumping on systems w/ AF-4Kn drives (on a fairly old version of FreeBSD). Unfortunately, I'm not at all familiar w/ the process. I'm going to pick at it a few more days, but will probably end up having to punt and dumpsys onto a 512n or AF-512e device. But, since you are refactoring all this code in -CURRENT anyway, I think it would be awesome if you could look to the future and make it work w/o assuming that dump device block size is DEV_BSIZE; it would be better to use the sector size, as returned (for example) by ioctl(DIOCGSECTORSIZE).

[0] https://lists.freebsd.org/pipermail/freebsd-hackers/2014-October/046217.html
[1] https://lists.freebsd.org/pipermail/freebsd-hackers/2014-September/046164.html
[2] https://lists.freebsd.org/pipermail/freebsd-hackers/2014-October/046181.html
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2016-04-15 00:22:41 UTC
Patch from Doug Ambrisko in review and testing here:
https://reviews.freebsd.org/D5848

An earlier version has been tested against 512 and 4K-n drives.  I've tested this latest version against ordinary 512 drives and it seems to work with kgdb.  Procstat is having issues but I'm not sure if that's an old userspace problem or a new issue.
Comment 2 commit-hook freebsd_committer freebsd_triage 2016-04-15 17:45:51 UTC
A commit references this bug:

Author: cem
Date: Fri Apr 15 17:45:12 UTC 2016
New revision: 298076
URL: https://svnweb.freebsd.org/changeset/base/298076

Log:
  Add 4Kn kernel dump support

  (And 4Kn minidump support, but only for amd64.)

  Make sure all I/O to the dump device is of the native sector size.  To
  that end, we keep a native sector sized buffer associated with dump
  devices (di->blockbuf) and use it to pad smaller objects as needed (e.g.
  kerneldumpheader).

  Add dump_write_pad() as a convenience API to dump smaller objects with
  zero padding.  (Rather than pull in NPM leftpad, we wrote our own.)

  Savecore(1) has been updated to deal with these dumps.  The format for
  512-byte sector dumps should remain backwards compatible.

  Minidumps for other architectures are left as an exercise for the
  reader.

  PR:		194279
  Submitted by:	ambrisko@
  Reviewed by:	cem (earlier version), rpokala
  Tested by:	rpokala (4Kn/512 except 512 fulldump), cem (512 fulldump)
  Relnotes:	yes
  Sponsored by:	EMC / Isilon Storage Division
  Differential Revision:	https://reviews.freebsd.org/D5848

Changes:
  head/sbin/savecore/savecore.c
  head/sys/amd64/amd64/minidump_machdep.c
  head/sys/kern/kern_dump.c
  head/sys/kern/kern_shutdown.c
  head/sys/sys/conf.h