public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Rabin Vincent <rabin@rab.in>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: "Syed Mohammed, Khasim" <khasim@ti.com>,
	"linux-arm-kernel@lists.arm.linux.org.uk"
	<linux-arm-kernel@lists.arm.linux.org.uk>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: Exception while  handling MEM Hole on OMAP3 / ARM Cortex A8
Date: Mon, 17 Aug 2009 23:31:45 +0530	[thread overview]
Message-ID: <20090817180145.GA17378@debian> (raw)
In-Reply-To: <20090817174718.GU10764@n2100.arm.linux.org.uk>

On Mon, Aug 17, 2009 at 06:47:18PM +0100, Russell King - ARM Linux wrote:
> On Mon, Aug 17, 2009 at 11:03:44PM +0530, Rabin Vincent wrote:
> > On Sat, Aug 15, 2009 at 07:17:11PM +0100, Russell King - ARM Linux wrote:
> > > +#ifndef CONFIG_SPARSEMEM
> > > +int pfn_valid(unsigned long pfn)
> > > +{
> > > +	struct meminfo *mi = &meminfo;
> > > +	unsigned int mid, left = 0, right = mi->nr_banks;
> > > +
> > > +	while ((mid = (right - left) / 2) > 0) {
> > > +		struct membank *bank = &mi->bank[mid];
> > > +
> > > +		if (pfn < bank_pfn_start(bank))
> > > +			right = mid;
> > > +		else if (pfn >= bank_pfn_end(bank))
> > > +			left = mid + 1;
> > > +		else
> > > +			return 1;
> > > +	}
> > > +	return 0;
> > > +}
> > > +EXPORT_SYMBOL(pfn_valid);
> > > +#endif
> > 
> > The above function will ignore the first bank.  I don't think that was
> > intended.
> 
> Why do you say that?
> 
> Let's start with 4 membank entries - 0 1 2 3.
> 
> 0 covers 0-10, 1 covers 20-30, 2 covers 40-50 and 3 covers 60-70.
> 
> Let's run through the steps looking for 5:
> 
> Initally, left = 0, right = 4, so mid=2.  5 < 40?  Yes, so right becomes 2.
> 
> left = 0, right = 2, so mid=1.  5 < 20?  Yes, so right becomes 1.
> 
> left = 0, right = 1, so mid=0.  5 < 0?  No.  5 >= 10?  No.  so return 1.
> 
> This doesn't look to me like it ignores the first bank.  I think you're
> wrong.  Please provide me with your proof ASAP because right now it's
> pending for Linus.

When mid == 0, the loop exits because the condition you have is :

  while ((mid = (right - left) / 2) > 0) {
                                  ^^^^^^

Thus bank[0] will never be checked.

Rabin

  reply	other threads:[~2009-08-17 18:01 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07 20:16 Exception while handling MEM Hole on OMAP3 / ARM Cortex A8 Syed Mohammed, Khasim
2009-08-07 21:19 ` Woodruff, Richard
2009-08-08 15:10   ` Syed Mohammed, Khasim
2009-08-07 22:00 ` Russell King - ARM Linux
2009-08-08 15:15   ` Syed Mohammed, Khasim
2009-08-08 17:03     ` Russell King - ARM Linux
2009-08-13 17:21       ` Syed Mohammed, Khasim
2009-08-13 17:33         ` Russell King - ARM Linux
2009-08-14 11:13           ` Syed Mohammed, Khasim
2009-08-15 13:03             ` Sudeep K N
2009-08-15 13:10               ` Russell King - ARM Linux
2009-08-15 15:23                 ` Syed Mohammed, Khasim
2009-08-15 15:33             ` Russell King - ARM Linux
2009-08-15 16:17               ` Syed Mohammed, Khasim
2009-08-15 18:17                 ` Russell King - ARM Linux
2009-08-17 11:10                   ` Syed Mohammed, Khasim
2009-08-17 16:50                     ` Russell King - ARM Linux
2009-08-17 17:21                       ` Syed Mohammed, Khasim
2009-08-17 17:33                   ` Rabin Vincent
2009-08-17 17:47                     ` Russell King - ARM Linux
2009-08-17 18:01                       ` Rabin Vincent [this message]
2009-08-17 18:04                         ` Russell King - ARM Linux
2009-08-17 20:23                           ` Aguirre Rodriguez, Sergio Alberto
2009-08-18  3:01                             ` Rabin Vincent
2009-09-07 14:22                               ` Russell King - ARM Linux
2009-09-08 20:23                                 ` Russell King - ARM Linux
2009-09-09  2:05                                   ` Aguirre Rodriguez, Sergio Alberto
2009-09-09  4:42                                     ` Syed Mohammed, Khasim
2009-09-09  7:17                                       ` Russell King - ARM Linux
2009-09-09  7:46                                         ` Syed Mohammed, Khasim
2009-09-09 18:33                                           ` Russell King - ARM Linux
2009-09-09 23:13                                             ` Syed Mohammed, Khasim
2009-09-15 11:32                                 ` Pavel Machek
2009-09-15 16:17                                   ` Russell King - ARM Linux
2009-09-17 21:08                                   ` Jamie Lokier

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=20090817180145.GA17378@debian \
    --to=rabin@rab.in \
    --cc=khasim@ti.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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