Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1669565pxb; Wed, 9 Feb 2022 01:44:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwywzUaGZFuhY6pSdMyqIvjUiiDUPC0UMNzQsGQN7l1hNGXUNFIkiyLB5TtxlT/PTQ3cd0J X-Received: by 2002:a17:902:da84:: with SMTP id j4mr1287042plx.108.1644399865023; Wed, 09 Feb 2022 01:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644399865; cv=none; d=google.com; s=arc-20160816; b=CvLeaSE22GTuIwNteNtJv9vLNTl7tyQeROH5cmB1OfqkeSKERoi+MPanLdyb3HmrV7 cTkjFVX1sx4avQGhTH7ZwJs/7JHnjqnMEYDv6XfGimyZBZff28+RnemgLnrm7oU6NcMp i0zO1sTYesUeKGAvswSUOYUS5UynwW6dp3hnjn+ItLyFZdiewZ51UmQMJoRu88piTzcJ MXgTGbIL3nvYMtO0I/WNA9b4D4M76BlsnwCHXxMw6r758/EUX2nTwnc/W2iC7CP8mRmQ 6163XKaflJetyhY43DE/8oZcdLwkEZrmPKlQleXOnsZogU6DUcmfeR0m6LQ9BKNlHvEo 073Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=IzYAh6mtxyAZ2drjtva0WxDIoe1TxiIdW6u31Cu1VZ0=; b=ZwI1+wwtKkEVFTtTwoEM6VSHgC7tenliqNwJ1ZTIy9u2VG2v8uOKlAuXngDRQM6u5J wpi2Ada2yRc71xGfAp7D+GWqfS7PbwbtbMNuFth7DZAYAqErXvaqq8nN6lu3NNongD0/ R1MwQgomFd4jGZYSt0TTsXIDV6xC1iJIOw6EQMNpZjju8ty35n6yzP/IljXvmK+xJZa6 Nr8CA0GoSF1dhS/ssKxaMooAFAKKXxDZhV7uUnc7koHt5RndFAvW7zKeuBKDjD3W5uCD UQeYQwTha6roF2QXfY51g89plIGqXp4lUKjryH/fDsx+k+QNqaB9MFUhG7nW5wUxIyeg fVJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Rn7TMd/F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id lw11si5183730pjb.59.2022.02.09.01.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:44:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Rn7TMd/F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AC39CE071F60; Wed, 9 Feb 2022 01:06:16 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385182AbiBHSm2 (ORCPT + 99 others); Tue, 8 Feb 2022 13:42:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356333AbiBHSmW (ORCPT ); Tue, 8 Feb 2022 13:42:22 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8287C0612AA for ; Tue, 8 Feb 2022 10:42:19 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id t9so81124plg.13 for ; Tue, 08 Feb 2022 10:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IzYAh6mtxyAZ2drjtva0WxDIoe1TxiIdW6u31Cu1VZ0=; b=Rn7TMd/F12tHX5PTTIfciknUnwo2d7sRReHQLBHclrIbs4kzH1kmWQfBKSijxIYqNK 9CmfuIRHZSF3joepIGkZW8ahirN3q1TzibCOEBECrLRobrWRJI8tCZ5W1dzfI8wylYQE d0flpx4A9y3tzSBvR49MoHK7mbPF4EtMP1QAUBDtdVigkbhe7d+V89KqIWBctTMKY8Sk kp8OlmWqElx4SkCpRznucWmMQMjaE+vZwDax5fDsxrwCovsgwA3z/0krvCKpIvUtWUcD twN6kX5t0DC0Kw8WJFwWG3HrDuXRy0m69JjLJB0SQNsZ4m9+ZClz0rLcsfIY+JxmS+EM 4KTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=IzYAh6mtxyAZ2drjtva0WxDIoe1TxiIdW6u31Cu1VZ0=; b=ePluCcSFRbfZjbXAgfo9oQ1i4SNEq2ROSh4YZttYrdMm1tPR+KKqq1UTgb3Zs+1wXU vy6SEiN5dIH82vm8pIKvOyH73MUk/3J/R0jFgYolQrdEoge2pmoZj4/wAev6DIoYEDKK Q7GPv95sUgJCQj4HsWLx0+iTkEKWKbVoviVxYDtvjxHDK2BV4FEoJckmCrn9mhi3NjHs qDt+urYBZim7BoXrlxC16EoEqyJ1u1nR12dYFrdQgkHDLv7uCl9ym7jx5cluL3SUQPmj tuV1gg2TURLfpf/IjPGNkZIpvL390tepxm7g9vCZQ4EG/ntlAExAiOkMjHDLHn/To+z1 bv6Q== X-Gm-Message-State: AOAM533vLexharKkhnATUI32EX0ObMK4vbA4szPR4P9pVJYh8VmDtjgv 6vkCU2xcPs0X1s7qtjBXiXCc7t5TySU= X-Received: by 2002:a17:902:e801:: with SMTP id u1mr5662822plg.124.1644345739249; Tue, 08 Feb 2022 10:42:19 -0800 (PST) Received: from balhae.hsd1.ca.comcast.net ([2601:647:4800:c6f0:347f:e607:176:4358]) by smtp.gmail.com with ESMTPSA id l14sm3517027pjf.1.2022.02.08.10.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 10:42:18 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng Cc: LKML , Thomas Gleixner , Steven Rostedt , Byungchul Park , "Paul E. McKenney" , Mathieu Desnoyers , Radoslaw Burny Subject: [PATCH 03/12] timer: Protect lockdep functions with #ifdef Date: Tue, 8 Feb 2022 10:41:59 -0800 Message-Id: <20220208184208.79303-4-namhyung@kernel.org> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog In-Reply-To: <20220208184208.79303-1-namhyung@kernel.org> References: <20220208184208.79303-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With upcoming lock tracepoints config, it'd define some of lockdep functions without enabling CONFIG_LOCKDEP actually. The existing code assumes those functions will be removed by the preprocessor but it's not the case anymore. Let's protect the code with #ifdef's explicitly. Cc: Thomas Gleixner Signed-off-by: Namhyung Kim --- kernel/time/timer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 85f1021ad459..4af95dbf6435 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -794,7 +794,10 @@ static void do_init_timer(struct timer_list *timer, if (WARN_ON_ONCE(flags & ~TIMER_INIT_FLAGS)) flags &= TIMER_INIT_FLAGS; timer->flags = flags | raw_smp_processor_id(); + +#ifdef CONFIG_LOCKDEP lockdep_init_map(&timer->lockdep_map, name, key, 0); +#endif } /** @@ -1409,19 +1412,22 @@ static void call_timer_fn(struct timer_list *timer, struct lockdep_map lockdep_map; lockdep_copy_map(&lockdep_map, &timer->lockdep_map); -#endif + /* * Couple the lock chain with the lock chain at * del_timer_sync() by acquiring the lock_map around the fn() * call here and in del_timer_sync(). */ lock_map_acquire(&lockdep_map); +#endif trace_timer_expire_entry(timer, baseclk); fn(timer); trace_timer_expire_exit(timer); +#ifdef CONFIG_LOCKDEP lock_map_release(&lockdep_map); +#endif if (count != preempt_count()) { WARN_ONCE(1, "timer: %pS preempt leak: %08x -> %08x\n", -- 2.35.0.263.gb82422642f-goog