Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6035451ybc; Wed, 27 Nov 2019 13:49:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxI9623N2DCm627wtfeDP/bZ+mqYmZAlzAXEoMox29H9QmiCn6HU3QtJXpcsXmMx3HNl4Tm X-Received: by 2002:a17:906:cc98:: with SMTP id oq24mr7802746ejb.170.1574891375345; Wed, 27 Nov 2019 13:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574891375; cv=none; d=google.com; s=arc-20160816; b=DzaNZAqZ/MOcSBLIH+FByW8s+Nyw2KT/Uz8KsGveoGZywIHtRcD4rQpnBNo70nRfYT ECfG7mVt1Zak1BiJfZ7DRZaiR+Y0/8qEVnmQX0HHu57hC2/AOcEzB+3sHNZyqvieJEQI JjzuaZwHLrCcnOyznN/d3rbc5KkMUtLZa8VWx0SzNL9YtT2ruCw+fvbhAwbke0CYTbzC X8r1g2oZcjJmjj9QKdfDjIOxtH9D31w6S+okKOZAHAoFo0MaoaLnE786xmOhj8cIfQm5 mTn0NxdbU/SvS344tDcrwzdT1eNiT9fiajt6UCKqZ4AE8/IalD2sDQ3jPYDTYY8EnsF8 1YFA== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=9Qdr29+XWHsUVHGrNImqah4XDXQIrsNTwj8CI6iFKSc=; b=DNGcuWc4HcKgckmoxKr62r/ggyXIcrcSvaUknhNFFF+QeXiRd+9PaipJfMRy+2Pw/N rOTTA+oSZ8HbgJuZs9F8kyubJXlg9iPrFobsZyc8nsJQIF7F9EvJ9AqW8rrY7JHMX0ev lvIhYaGjSb7qfHt+KKp7Q/rnLp9CoyHcMjPcHSHi29XTub1clYX/ZB17UVtrpjrgCltR Wjp4A9hX7NmzGcKouYgY8RVpl3nHV0qeMrwanHIoLbK/R2qLGb+5ZbnCcHv+vU2tSknM nvqcdKvwouVGrMQlmzkWpqiMxBoqsmRNU14JRY0KWZmaxd+OZ+QEqf9QhAtN4Q7SaeZs PHGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L6yhIeX7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m17si3495779edv.108.2019.11.27.13.49.11; Wed, 27 Nov 2019 13:49:35 -0800 (PST) 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=pass header.i=@kernel.org header.s=default header.b=L6yhIeX7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbfK0Vr1 (ORCPT + 99 others); Wed, 27 Nov 2019 16:47:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:56814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727491AbfK0Vr1 (ORCPT ); Wed, 27 Nov 2019 16:47:27 -0500 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D574420869; Wed, 27 Nov 2019 21:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574891245; bh=EkA1v2/1S366xNgUBA8JF1UoqzxfzHPPRcLBNop72jg=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=L6yhIeX7vtUrVoZIffP/tyZL5DNmbG1YiL9mIQjZQzz/LICwd+ImdBHrT5GstwJLl yb2BOXbZvt0vSsKxef1qXTSTE/p7tKpoG8+4GMmD7qT7/HQIy5RnwePNoL0vY1QH9H qoLOfaP8YkPp96MCHRj1tspm87P4GP6w694oua/Y= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id A6B2A352151A; Wed, 27 Nov 2019 13:47:25 -0800 (PST) Date: Wed, 27 Nov 2019 13:47:25 -0800 From: "Paul E. McKenney" To: Qais Yousef Cc: Thomas Gleixner , Greg Kroah-Hartman , Davidlohr Bueso , Josh Triplett , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 12/14] torture: Replace cpu_up/down with device_online/offline Message-ID: <20191127214725.GG2889@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20191125112754.25223-1-qais.yousef@arm.com> <20191125112754.25223-13-qais.yousef@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191125112754.25223-13-qais.yousef@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 25, 2019 at 11:27:52AM +0000, Qais Yousef wrote: > The core device API performs extra housekeeping bits that are missing > from directly calling cpu_up/down. > > See commit a6717c01ddc2 ("powerpc/rtas: use device model APIs and > serialization during LPM") for an example description of what might go > wrong. > > This also prepares to make cpu_up/down a private interface for anything > but the cpu subsystem. > > Signed-off-by: Qais Yousef > CC: Davidlohr Bueso > CC: "Paul E. McKenney" > CC: Josh Triplett > CC: linux-kernel@vger.kernel.org Looks fine from an rcutorture viewpoint, but why not provide an API that pulled lock_device_hotplug() and unlock_device_hotplug() into the online/offline calls? Thanx, Paul > --- > kernel/torture.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/kernel/torture.c b/kernel/torture.c > index 7c13f5558b71..12115024feb2 100644 > --- a/kernel/torture.c > +++ b/kernel/torture.c > @@ -97,7 +97,9 @@ bool torture_offline(int cpu, long *n_offl_attempts, long *n_offl_successes, > torture_type, cpu); > starttime = jiffies; > (*n_offl_attempts)++; > - ret = cpu_down(cpu); > + lock_device_hotplug(); > + ret = device_offline(get_cpu_device(cpu)); > + unlock_device_hotplug(); > if (ret) { > if (verbose) > pr_alert("%s" TORTURE_FLAG > @@ -148,7 +150,9 @@ bool torture_online(int cpu, long *n_onl_attempts, long *n_onl_successes, > torture_type, cpu); > starttime = jiffies; > (*n_onl_attempts)++; > - ret = cpu_up(cpu); > + lock_device_hotplug(); > + ret = device_online(get_cpu_device(cpu)); > + unlock_device_hotplug(); > if (ret) { > if (verbose) > pr_alert("%s" TORTURE_FLAG > @@ -192,17 +196,20 @@ torture_onoff(void *arg) > for_each_online_cpu(cpu) > maxcpu = cpu; > WARN_ON(maxcpu < 0); > - if (!IS_MODULE(CONFIG_TORTURE_TEST)) > + if (!IS_MODULE(CONFIG_TORTURE_TEST)) { > + lock_device_hotplug(); > for_each_possible_cpu(cpu) { > if (cpu_online(cpu)) > continue; > - ret = cpu_up(cpu); > + ret = device_online(get_cpu_device(cpu)); > if (ret && verbose) { > pr_alert("%s" TORTURE_FLAG > "%s: Initial online %d: errno %d\n", > __func__, torture_type, cpu, ret); > } > } > + unlock_device_hotplug(); > + } > > if (maxcpu == 0) { > VERBOSE_TOROUT_STRING("Only one CPU, so CPU-hotplug testing is disabled"); > -- > 2.17.1 >