From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756052AbdKJH71 (ORCPT ); Fri, 10 Nov 2017 02:59:27 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:38275 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755343AbdKJH7Y (ORCPT ); Fri, 10 Nov 2017 02:59:24 -0500 Date: Fri, 10 Nov 2017 08:59:14 +0100 From: Peter Zijlstra To: Wanpeng Li Cc: Radim Krcmar , Pankaj Gupta , Eduardo Valentin , Paolo Bonzini , Matt Wilson , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , the arch/x86 maintainers , Waiman Long , kvm , linux-doc@vger.kernel.org, "linux-kernel@vger.kernel.org" , "Jan H . Schoenherr" , Anthony Liguori Subject: Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set Message-ID: <20171110075914.mcjp2niadqszo3yb@hirez.programming.kicks-ass.net> References: <1509999980-10828-1-git-send-email-eduval@amazon.com> <789734192.29237413.1510242805535.JavaMail.zimbra@redhat.com> <20171109160536.GE20859@flask> <20171109161701.y3eqqrvs5jpg46lr@hirez.programming.kicks-ass.net> <20171109164523.GF20859@flask> <20171109171241.43zpahj24mhzzp3y@hirez.programming.kicks-ass.net> <20171109171511.gckh2lt7xksmiern@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 10, 2017 at 10:07:56AM +0800, Wanpeng Li wrote: > >> Also, you should not put cpumask_t on stack, that's 'broken'. > > Thanks pointing out this. I found a useful comments in arch/x86/kernel/irq.c: > > /* These two declarations are only used in check_irq_vectors_for_cpu_disable() > * below, which is protected by stop_machine(). Putting them on the stack > * results in a stack frame overflow. Dynamically allocating could result in a > * failure so declare these two cpumasks as global. > */ > static struct cpumask affinity_new, online_new; That code no longer exists.. Also not entirely sure how it would be helpful. What you probably want to do is have a per-cpu cpumask, since flush_tlb_others() is called with preemption disabled. But you probably don't want an unconditionally allocated one, since most kernels will not in fact be PV. So you'll want something like: static DEFINE_PER_CPU(cpumask_var_t, __pv_tlb_mask); And then you need something like: for_each_possible_cpu(cpu) { zalloc_cpumask_var_node(per_cpu_ptr(&__pb_tlb_mask, cpu), GFP_KERNEL, cpu_to_node(cpu)); } before you set the pv-op or so.