public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Section mismatches in memblock
Date: Tue, 05 Oct 2010 19:30:18 -0700	[thread overview]
Message-ID: <4CABDF3A.2020501@zytor.com> (raw)
In-Reply-To: <4CABB4FD.2090304@kernel.org>

On 10/05/2010 04:30 PM, Yinghai Lu wrote:
> 
> looks like gcc problem.

What makes you say that?

> | static int memblock_search(struct memblock_type *type, phys_addr_t addr)
> | {
> |	.....
> | }
> |
> |int __init memblock_is_reserved(phys_addr_t addr)
> |{
> |        return memblock_search(&memblock.reserved, addr) != -1;
> |}
> |
> |int __init_memblock memblock_is_memory(phys_addr_t addr)
> |{
> |        return memblock_search(&memblock.memory, addr) != -1;
> |}
> 
> Because We already have __init for those two functions.
> 
> Just make memblock_search to have __init_memblock atribute.
> 

Wrong functions!  Furhtermore, at least the tip tree definitely does not
have __init_memblock here:


static int memblock_search(struct memblock_type *type, phys_addr_t addr)
{
        unsigned int left = 0, right = type->cnt;

        do {
                unsigned int mid = (right + left) / 2;

                if (addr < type->regions[mid].base)
                        right = mid;
                else if (addr >= (type->regions[mid].base +
                                  type->regions[mid].size))
                        left = mid + 1;
                else
                        return mid;
        } while (left < right);
        return -1;
}

int __init memblock_is_reserved(phys_addr_t addr)
{
        return memblock_search(&memblock.reserved, addr) != -1;
}

int memblock_is_memory(phys_addr_t addr)
{
        return memblock_search(&memblock.memory, addr) != -1;
}

int memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
{
        int idx = memblock_search(&memblock.reserved, base);

        if (idx == -1)
                return 0;
        return memblock.reserved.regions[idx].base <= base &&
                (memblock.reserved.regions[idx].base +
                 memblock.reserved.regions[idx].size) >= (base + size);
}


... so I don't know why you're saying that you already have them.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


  reply	other threads:[~2010-10-06  2:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05 22:46 Section mismatches in memblock H. Peter Anvin
2010-10-05 23:30 ` Yinghai Lu
2010-10-06  2:30   ` H. Peter Anvin [this message]
2010-10-06  3:04     ` H. Peter Anvin
2010-10-08  8:16       ` Ingo Molnar

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=4CABDF3A.2020501@zytor.com \
    --to=hpa@zytor.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=yinghai@kernel.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