linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>, Tejun Heo <tj@kernel.org>,
	Christoph Lameter <cl@linux.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>, Thomas Graf <tgraf@suug.ch>,
	Ingo Molnar <mingo@kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>
Subject: Re: [llvmlinux] percpu | bitmap issue? (Cannot boot on bare metal due to a kernel NULL pointer dereference)
Date: Wed, 9 Sep 2015 11:25:41 +0800	[thread overview]
Message-ID: <20150909032541.GC1998@dhcp-17-102.nay.redhat.com> (raw)
In-Reply-To: <CA+icZUUgVEaYmToXd6j4sHT2PW3CH++B7DcO-Mj48W2rBD6yAQ@mail.gmail.com>

Hi Sedat,

On 09/09/15 at 04:51am, Sedat Dilek wrote:
> On Wed, Sep 9, 2015 at 4:29 AM, Baoquan He <bhe@redhat.com> wrote:
> commit 1a1d48a4a8fde49aedc045d894efe67173d59fe0
> "linux/bitmap: Force inlining of bitmap weight functions"
> 
> ...on top of Linux v4.2.
> 
> This resulted in the same call-trace in QEMU.
> 
> I hacked around to only re-build mm/percpu.c with GCC (rest with
> CLANG) with some guidance from Linus (compiler warapper-script) etc.

Sorry, from below log message and code flow I didn't get what's wrong
with it. I am working on another issue which gives me much headache,
don't hvae time to look into the the disassembling code now. But if GCC
built code works, it should be related to compiler issues. You can try
more tests, e.g build percpu.c bitmap.c with GCC. Maybe other people
can give suggestions.

Sorry again, Sedat.

setup_percpu: NR_CPUS:256 nr_cpumask_bits:256 nr_cpu_ids:1 nr_node_ids:1

arch/x86/kernel/setup_percpu.c:setup_per_cpu_areas() ->
mm/percpu.c : pcpu_embed_first_chunk() ->
mm/percpu.c:pcpu_build_alloc_info() ->
include/linux/cpumask.h:
#define num_possible_cpus()     cpumask_weight(cpu_possible_mask)
static inline unsigned int cpumask_weight(const struct cpumask *srcp)                                                                            
{
        return bitmap_weight(cpumask_bits(srcp), nr_cpumask_bits);
}

include/linux/bitmap.h:
static inline int bitmap_weight(const unsigned long *src, unsigned int nbits)                                                                    
{
        if (small_const_nbits(nbits))
                return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
        return __bitmap_weight(src, nbits);
}

lib/bitmap.c:
int __bitmap_weight(const unsigned long *bitmap, unsigned int bits)
{
        unsigned int k, lim = bits/BITS_PER_LONG;
        int w = 0;

        for (k = 0; k < lim; k++)                                                                                                                
                w += hweight_long(bitmap[k]);

        if (bits % BITS_PER_LONG)
                w += hweight_long(bitmap[k] & BITMAP_LAST_WORD_MASK(bits));
        
        return w;
}
EXPORT_SYMBOL(__bitmap_weight);


  parent reply	other threads:[~2015-09-09  3:25 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-06 17:45 [llvmlinux] percpu | bitmap issue? (Cannot boot on bare metal due to a kernel NULL pointer dereference) Sedat Dilek
2015-09-07  5:58 ` Sedat Dilek
     [not found]   ` <CA+icZUUs3KEydWRgu_Y+YqS4TcCNp2DUw3Y+KfBzX7aPg_kzLw@mail.gmail.com>
2015-09-09  2:29     ` Baoquan He
2015-09-09  2:51       ` Sedat Dilek
2015-09-09  3:04         ` Sedat Dilek
2015-09-09  3:14           ` Sedat Dilek
2015-09-09  3:25         ` Baoquan He [this message]
2015-09-09  3:46           ` Sedat Dilek
2015-09-09  6:56             ` Sedat Dilek
2015-09-09  7:14               ` Baoquan He
2015-09-09  7:41                 ` Sedat Dilek
2015-09-09 10:05                   ` Sedat Dilek
2015-09-09 12:54                     ` Peter Zijlstra
2015-09-12 21:22                       ` Sedat Dilek
2015-09-13  2:33                         ` Sedat Dilek
2015-09-14  7:12                           ` Peter Zijlstra
2015-09-14  7:35                             ` Sedat Dilek
2015-09-14  7:57                               ` Sedat Dilek
2015-09-14  8:54                               ` Peter Zijlstra
2015-09-14  9:35                                 ` Ingo Molnar
2015-09-14  9:55                                   ` Sedat Dilek
2015-09-14  9:59                                     ` Ingo Molnar
2015-09-14 10:22                                       ` Sedat Dilek
2015-09-14 12:47                                         ` Ingo Molnar
2015-09-14  7:49                             ` Sedat Dilek
2015-09-14 17:50                               ` Austin S Hemmelgarn
2015-09-14 18:27                                 ` Christoph Lameter
2015-09-14 18:38                                   ` Austin S Hemmelgarn
2015-09-15  6:11                                   ` 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=20150909032541.GC1998@dhcp-17-102.nay.redhat.com \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    --cc=sedat.dilek@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tgraf@suug.ch \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@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;
as well as URLs for NNTP newsgroup(s).