Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1141329ybc; Tue, 19 Nov 2019 15:20:40 -0800 (PST) X-Google-Smtp-Source: APXvYqyUGvadVEaqQT/XUhLDAUv1K5czE6tGKZDstSzV729hahSyPE4DZG7LWt5gYlCQZ9VwUE7Z X-Received: by 2002:a17:906:2f09:: with SMTP id v9mr397429eji.91.1574205640613; Tue, 19 Nov 2019 15:20:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574205640; cv=none; d=google.com; s=arc-20160816; b=d7WtxRrk6kMIpppbguky9dJYoJMm9EPv6EorVAVNCiqG8orFD7vhA/sSF6204YYL1v NvzjN7mTfNWmsHgzxcrH5pQANIRdmvOEqlyByihgi1/0H9liNppSIhFFTHeM231wdc/n y/vmk53ykimOk+CVJX0hDxdiPKGCrx30oiODqLOQnoj8CwMyEij0WOUe0Mknh/ZkRWTt EFDi8mpYK0+uwZ+6goA+PHeHmjRaeDXrZBiNJbvekuouAoTWEoYPzXAa+1hra9sQSi/m TxVuiVPn3HLxVw+r57lwgQ1UuXZyFEZcqOXukMQSU1sCh4chki07Qsv9unkmUL00CyFl muHQ== 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=oKBaJkjm1gggMDisqJ7aOfTxk9orNFR2jRd8kxFiGSM=; b=OmNbN/qzex6krTDQkqdMGCe2KK+IqgSoErZeq03dxSpfb+GQ9TVPx1ahTomiAKzS8N YYqRNMNNUPaHy/t/ImdAtuTry89U+1s2hlMxjmIIBtZlZX/34fYM8FAHW0AEXiIQp8Cn iEQ9CxjOd/a+Lw/o9fNUHnuJHzjL4pG6Iu44ctmIT3E1Gps3a+zODpp73MaMoHo8x20d LHgLBWcKs8Jvskbv4h/lviHsldga2ROMuJlmi9He+Zt5uHkyjRzxayb3XsQe8PeIXMLQ VGf7zdqYajxyizT8WtUT126wxSjAS29zdIQgh5UMj2uc6JtcrDJHkke7gQV2xmPK2FoU m/xQ== 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 dc21si15167530ejb.101.2019.11.19.15.20.17; Tue, 19 Nov 2019 15:20:40 -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 S1727428AbfKSXTR (ORCPT + 99 others); Tue, 19 Nov 2019 18:19:17 -0500 Received: from foss.arm.com ([217.140.110.172]:59492 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727333AbfKSXTR (ORCPT ); Tue, 19 Nov 2019 18:19:17 -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 66F811FB; Tue, 19 Nov 2019 15:19:16 -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 827973F52E; Tue, 19 Nov 2019 15:19:15 -0800 (PST) Date: Tue, 19 Nov 2019 23:19:13 +0000 From: Qais Yousef To: Thomas Gleixner Cc: Greg Kroah-Hartman , Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 04/12] ia64: Replace cpu_down with freeze_secondary_cpus Message-ID: <20191119231912.viwqgcyzttoo5eou@e107158-lin.cambridge.arm.com> References: <20191030153837.18107-1-qais.yousef@arm.com> <20191030153837.18107-5-qais.yousef@arm.com> <20191119223234.ov323rcln4slj7br@e107158-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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/19/19 23:59, Thomas Gleixner wrote: > On Tue, 19 Nov 2019, Qais Yousef wrote: > > On 11/19/19 23:21, Thomas Gleixner wrote: > > > On Wed, 30 Oct 2019, Qais Yousef wrote: > > > > void machine_shutdown(void) > > > > { > > > > #ifdef CONFIG_HOTPLUG_CPU > > > > - int cpu; > > > > - > > > > - for_each_online_cpu(cpu) { > > > > - if (cpu != smp_processor_id()) > > > > - cpu_down(cpu); > > > > - } > > > > + /* TODO: Can we use disable_nonboot_cpus()? */ > > > > + freeze_secondary_cpus(smp_processor_id()); > > > > > > freeze_secondary_cpus() is only available for CONFIG_PM_SLEEP_SMP=y and > > > disable_nonboot_cpus() is a NOOP for CONFIG_PM_SLEEP_SMP=n :) > > > > I thought I replied to this :-( > > > > My plan was to simply make freeze_secondary_cpus() available and protected by > > CONFIG_SMP only instead. > > > > Good plan? > > No. freeze_secondary_cpus() is really for hibernation. Look at the exit > conditions there. Hmm do you mean the pm_wakeup_pending() abort? In arm64 we machine_shutdown() calls disable_nonboot_cpus(), which in turn a wrapper around freeze_secondary_cpus() with 0 passed as an argument. IIUC this means arm64 could fail to offline all CPUs on machine_shutdown(), correct? > > So you really want a seperate function which depends on CONFIG_HOTPLUG_CPU > and provides an inline stub for the CONFIG_HOTPLUG_CPU=n case. > > But I have a hard time to see how that stuff works at all on > ia64: > > cpu_down() might sleep, i.e. it must be called from preemptible > context. smp_processor_id() is invalid from preemtible context. > > As this is obviously broken and ia64 is in keep compile mode only, it > should just go away. If arm64 is doing the wrong thing, then we need a new function anyway. Thanks -- Qais Yousef