Date: Sun, 1 Mar 2015 04:14:03 -0800 From: Mark Millard <markmi@dsl-only.net> To: FreeBSD PowerPC ML <freebsd-ppc@freebsd.org> Subject: cb_dumpdata vs. PowerMac G5's (or at least my SSD context): add involvement of dumpinfo's maxiosize value? Message-ID: <84EBF11A-FB29-440B-BA0F-9FA94F1501AD@dsl-only.net>
index | next in thread | raw e-mail
Context: 10.1-STABLE powerpc64 for PowerMac G5
I'm unable to get panic dumps because the DMA size is rejected, 64K being too big. I'd like to get things to the point where panic dumps are possible for that context.
Looking around I find:
root@FBSDG5M1:/usr/src # grep DFLTPHYS sys/sys/*.h
sys/sys/param.h:#ifndef DFLTPHYS
sys/sys/param.h:#define DFLTPHYS (64 * 1024) /* default max raw I/O transfer size */
sys/sys/param.h:#define MAXDUMPPGS (DFLTPHYS/PAGE_SIZE)
root@FBSDG5M1:/usr/src # grep DFLTPHYS sys/powerpc/powerpc/*
sys/powerpc/powerpc/dump_machdep.c: sz = (resid > DFLTPHYS) ? DFLTPHYS : resid;
static int
cb_dumpdata(struct pmap_md *md, int seqnr, void *arg)
{
struct dumperinfo *di = (struct dumperinfo*)arg;
...
resid = md->md_size;
...
while (resid) {
sz = (resid > DFLTPHYS) ? DFLTPHYS : resid;
...
error = di->dumper(di->priv, (void*)va, 0, dumplo, sz);
...
}
Which may well be where the 64K is from. sys/sys/conf.h has:
struct dumperinfo {
dumper_t *dumper; /* Dumping function. */
void *priv; /* Private parts. */
u_int blocksize; /* Size of block in bytes. */
u_int maxiosize; /* Max size allowed for an individual I/O */
off_t mediaoffset; /* Initial offset in bytes. */
off_t mediasize; /* Space available in bytes. */
};
So it would appear that maxiosize from dumperinfo was supposed to be involved. But at this level nothing is checking dumperinfo's maxiosize field value to avoid using anything bigger.
It may be that the di->dumper is supposed to deal with allowed sizes being smaller than its size parameter indicates (sz here). But then exposing maxiosize in dumperinfo would seem a bit odd as an interface.
My initial guess would be that cb_dumpdata should be more like:
static int
cb_dumpdata(struct pmap_md *md, int seqnr, void *arg)
{
struct dumperinfo *di = (struct dumperinfo*)arg;
u_int max_trans_sz = (di->maxiosize<DFLTPHYS) ? di->maxiosize : DFLTPHYS;
...
printf(" chunk %d: %lu bytes ", seqnr, (u_long)resid);
while (resid) {
sz = (resid > max_trans_sz) ? max_trans_sz : resid;
...
error = di->dumper(di->priv, (void*)va, 0, dumplo, sz);
...
}
I have assumed that even when 0==resid that 0!=arg: the origin code would not dereference di in that kind of context so a little more conditional logic might be required if that property needs to be preserved.
Anyone know if I seem to be going in a reasonable direction for this?
I've only noted the large transfer size that I found. Many other places use a di->dumper with the size of something much smaller or with a smaller symbolic constant (such as having value 512). Again there is no maxiosize handling. It seems there there is an expected (implicit?) minimum size for maxiosize such that these various things would always fit. From that point of view I'm just objecting to DFLTPHYS being that minimum I guess: I want a smaller minimum so that I can get dumps from my existing configuration.
===
Mark Millard
markmi at dsl-only.net
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?84EBF11A-FB29-440B-BA0F-9FA94F1501AD>
