From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753429AbcJKPm4 (ORCPT ); Tue, 11 Oct 2016 11:42:56 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:52317 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752185AbcJKPmz (ORCPT ); Tue, 11 Oct 2016 11:42:55 -0400 Date: Tue, 11 Oct 2016 17:42:51 +0200 From: Pavel Machek To: Andy Lutomirski Cc: Chen Yu , linux-pm@vger.kernel.org, x86@kernel.org, "Rafael J. Wysocki" , Len Brown , Peter Zijlstra , "H. Peter Anvin" , Borislav Petkov , Brian Gerst , Thomas Gleixner , Ingo Molnar , Varun Koyyalagunta , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4][RFC v2] PM / sleep: Introduce arch-specific hook for disable/enable nonboot cpus Message-ID: <20161011154251.GA22569@amd> References: <8f0aeb0a-5e72-8327-2406-a78ad783f6f2@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GvXjxJ+pjyke8COw" Content-Disposition: inline In-Reply-To: <8f0aeb0a-5e72-8327-2406-a78ad783f6f2@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --GvXjxJ+pjyke8COw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri 2016-10-07 12:31:41, Andy Lutomirski wrote: > On 06/25/2016 09:18 AM, Chen Yu wrote: > >There is requirement that we need to do some arch-specific > >operations before putting the nonboot CPUs offline/online. > >One of the requirements comes from the hibernation resume > >process on x86_64, we need to kick all the offlin-CPUs > >online and offline again, in order to put them in a safe > >state, thus to avoid possible unwilling wake up during > >hibernation resume. > > > >Signed-off-by: Chen Yu > >--- > > kernel/cpu.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > >diff --git a/kernel/cpu.c b/kernel/cpu.c > >index d25266e..ce6e5e4 100644 > >--- a/kernel/cpu.c > >+++ b/kernel/cpu.c > >@@ -1017,6 +1017,16 @@ EXPORT_SYMBOL_GPL(cpu_up); > > #ifdef CONFIG_PM_SLEEP_SMP > > static cpumask_var_t frozen_cpus; > > > >+void __weak arch_disable_nonboot_cpus_pre(void) >=20 > I don't like using __weak. It penalizes code size on architectures that > don't hook these functions. My preferred pattern is: >=20 > include/linux/something.h: >=20 > #include >=20 > #ifndef arch_do_xyz > static inline void arch_do_xyz() {} > #endif >=20 > arch/whatever/asm/something.h: >=20 > extern void arch_do_xyz(); /* or static inline... */ > #define arch_do_xyz >=20 >=20 > This is totally free for architectures that don't have the hooks and it c= an > potentially be inlined on architectures that do have the hooks. Everyone > wins except that it's about five additional lines of code. Well... 5 additional lines may be worse than few bytes in the object file... Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --GvXjxJ+pjyke8COw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlf9CHsACgkQMOfwapXb+vKiUQCgr4T5tIoRHTQ1z7ZPOQb6nU5G XqwAoL13xYYo9fIYc3+nuSTIiCql3ujO =wk4W -----END PGP SIGNATURE----- --GvXjxJ+pjyke8COw--