2017-11-16 10:38:31

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH v5 2/4] KVM: X86: Add paravirt remote TLB flush

On Thu, Nov 16, 2017 at 01:30:57PM +0800, Wanpeng Li wrote:
> -static DEFINE_PER_CPU(cpumask_var_t, __pv_tlb_mask);
> +static DEFINE_PER_CPU(cpumask_t, __pv_tlb_mask);

NR_CPUS=512 is a fairly common distro setting, that means cpumask_t is
64 bytes. So for my 144 CPU system, that is 9216 bytes I'll never see
again.

Not nice :/

From 1584218012699172642@xxx Thu Nov 16 10:27:10 +0000 2017
X-GM-THRID: 1583909069046568739
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread


2017-11-16 10:27:10

by Wanpeng Li

[permalink] [raw]
Subject: Re: [PATCH v5 2/4] KVM: X86: Add paravirt remote TLB flush

2017-11-16 16:38 GMT+08:00 Peter Zijlstra <[email protected]>:
> On Thu, Nov 16, 2017 at 01:30:57PM +0800, Wanpeng Li wrote:
>> -static DEFINE_PER_CPU(cpumask_var_t, __pv_tlb_mask);
>> +static DEFINE_PER_CPU(cpumask_t, __pv_tlb_mask);
>
> NR_CPUS=512 is a fairly common distro setting, that means cpumask_t is
> 64 bytes. So for my 144 CPU system, that is 9216 bytes I'll never see
> again.
>
> Not nice :/

Refer to "DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map)"
in arch/ia64/include/asm/smp.h, it also defines variable directly,
however, some other archs are not. kvmclock_init() is also called very
early during boot, it utilizes memblock to alloc some memory.

Regards,
Wanpeng Li

From 1584215469747025310@xxx Thu Nov 16 09:46:45 +0000 2017
X-GM-THRID: 1583909069046568739
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread

2017-11-16 09:46:45

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH v5 2/4] KVM: X86: Add paravirt remote TLB flush

On Thu, Nov 16, 2017 at 04:51:39PM +0800, Wanpeng Li wrote:
> 2017-11-16 16:38 GMT+08:00 Peter Zijlstra <[email protected]>:
> > On Thu, Nov 16, 2017 at 01:30:57PM +0800, Wanpeng Li wrote:
> >> -static DEFINE_PER_CPU(cpumask_var_t, __pv_tlb_mask);
> >> +static DEFINE_PER_CPU(cpumask_t, __pv_tlb_mask);
> >
> > NR_CPUS=512 is a fairly common distro setting, that means cpumask_t is
> > 64 bytes. So for my 144 CPU system, that is 9216 bytes I'll never see
> > again.
> >
> > Not nice :/
>
> Refer to "DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map)"
> in arch/ia64/include/asm/smp.h, it also defines variable directly,
> however, some other archs are not. kvmclock_init() is also called very
> early during boot, it utilizes memblock to alloc some memory.

So the difference is that the sibling map is guaranteed to be used.

This map of yours is only ever used if you run a paravirt kernel on a
new enough host to advertise the capability etc.

As said on IRC; I'm forever lost in the whole init / paravirt setup
maze, but can't you simply do things later when the allocators work?
ISTR we don't in fact run the alternative stuff _that_ early anyway.

From 1584205961529214889@xxx Thu Nov 16 07:15:37 +0000 2017
X-GM-THRID: 1583909069046568739
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread