Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3658878ybi; Mon, 27 May 2019 03:54:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrIGq4sKaDcB4sJDci+rypb4Y2ik5OBU7UxVBoWREApuhkDFJ1bLBKB4i7Tu3cNQuVSHnU X-Received: by 2002:a17:902:b094:: with SMTP id p20mr101663572plr.164.1558954455881; Mon, 27 May 2019 03:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558954455; cv=none; d=google.com; s=arc-20160816; b=YLZhmPWB/I/2e3CwXaJtyc8FrmE91klKpLw6ln9DfnSBbqa+qg1XV9M9LEG1M3qiiS JxcF56OeBn8eywjJacuzbv3th4T39DNlyH1gmtw3m1ZW+i73nnOuxDHQtwvGcD9lLLCS Y580Ti7mXE0D5Z6SOrmv4Vz21OmgUC+t0Jag3M/RvWa4PwdNwzDKOu20DpuAyY2yc+bm tOHx9/NJ3TwDMS0Yg7nehsJKKe79gaBxuroX0Dl/Fb2XJkVYXFL89ErxwqC1iq/K043+ bB9wkTGOj//s2gpzf1VEqEZeVJXXWi94Zq/syGZTp9WSsyba+wJIKjZHUBLDezjXJq54 hBQg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7y/ZIAVRFGv3U2Fb/JXw1uaz+a1Vf4aQoe4TK3E1YMI=; b=Du6mhaFZrUWjjFT6nYymdHuQLw0rdGiusT6QXFA4qxP2bfrbYoOIMzguUGaOW4ufK3 0hsyur3B0JPSpwpX5ogByDRQVaw3MEPMT7csvp/0FKgyRfsJpHh0t0a5x5TlhwzWbgRE PkdaUrShLlSKUEw/PUssTo/W0GDgvqH9rPEUyrLI0LihYAGap2wsYOIQlMM643cUhady ieGQEWAifBw/fL+K2lPlwfWrrdzGfV8dL+FaqGeMOd7+rk5qAN44EiIcCYxIBgML269u YfcnzuquqtdeE8WmYJLLPV/E99WKfb7wV8oLJkNyjpl8wGC6wOQ1G0C6CI16Zhg69Hwh 7ZuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ADSwSfiG; 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 n24si16813887pgk.200.2019.05.27.03.53.59; Mon, 27 May 2019 03:54:15 -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=bombadil.20170209 header.b=ADSwSfiG; 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 S1726564AbfE0KwJ (ORCPT + 99 others); Mon, 27 May 2019 06:52:09 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:54558 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725814AbfE0KwI (ORCPT ); Mon, 27 May 2019 06:52:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding: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=7y/ZIAVRFGv3U2Fb/JXw1uaz+a1Vf4aQoe4TK3E1YMI=; b=ADSwSfiGnpgpd477tSoPRL4e+ Z9BciYq0/ZaV1YiFsg5IhewUOpD9eZtIgIuHiaH/QPxCrrWMAQKFq1Mll1y4tP4BGjNCWSKzqjm91 4aEq4+XxqsnGBtYGWBOCmTeg++fOn/RRjw+n6F5itY6l/SkM8x+eSIRolLSWoML9T7Ob8zLUNNAOq fS/FNuLDOUgGG8fcUIBlu8RnK38Gg1ommxgK9hajSZyfGJGjn/ltyjB1nv7KpfG8ycddtRMrJPkQF /Skv3C8a/L+fYFL5+YAzsGgmT9E5giHqAsWcdET+EwyW86hh/wH2SNpRgnjgM6v2TbAnOd52vI6qO I7xDwYy7w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVDEb-0000ec-0y; Mon, 27 May 2019 10:52:05 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AB5912027F766; Mon, 27 May 2019 12:52:02 +0200 (CEST) Date: Mon, 27 May 2019 12:52:02 +0200 From: Peter Zijlstra To: Andrew Murray Cc: Thomas Gleixner , Rik van Riel , linux-kernel@vger.kernel.org Subject: Re: [PATCH] smp,cpumask: Don't call functions on offline CPUs Message-ID: <20190527105202.GY2623@hirez.programming.kicks-ass.net> References: <20190522111537.27815-1-andrew.murray@arm.com> <20190522140921.GD16275@worktop.programming.kicks-ass.net> <20190522143711.GC8268@e119886-lin.cambridge.arm.com> <20190522144918.GH16275@worktop.programming.kicks-ass.net> <20190522151422.GD8268@e119886-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190522151422.GD8268@e119886-lin.cambridge.arm.com> 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 Wed, May 22, 2019 at 04:14:23PM +0100, Andrew Murray wrote: > On Wed, May 22, 2019 at 04:49:18PM +0200, Peter Zijlstra wrote: > > On Wed, May 22, 2019 at 03:37:11PM +0100, Andrew Murray wrote: > > > > Is perhaps the problem that on_each_cpu_cond() uses cpu_onlne_mask > > > > without protection? > > > > > > Does this prevent racing with a CPU going offline? I guess this prevents > > > the warning at the expense of a lock - but is only beneficial in the > > > unlikely path. (In the likely path this prevents new CPUs going offline > > > but we don't care because we don't WARN if they aren't they when we > > > attempt to call functions). > > > > > > At least this is my limited understanding. > > > > Hmm.. I don't think it could matter, we only use the mask when > > preempt_disable(), which would already block offline, due to it using > > stop_machine(). > > OK, so as long as all arches use stop_machine to bring down a CPU then > preeempt_disable will stop racing with CPUs going offline (I don't know > if they all do or not). kernel/cpu.c:takedown_cpu() is generic code :-) > > So the patch is a no-op. > > > > What's the WARN you see? TLB invalidation should pass mm_cpumask(), > > which similarly should not contain offline CPUs I'm thinking. > > So the only remaining issue is if callers pass offline CPUs to the > function (I guess there is still the chance of a race between calling > on_each_cpu_cond_mask and entering the preempt disabled'd bit). As you > suggest they probably don't. Yes, it is possible to construct fail that way.