Message ID | 20221027150930.891623466@goodmis.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp292732wru; Thu, 27 Oct 2022 08:21:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53/KQ6Z1icJGHhZDDkZbPNvltrx1K9hfoDuHnXfZaNglTbo9k5qePRMsel2nXBNqMfdf7h X-Received: by 2002:aa7:c6c8:0:b0:460:e19b:ec12 with SMTP id b8-20020aa7c6c8000000b00460e19bec12mr35584105eds.209.1666884113643; Thu, 27 Oct 2022 08:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666884113; cv=none; d=google.com; s=arc-20160816; b=Cy9aiaSYEOLqbIawnDjo/BE9QFG4Kqi4a5OQVtm5n2rK//3WXSJu85Z8UynWZRSkrd qq/uwOQ7KZ30cR0bAizHM4ryBxEWofcZ7JQeGm+pnPk7KV/nCyu8f5cPBaaeaV4IpB97 46erFagKja2GsLpP1NHHw3zcPF9fpIYU9JFjRSaW7cqM4IfD0h5KnvFoo9fs+5uF1fNa wrJFnivfeC5A6N9jm5Q31kydk1DUSr2wxgEe1kqMilFYLaP1dE1BokPGijo9hFjzMHnq 3wjOT6BmUpy9yT2NiPmMybp7p9/PN0coG2tg03ZBUJKC5YZFRxCVP2TNEa1HoZi2cAR9 ueYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=q7CuJ/THrQj8yd574SugeLAMwMVXAcoc8fno8C0QzY0=; b=d4+76WdnDMY0S+pYHPZRtM8mTDPLxwmtAbDX0Rtvpr8L1WEebS7N+OIqiJF1ZamuNh WOBFLmJfomDGh2hclRu6gWioOwcbuJVCJsSC62gJH99WY6CLgnCCTPNkYyt1VR+L/x7u OnsnBGL1vo7tRHCM/jD5/9LRYQmqZkjDYkM7ysnP56CPDOsD6NE5SLCV/Bew7C6tJ5YL IzuXFYDi7SATNAbrhNfywufbHU7nPHZhmmKdj83Yy1Wwiz4ivY8V1x7AnVUERkY+VtRX hl8SrID/xrJb2esa4dQVDSJkwPn7Gh0CQCRXyR72qQea0g7+5115+1ba3c6ca+0ZZGyT Bdlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a50e703000000b0045d9ceae669si1567863edn.404.2022.10.27.08.21.27; Thu, 27 Oct 2022 08:21:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235859AbiJ0PLs (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Thu, 27 Oct 2022 11:11:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236132AbiJ0PJS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 27 Oct 2022 11:09:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82C9418E73F; Thu, 27 Oct 2022 08:09:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 63A02623A7; Thu, 27 Oct 2022 15:09:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D64C0C433D6; Thu, 27 Oct 2022 15:09:15 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from <rostedt@goodmis.org>) id 1oo4Vf-00BviQ-0B; Thu, 27 Oct 2022 11:09:31 -0400 Message-ID: <20221027150930.891623466@goodmis.org> User-Agent: quilt/0.66 Date: Thu, 27 Oct 2022 11:05:55 -0400 From: Steven Rostedt <rostedt@goodmis.org> To: linux-kernel@vger.kernel.org Cc: Linus Torvalds <torvalds@linux-foundation.org>, Thomas Gleixner <tglx@linutronix.de>, Stephen Boyd <sboyd@kernel.org>, Guenter Roeck <linux@roeck-us.net>, Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@redhat.com>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>, linux-edac@vger.kernel.org Subject: [RFC][PATCH v2 30/31] timers: x86/mce: Use __init_timer() for resetting timers References: <20221027150525.753064657@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747854676580614470?= X-GMAIL-MSGID: =?utf-8?q?1747854676580614470?= |
Series |
timers: Use del_timer_shutdown() before freeing timers
|
|
Commit Message
Steven Rostedt
Oct. 27, 2022, 3:05 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org> DEBUG_OBJECTS_TIMERS is now checking if a timer is ever enqueued, and if so, it must call del_timer_shutdown() before freeing, otherwise debug objects will trigger. This requires that once a timer is initialized (and initialized for debug objects) it must not be re-initialized using timer_setup(), as that will call the debug objects initialization code again and trigger a bug if it was ever used. As the mce reinitializes its timers on CPU hotplug, it must use __init_timer() instead of timer_setup(), which will only initialize the debug objects once. Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home/ Cc: Tony Luck <tony.luck@intel.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: x86@kernel.org Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: linux-edac@vger.kernel.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> --- arch/x86/kernel/cpu/mce/core.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 2c8ec5c71712..d2653c7d40b3 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -2051,14 +2051,24 @@ static void __mcheck_cpu_setup_timer(void) { struct timer_list *t = this_cpu_ptr(&mce_timer); - timer_setup(t, mce_timer_fn, TIMER_PINNED); + /* + * timer_setup() may only be used on a timer for the + * first time it is initialized. This resets the + * timer on CPU hotplug, so use __init_timer() instead. + */ + __init_timer(t, mce_timer_fn, TIMER_PINNED); } static void __mcheck_cpu_init_timer(void) { struct timer_list *t = this_cpu_ptr(&mce_timer); - timer_setup(t, mce_timer_fn, TIMER_PINNED); + /* + * timer_setup() may only be used on a timer for the + * first time it is initialized. This resets the + * timer on CPU hotplug, so use __init_timer() instead. + */ + __init_timer(t, mce_timer_fn, TIMER_PINNED); mce_start_timer(t); }