Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1026146ybx; Wed, 30 Oct 2019 08:44:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiV/Hgx+B8PH3LSbnSB9ZHCPS96RNThEJKTZZMPIUNvgT4YkrFrwk+kA2NK3WUO5oepd2U X-Received: by 2002:a05:6402:1212:: with SMTP id c18mr366306edw.166.1572450291969; Wed, 30 Oct 2019 08:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572450291; cv=none; d=google.com; s=arc-20160816; b=KKvTXcy3wsWyghq3D30m+t8djaEzBPKSSPDhDHLOP0lC2D7DIkrRjFO/LL1lmhNcKK SFKwKKTitXV9C5tg2wXENcUik7+NjmSyxsnOqwbOtrs1hRcdvsncbIHC4e0xhIsaqrz6 4JZeBhP2VF8JAtZfzVV+BXgfhrW6VQbQYZik/aOW4jjj0Eef06RzxWD/B6NonJ0itXac rvks/i8ZwqBfHM+LCjGkO/VgElEoXp56udhrTdmpetuUhV49iVUPuGagvnWohlRWuX9P w+gzaj3q5+W20abvZUQqk/sqakJOt1bTlJsOrkF3WkF1H7vMn1UfFo70DnLIl0a2EmjQ GK7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=ev2JfRi6sPU+/q0JImfZgS/PRd1rXL/6bZt4FrqdKBk=; b=B4RTrfjkEwc+GFxNA9wRQDkaho9HekVAhn6qN3repYEJg0ovLZZ7Ttr+zyvHkiOo0G D6ARH5osIH4rNyRLvYT58iG3kCte9S/N1pCuFahfzOOsrMUxVY88z/ClfLLDiOGMCIxM pxbkts43n5TBa+ful1RicDFIOAJIq49hsrK4dHtJ6fi+vk4hWSqWm6BSOG813tkNHFlI z8tmIJ2SVLW6Ro3w/rq+/VoVuBR8k+mDdpx51P9iTW3LYYd5kiWfGZdeaP8KyEnuxccJ /yscy5twDUq32j2k9WC5ZbN3CFDPIOC/hmAVIAhaz+lm9Zf1sdDNptmHbmuQxfvuLT5b X9vA== 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 v26si1599895ejg.55.2019.10.30.08.44.27; Wed, 30 Oct 2019 08:44:51 -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; 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 S1727355AbfJ3PmX (ORCPT + 99 others); Wed, 30 Oct 2019 11:42:23 -0400 Received: from foss.arm.com ([217.140.110.172]:36654 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbfJ3PmW (ORCPT ); Wed, 30 Oct 2019 11:42:22 -0400 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 5F8EF337; Wed, 30 Oct 2019 08:42:21 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 258383F6C4; Wed, 30 Oct 2019 08:42:20 -0700 (PDT) From: Qais Yousef To: Thomas Gleixner , Greg Kroah-Hartman Cc: Qais Yousef , "David S. Miller" , Bjorn Helgaas , "Rafael J. Wysocki" , Sakari Ailus , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/12] sparc: Replace cpu_up/down with device_online/offline Date: Wed, 30 Oct 2019 15:38:30 +0000 Message-Id: <20191030153837.18107-6-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191030153837.18107-1-qais.yousef@arm.com> References: <20191030153837.18107-1-qais.yousef@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: "David S. Miller" CC: Thomas Gleixner CC: Bjorn Helgaas CC: "Rafael J. Wysocki" CC: Greg Kroah-Hartman CC: Sakari Ailus CC: sparclinux@vger.kernel.org CC: linux-kernel@vger.kernel.org --- arch/sparc/kernel/ds.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c index bbf59b3b4af8..39350e5dbaf1 100644 --- a/arch/sparc/kernel/ds.c +++ b/arch/sparc/kernel/ds.c @@ -550,12 +550,13 @@ static int dr_cpu_configure(struct ds_info *dp, struct ds_cap_state *cp, mdesc_populate_present_mask(mask); mdesc_fill_in_cpu_data(mask); + lock_device_hotplug(); for_each_cpu(cpu, mask) { int err; printk(KERN_INFO "ds-%llu: Starting cpu %d...\n", dp->id, cpu); - err = cpu_up(cpu); + err = device_online(get_cpu_device(cpu)); if (err) { __u32 res = DR_CPU_RES_FAILURE; __u32 stat = DR_CPU_STAT_UNCONFIGURED; @@ -574,6 +575,7 @@ static int dr_cpu_configure(struct ds_info *dp, struct ds_cap_state *cp, dr_cpu_mark(resp, cpu, ncpus, res, stat); } } + unlock_device_hotplug(); spin_lock_irqsave(&ds_lock, flags); __ds_send(dp->lp, resp, resp_len); @@ -606,17 +608,19 @@ static int dr_cpu_unconfigure(struct ds_info *dp, resp_len, ncpus, mask, DR_CPU_STAT_UNCONFIGURED); + lock_device_hotplug(); for_each_cpu(cpu, mask) { int err; printk(KERN_INFO "ds-%llu: Shutting down cpu %d...\n", dp->id, cpu); - err = cpu_down(cpu); + err = device_offline(get_cpu_device(cpu)); if (err) dr_cpu_mark(resp, cpu, ncpus, DR_CPU_RES_FAILURE, DR_CPU_STAT_CONFIGURED); } + unlock_device_hotplug(); spin_lock_irqsave(&ds_lock, flags); __ds_send(dp->lp, resp, resp_len); -- 2.17.1