Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6992693ybc; Thu, 28 Nov 2019 08:57:45 -0800 (PST) X-Google-Smtp-Source: APXvYqzioTY1RdXOIVAL09Ym6qCsbyAhdVR7UMIRC5dP8+mNahtt3wKc8G9AX+d0Yio8Ptr4nzqg X-Received: by 2002:a05:6402:1611:: with SMTP id f17mr16207105edv.266.1574960265306; Thu, 28 Nov 2019 08:57:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574960265; cv=none; d=google.com; s=arc-20160816; b=qY8yuHwrXCn/sWUi9PuXrjUke0N+usoaJV9EEESix+OAtzAjw/iIShiJfOUiTDe8Of 7ul+mGSB2ONWylcU88MwNlWba8OEYy9ZiPhvrVN0sA6kUdTDbl7LGD0SZkCFzDtGj1BI 2uQKv2WFbuGIIMXPnWGBnZqOzWHDns8X7eOL6iSkX2pWxjfyJ5HtfNDU1zlLM3EO64Zc JH/H2ZkHnuYTv/62i/r+1xejZ6FMPeZcJ42kDnABblKHZaxFQODjhWzcCNgjkKgmIWlG IbDIPZwZCv++D+b/xXXTTTjWrWqm03uAfK2Vne4TfiAjmiYvrxi+Tl90mwqFmEwQSfnn eq3w== 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; bh=czPuVwghFwCo4Cckhd+KtMqzX7BD4oJp/k6wNA91o7A=; b=HH+FLzfHUPiKkQCbZaDKvCoGQTE+EwNuvqKit6lb0gFJXxuLNS5aJARIKf+PAY+VSH +Z7l48QiR627MHRT57kwIPh1Ij1rVgMFa624Iri5tD++93zKOdRjZjQryWqKlbU59Kvk GEpYSPHzdZaMfONzwOXDrr6slYZrBYMiMUxbBC6kk9jfQjCJdMDJJ7DecPMVQtxA4JnA TTLWa/0IoOL6wq98as+e3xmiqMddXvI1ztIexXtP1OuAGD9GkV2XWe+E5C61aUm8eHyU JFV0zuRZhj9ZmcY1v+dHcJQ06B2GH2NUqlVyKVEgcn+RnBLCVx5m7nI6VcBV3/sx8ROO V1Gw== ARC-Authentication-Results: i=1; mx.google.com; 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 cf2si7326049edb.435.2019.11.28.08.57.20; Thu, 28 Nov 2019 08:57:45 -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; 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 S1726593AbfK1Q4Q (ORCPT + 99 others); Thu, 28 Nov 2019 11:56:16 -0500 Received: from foss.arm.com ([217.140.110.172]:38594 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbfK1Q4Q (ORCPT ); Thu, 28 Nov 2019 11:56:16 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6CC3E1FB; Thu, 28 Nov 2019 08:56:15 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 86FD13F6C4; Thu, 28 Nov 2019 08:56:14 -0800 (PST) Date: Thu, 28 Nov 2019 16:56:12 +0000 From: Qais Yousef To: "Paul E. McKenney" 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: <20191128165611.7lmjaszjl4gbo7u2@e107158-lin.cambridge.arm.com> References: <20191125112754.25223-1-qais.yousef@arm.com> <20191125112754.25223-13-qais.yousef@arm.com> <20191127214725.GG2889@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191127214725.GG2889@paulmck-ThinkPad-P72> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/27/19 13:47, Paul E. McKenney wrote: > 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? I *think* the right way to do what you say is by doing lock_device_hotplug() inside device_{online, offline}() - which affects all drivers not just the CPU. And even then, I think we need to refcount it so nested calls won't deadlock. I don't know if this can break any rule or not. If Greg thinks it's okay I'd be happy to post some patches that do just that. Thanks -- Qais Yousef > > 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 > >