linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Jeglinski <jeglin@4pi.com>
To: linuxppc-dev@lists.linuxppc.org
Subject: whacked: looking for problematic __ioremap
Date: Thu, 23 Nov 2000 11:37:17 -0500	[thread overview]
Message-ID: <p04330100b642f3621d2e@[192.168.0.1]> (raw)


Another in the "whacked-out" series of posts. I sprinkled printk
statements in __ioremap liberally to see why there appears to be a
kernel panic there, related to a call from the aic7xxx driver. Here
are the results, based on a Paulus 2.2.18pre21 init.c source:

void *
__ioremap(unsigned long addr, unsigned long size, unsigned long flags)
{
	unsigned long p, v, i;

	p = addr & PAGE_MASK;
	size = PAGE_ALIGN(addr + size) - p;

	[runtime result: p = 80901000 and size = 4096]

	if ( mem_init_done && (p < virt_to_phys(high_memory)) ) {
		[false, not executed]
	}

	if (size == 0) {
		[false, not executed]
	}

#ifndef CONFIG_8xx
	if ( (v = p_mapped_by_bats(p)) /*&& p_mapped_by_bats(p+size-1)*/ ) {
		[false, not executed]
		goto out;
	}
#endif /* CONFIG_8xx */

	if (mem_init_done) {
		[true, executed]
		struct vm_struct *area;
		area = get_vm_area(size);
		if (area == 0) {
			[false, not executed]
		}
		v = VMALLOC_VMADDR(area->addr);
		[runtime result: v = d0181000]
	} else {
		[false, not executed]
	}
	if ((flags & _PAGE_PRESENT) == 0) {
		[runtime result: flags = 3a5]
	}
	if (flags & (_PAGE_NO_CACHE | _PAGE_WRITETHRU)) {
		[runtime result: flags = 3ad]
	}
	for (i = 0; i < size; i += PAGE_SIZE) {
		map_page(v+i, p+i, flags);
		[runtime result: lots of output I can't capture, PAGE_SIZE = 4096]
	}
out:
	[runtime result: v + (addr & ~PAGE_MASK) = d0181000]
	return (void *) (v + (addr & ~PAGE_MASK));
}

I note the following 3 observations:

1. In the #ifndef CONFIG_8xx section above, is the statement v =
p_mapped_by_bats(p) correct? Inside of an if statement, it is easy to
accidently type "=" instead of "==".

2. It's hard to catch during the boot, but it sure looked like all
the other PCI devices that were being probed found the same if(v =
p_mapped_by_bats(p)) to be true, and jumped to out. AFAICT, only the
aic7xxx call did not jump to out.

3. given that v = d0181000, is it expected that the returned result,
v + (addr & ~PAGE_MASK, is the -same- value? IOW, addr & ~PAGE_MASK
is ZERO. (I didn't yet record the actual values of addr and
~PAGE_MASK.



Thanks for any comments or observations or suggestions of where to go
next. I don't know much about what any of the above means, but I can
follow the code.



Stefan Jeglinski

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

                 reply	other threads:[~2000-11-23 16:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='p04330100b642f3621d2e@[192.168.0.1]' \
    --to=jeglin@4pi.com \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).