Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7852142ybi; Mon, 22 Jul 2019 22:11:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFntiApnq34eZq0kiVJdcnBnfOGrl+zRdaq/xn5gHL4XibLLhjP4qcnj1sNiN+1AdfB7yn X-Received: by 2002:a63:d415:: with SMTP id a21mr72891308pgh.229.1563858696534; Mon, 22 Jul 2019 22:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563858696; cv=none; d=google.com; s=arc-20160816; b=ZDlpVkyiuCOYfiaFaIHbaYdV/B2g03VaX5GtOuMOkcU9CZCtGPPAOcDRRip/kylILA n2SzVWs9/zs/j8EC2f5YhVUtF1Ffcb3qB41xu0UOtw2A/FCwsBjzpdPz4Zlzh6iu1FVR d74JDvMu5qewRCcAsNRGcy4SxuXAchG0wjtSDNgzcWlIhIQNER3nwUiF2Q2l9n9B9KbC 6NFozUghSFQlZXOro+II49fjEdK4aQo/LIlh3FcE8U5i0NS45zC4am/xYw75OGZa3O2c noXPQ7ReHLllShfQvDj1zd8aJHzfvX5MoNGIiAZbBMQpr/YA8vK7TSBUlGiDbIC+t7Kc 7ZFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XA38J2mrIvGomm9eDYffUQCSCdYHMKLwi/HGUwSUnwo=; b=LgKUepuQFfzN4ot3m0TMt8ffEzw8A18wbWn2TP9GOrlxzuLmFktebA+i48BZIfL4Fq tjkrWkga4LqkfxZfkatdOEMctymhSiY/7m4LDf1VRAPbb6efQkd00XglZzwHkI7rjP+r L5Ag0CXoGMPC4431YlU1F6UGZ1VfDd7qEKCyFG/VtIpJnhhumZsJZOa71snU9HHg02uL iP4/03eOIXLPJYDyE6Ytke0gHZj27TkPME12MAplXbvM85RwJjzepBGpmDABVbS6eK+w OlJCLNV/P3+hMGY2+bqmkXyOMDIEoj9mEzBhzEwVPnYBfh4GdL9+tN92UjHrScWQ1z9R CmAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Bikgl7W2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si4655201pfc.99.2019.07.22.22.11.20; Mon, 22 Jul 2019 22:11:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Bikgl7W2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727866AbfGVTeX (ORCPT + 99 others); Mon, 22 Jul 2019 15:34:23 -0400 Received: from merlin.infradead.org ([205.233.59.134]:37374 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726380AbfGVTeX (ORCPT ); Mon, 22 Jul 2019 15:34:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XA38J2mrIvGomm9eDYffUQCSCdYHMKLwi/HGUwSUnwo=; b=Bikgl7W2GPCpfti4CaNgYdUOmP qet0WayR7rafBmhw8BikzuXKA7pTLgYNvEf0S0hbrxa9RQqL/KPhrKJcnG5Qcy0T5xyPjhdeqefGX No4+d1kVtBmlEaRedWn/gBQAZAihqCAMm4BT8+xldViIzOCyUJHkGxqgHfHdTuiYdDI5ruqeDPSm8 3TQsCcY3ZeWcTKRpMOc0HpP7Pu7h9a79qIAEugVTDBnCew3WKeG/W4Kj4N4et3C0z+fPX/VsptkaV GTJOLVA3cE2IkxCdZrJ1PK5roOHbGhSsCECiAqJS+vKLbcgkOKi2cX7b/JogKQf+GZvbqXK5yKotU JviTmTQw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hpe4e-0006IZ-9a; Mon, 22 Jul 2019 19:34:16 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 806C3980C59; Mon, 22 Jul 2019 21:34:14 +0200 (CEST) Date: Mon, 22 Jul 2019 21:34:14 +0200 From: Peter Zijlstra To: Nadav Amit Cc: Dave Hansen , Andy Lutomirski , Dave Hansen , the arch/x86 maintainers , LKML , Thomas Gleixner , Ingo Molnar , Rik van Riel , Josh Poimboeuf Subject: Re: [PATCH v3 1/9] smp: Run functions concurrently in smp_call_function_many() Message-ID: <20190722193414.GG6698@worktop.programming.kicks-ass.net> References: <20190719005837.4150-1-namit@vmware.com> <20190719005837.4150-2-namit@vmware.com> <20190722181658.GA6698@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 22, 2019 at 06:41:44PM +0000, Nadav Amit wrote: > > On Jul 22, 2019, at 11:16 AM, Peter Zijlstra wrote: > > > > On Fri, Jul 19, 2019 at 11:23:06AM -0700, Dave Hansen wrote: > >> On 7/18/19 5:58 PM, Nadav Amit wrote: > >>> @@ -624,16 +622,11 @@ EXPORT_SYMBOL(on_each_cpu); > >>> void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func, > >>> void *info, bool wait) > >>> { > >>> - int cpu = get_cpu(); > >>> + preempt_disable(); > >>> > >>> - smp_call_function_many(mask, func, info, wait); > >>> - if (cpumask_test_cpu(cpu, mask)) { > >>> - unsigned long flags; > >>> - local_irq_save(flags); > >>> - func(info); > >>> - local_irq_restore(flags); > >>> - } > >>> - put_cpu(); > >>> + __smp_call_function_many(mask, func, func, info, wait); > >>> + > >>> + preempt_enable(); > >>> } > >> > >> The get_cpu() was missing it too, but it would be nice to add some > >> comments about why preempt needs to be off. I was also thinking it > >> might make sense to do: > >> > >> cfd = get_cpu_var(cfd_data); > >> __smp_call_function_many(cfd, ...); > >> put_cpu_var(cfd_data); > >> > >> instead of the explicit preempt_enable/disable(), but I don't feel too > >> strongly about it. > > > > It is also required for cpu hotplug. > > But then smpcfd_dead_cpu() will not respect the “cpu” argument. Do you still > prefer it this way (instead of the current preempt_enable() / > preempt_disable())? I just meant that the preempt_disable() (either form) is required for hotplug (we must not send IPIs to offline CPUs, that gets things upset). Personally I don't mind the bare preempt_disable() as you have; but I think Dave's idea of a comment has merrit.