[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Question about arch/x86/xen/mmu.c


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Jan-Simon Moeller <dl9pf@xxxxxx>
  • Date: Thu, 04 Dec 2014 22:30:29 +0100
  • Delivery-date: Thu, 04 Dec 2014 21:32:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

Hi !

My name is Jan-Simon Moeller and I'm looking into compiling the kernel with 
LLVM/Clang (see llvm.linuxfoundation.org) . 

Right now we face this issue when compiling with clang:

 CC      arch/x86/xen/mmu.o
arch/x86/xen/mmu.c:1343:18: error: fields must have a constant size:
     'variable length array in structure' extension will never be
     supported
               DECLARE_BITMAP(mask, num_processors);
                              ^
include/linux/types.h:10:16: note: expanded from macro 'DECLARE_BITMAP'
       unsigned long name[BITS_TO_LONGS(bits)]
                     ^
1 error generated.


Question to the experts: why can't we just use NR_CPUS and be done with it ?
NR_CPUS will be setup by CONFIG_NR_CPUS and thus static.
( e.g. arch/x86/configs/x86_64_defconfig:CONFIG_NR_CPUS=64 )


The code in question is:

static void xen_flush_tlb_others(const struct cpumask *cpus,
                                 struct mm_struct *mm, unsigned long start,
                                 unsigned long end)
{
        struct {
                struct mmuext_op op;
#ifdef CONFIG_SMP
                DECLARE_BITMAP(mask, num_processors);
#else
                DECLARE_BITMAP(mask, NR_CPUS);
#endif
        } *args;
        struct multicall_space mcs;

        trace_xen_mmu_flush_tlb_others(cpus, mm, start, end);

        if (cpumask_empty(cpus))
                return;         /* nothing to do */

        mcs = xen_mc_entry(sizeof(*args));
        args = mcs.args;
        args->op.arg2.vcpumask = to_cpumask(args->mask);

        /* Remove us, and any offline CPUS. */
        cpumask_and(to_cpumask(args->mask), cpus, cpu_online_mask);
        cpumask_clear_cpu(smp_processor_id(), to_cpumask(args->mask));

        args->op.cmd = MMUEXT_TLB_FLUSH_MULTI;
        if (end != TLB_FLUSH_ALL && (end - start) <= PAGE_SIZE) {
                args->op.cmd = MMUEXT_INVLPG_MULTI;
                args->op.arg1.linear_addr = start;
        }

        MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF);

        xen_mc_issue(PARAVIRT_LAZY_MMU);
}


Pointers:
http://www.slideshare.net/linaroorg/lcu14-209-llvm-linux-39165110  # slide 19
http://lwn.net/Articles/441018/
http://stackoverflow.com/questions/14629504/variable-length-array-in-the-middle-of-struct-why-this-c-code-is-valid-for-gcc




Thanks!

Jan-Simon

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.