From patchwork Fri Nov 4 05:41:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 15354 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp190866wru; Thu, 3 Nov 2022 22:51:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66rm7KSifx3nRCzINamCo/6EOnp4N54JsgXKe2qwUGHyJFtbbQc0te/V6F/n+MJJ8QMV7+ X-Received: by 2002:aa7:cd58:0:b0:462:d797:483d with SMTP id v24-20020aa7cd58000000b00462d797483dmr34944487edw.343.1667541078695; Thu, 03 Nov 2022 22:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667541078; cv=none; d=google.com; s=arc-20160816; b=0Xg9tJBKc0lOafN4AonikHhD9Z6Gp/T60FQvo87BjuFw9aOQ1QYDt8cMcgY80xcxDR /x8nDE156oDjZRpiksAVeDRss+Rj3SpAqVn5huzNKRfTnNqs788F5nOkv2hcXbMKAExZ OVQ87EizLwBU1e1rfUkssb2ovttmLv+pKWNDOJumIQdpcIg/N1bW+5qJFZv40OgjJ4Uh ZSjvYvEirTpgiV3LD/9wXPbHeYRkdwnquKONtmtKzsW4eOFIwVMx6mS3RxsVQDgv29hF RHD05/9XLF8ZLfSB8dfYhvy/kR8fRY0ry0182v1K6S6o9Bf48tygVLJINteCI6BCh/ZU APZA== 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=7FF/7gqum1sylk7zjtlFwspsf+k0SUgkVGxKZEamAKo=; b=fJFwCkuVLarjtt5spZMJNG/tEbL0KnXh6Uax/Znr1JluHpTOUFM6aeBAS9AZD1JiN7 p6xXPMesExnW8VQNIiXfhfwIouXJ9DvX6bZ+3YS4Xt6jrWR7bDmrdxgNKg1aZQ8qU+lB KbtpxVp5J/KqUAunu7K8R40LluA+ewJyYIBIbgBCP8vCuzLWBYeEGwrn2nTaudZCI3gx SHLFmZaZwrijx4vyHSXCwy/ygVtpFTPtlwdU2WdLccYtaedGmohl6dDLwcaNrqu0FdM0 r5/SbYte2h8SEy69MRxb16Yh9xej5K1WGdkrmn/9LRRMb/zp+F8Iem0iOsgG3rc6Z+cX Zvaw== 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 qb33-20020a1709077ea100b0078dc3cb8b48si4255087ejc.625.2022.11.03.22.50.55; Thu, 03 Nov 2022 22:51:18 -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 S231731AbiKDFuK (ORCPT + 99 others); Fri, 4 Nov 2022 01:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231379AbiKDFsy (ORCPT ); Fri, 4 Nov 2022 01:48:54 -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 7850228E0D; Thu, 3 Nov 2022 22:48:53 -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 E568C620E6; Fri, 4 Nov 2022 05:48:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60E1BC433C1; Fri, 4 Nov 2022 05:48:51 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oqpZt-0071Fq-2u; Fri, 04 Nov 2022 01:49:17 -0400 Message-ID: <20221104054917.730504253@goodmis.org> User-Agent: quilt/0.66 Date: Fri, 04 Nov 2022 01:41:25 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Thomas Gleixner , Stephen Boyd , Guenter Roeck , Anna-Maria Gleixner , Andrew Morton , Tony Luck , Borislav Petkov , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-edac@vger.kernel.org Subject: [RFC][PATCH v3 32/33] timers: x86/mce: Use __init_timer() for resetting timers References: <20221104054053.431922658@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?1748543554158030819?= X-GMAIL-MSGID: =?utf-8?q?1748543554158030819?= From: "Steven Rostedt (Google)" DEBUG_OBJECTS_TIMERS is now checking if a timer is ever enqueued, and if so, it must call timer_shutdown_sync() 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); }