From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751719AbdIENAA convert rfc822-to-8bit (ORCPT ); Tue, 5 Sep 2017 09:00:00 -0400 Received: from mout.gmx.net ([212.227.15.15]:64064 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751409AbdIEM76 (ORCPT ); Tue, 5 Sep 2017 08:59:58 -0400 Message-ID: <1504616361.6605.27.camel@gmx.de> Subject: Re: [PATCH 2/2] smp/hotplug,lockdep: Annotate cpuhp_state From: Mike Galbraith To: Peter Zijlstra , mingo@kernel.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Byungchul Park , Sebastian Andrzej Siewior Date: Tue, 05 Sep 2017 14:59:21 +0200 In-Reply-To: <20170905075351.745979795@infradead.org> References: <20170905075218.526515965@infradead.org> <20170905075351.745979795@infradead.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 Mime-Version: 1.0 Content-Transfer-Encoding: 8BIT X-Provags-ID: V03:K0:TdxL09UH8NrZD35Vt7hSHenbpATWB7momCKD9aUx1TTC5l4ZAND PxyLlxe7fJO2GgHyqrrZ6+2fd6omGWOxCKS/730WER+1vA4cRInV3tItL0jEE7nUmqfonrn 3QaCyJcP61nNvpolVSYbPUeF6evWZP+fNBnXjTRQWAyVCJvlWweHmfcGWIkVR3SORtsGMZ7 Fhgrl2BVnn0954BDowcOA== X-UI-Out-Filterresults: notjunk:1;V01:K0:AoNE1dmEMwQ=:QtryJMi7o/2+DSCOsye3Of daHyZstXHAzITv+/UPBGj9IlD3GiapvNMZIGc6dMK9p1C0BPBGuoEYQmh2A73vgFZHRmofVRa 9cUMruHZTxFolKmFgFZGYdmEhR6BxjGDzw4KuEaiTqZyVcp1Xd4wZAiy0cRdTJZvl/Z+SgC6e Mut/ti3+jMV9HDu5ubROHrPUxcHYG6ZvffzzncBxmYBHHcsuqU16OITyR3kpxwAP18UxJU7Tr bBjAcY1cnGCsZtxGaYzswIqy+/G58xnnHX52iHlsqd3XtzV7WmBEXAk5ygiTigU/NYTHp0LG2 MuF7DuEdEdHKXm1iphuhUJxdCIyxOfBx27TNjIx6ueB/9il/UZvAvXpNLVDaTsYYi3WnMF/B6 P98jdbBM7mOkPoY0j1FvVSXW/FrQSPA4yhHsPrTOmLDvh1uDokLPu+DF5QxLrD69wUzq3k0iH Ct7jFaEcFxYdwYjndoH320sU7LKjiJLeW7i8fY2rYgwha3i0S13GEUJ+dpEKzwJjQgokCCiu8 818qw8r7hPWNeynf12stdJcRSqNYoVPBfrKmYaYMOIhLfjlD6VF2DY5lP3wIDgAFhCaomRsG9 hldXfLz9RDNhlXrH8Qt9gBRe06x+mXJJzRymOtLGf50CqVVg9nlBwmGRYNY2Qigu2DLAeNf59 UuKLBUK/s0bTjiuMI/o5OTbN9KC0WZox+UQBqvKPPUPLYtb/wJkNLMHJlgwmwH7gpVUMsJe/Z VUvoJI2gRoT0xwBIvr6gQkqrA4fyQ71gaNQ1kUig+Ba9dRiNx9XdfBN6ZXwuAGLNawuO8DcYG q3mwWvMC/HC6w6qrzbrlYrzppiPrrad8ZiWbLsYfS/Vg/kPsAQ= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mm, wants a build bandaid for !CONFIG_LOCKDEP kernel/cpu.c: In function ‘_cpu_down’: kernel/cpu.c:720:43: error: ‘cpuhp_state_down_key’ undeclared (first use in this function) lockdep_init_map(&cpuhp_state_lock_map, "cpuhp_state-down", ^ kernel/cpu.c:720:43: note: each undeclared identifier is reported only once for each function it appears in kernel/cpu.c: In function ‘_cpu_up’: kernel/cpu.c:836:41: error: ‘cpuhp_state_up_key’ undeclared (first use in this function) lockdep_init_map(&cpuhp_state_lock_map, "cpuhp_state-up", ^ scripts/Makefile.build:311: recipe for target 'kernel/cpu.o' failed make[1]: *** [kernel/cpu.o] Error 1 Makefile:1666: recipe for target 'kernel/cpu.o' failed make: *** [kernel/cpu.o] Error 2 (mine below, fold or vaporize as you see fit) --- kernel/cpu.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -545,7 +545,7 @@ void __init cpuhp_threads_init(void) * Must be macro to ensure we have two different call sites. */ #ifdef CONFIG_LOCKDEP -#define lockdep_reinit_st_done() \ +#define lockdep_reinit_st_done(up) \ do { \ int __cpu; \ for_each_possible_cpu(__cpu) { \ @@ -553,9 +553,17 @@ do { \ per_cpu_ptr(&cpuhp_state, __cpu); \ init_completion(&st->done); \ } \ + if (up) \ + lockdep_init_map(&cpuhp_state_lock_map, \ + "cpuhp_state-up", \ + &cpuhp_state_up_key, 0); \ + else \ + lockdep_init_map(&cpuhp_state_lock_map, \ + "cpuhp_state-down", \ + &cpuhp_state_down_key, 0); \ } while(0) #else -#define lockdep_reinit_st_done() +#define lockdep_reinit_st_done(up) #endif #ifdef CONFIG_HOTPLUG_CPU @@ -716,9 +724,7 @@ static int __ref _cpu_down(unsigned int cpus_write_lock(); - lockdep_reinit_st_done(); - lockdep_init_map(&cpuhp_state_lock_map, "cpuhp_state-down", - &cpuhp_state_down_key, 0); + lockdep_reinit_st_done(0); cpuhp_tasks_frozen = tasks_frozen; @@ -832,9 +838,7 @@ static int _cpu_up(unsigned int cpu, int cpus_write_lock(); - lockdep_reinit_st_done(); - lockdep_init_map(&cpuhp_state_lock_map, "cpuhp_state-up", - &cpuhp_state_up_key, 0); + lockdep_reinit_st_done(1); if (!cpu_present(cpu)) { ret = -EINVAL;