From patchwork Thu Oct 27 15:05:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 11847 Return-Path: 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 + 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 ); 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 ) 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 To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Thomas Gleixner , Stephen Boyd , Guenter Roeck , Tony Luck , Borislav Petkov , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , 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 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: 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?= From: "Steven Rostedt (Google)" 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 Cc: Borislav Petkov Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Dave Hansen Cc: x86@kernel.org Cc: "H. Peter Anvin" Cc: linux-edac@vger.kernel.org Signed-off-by: Steven Rostedt (Google) --- 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); }