Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp3850463rwb; Sun, 7 Aug 2022 08:40:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR5x8ER2z/z5aXZWRTgK3Tg1rL3qALy5U6ZVD+B+e3LTi1vuJ54Tj5wn+4k1Q7ruMYoya+0r X-Received: by 2002:a65:6c05:0:b0:41a:d13f:f0fb with SMTP id y5-20020a656c05000000b0041ad13ff0fbmr12731683pgu.393.1659886848813; Sun, 07 Aug 2022 08:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659886848; cv=none; d=google.com; s=arc-20160816; b=B9911v43/bgkUyl4wcnqlRBf1rpF2XPxAXJeTy5nmlQDuKdar1SmE2Kc7ExxiRdU6c QbP0kLs19qmoPLE+5/6XcrJq3ODOiEyhBHYtdbIPPZ4YU9aKgLzncWE8nYnD5AofYZzJ 6YL7daxNvLuXWenGxDj2GOgYqtEterKjAYGjkJ5CRE45jNRi7jwlqsMTBKOguw+idSt6 tWogjNrj8I2Vw98kWKrGZNw7DK4zof3kWGWVLbDwY9S8wtGI3P/Tt3U6ehvjgYJ5+ACN sf8HJQQODTKkMEEahge36zxvSfJqDyvY9hwuHCLmtU7IFydVsfHR7kUbF8SIoFxz9iQT NZgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:message-id:date:subject:cc:from :dkim-signature; bh=zyNvPVLyDDezqApjjesRSa+r/dJCUOj2kajhngA3cEY=; b=iqINYSfZbylBFkcqSNKJMylulsx2n7LucfBZQPAUM2csAeKkJsByZgP+bWxaqepEuj 2iXPqqTuseVAb3kPPKvLME5kzKlRn0AVGChNghQOXBcJ8D/8RRnDi/SQ04W2QcMa5wWV BKsvpfHQOsoEvFv1mS/V1rxjbv4S8iDQuC1xKs6xidN8UwfcoKC3mGEdzeB9HhM0HXOF Snl436pp9M/VLsbtu45iTPrZ/n3Qiujbw24Q2xuNnVY9EsOUjtek8bNH+acmigUMLeGf 67kwfTcODHxb3s9rOHhJ2AvqrJCX8pXjB1TXfXpzpo/PMd7BaKOBLIeiL3evIPp1oBZC wrZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=U1bLegys; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x142-20020a633194000000b0041bfb247bbdsi938664pgx.259.2022.08.07.08.40.35; Sun, 07 Aug 2022 08:40:48 -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; dkim=fail header.i=@gmail.com header.s=20210112 header.b=U1bLegys; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234743AbiHGPT2 (ORCPT + 99 others); Sun, 7 Aug 2022 11:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbiHGPT0 (ORCPT ); Sun, 7 Aug 2022 11:19:26 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3F816330 for ; Sun, 7 Aug 2022 08:19:25 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id pm17so6725304pjb.3 for ; Sun, 07 Aug 2022 08:19:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:subject:cc:to:from:from:to:cc; bh=zyNvPVLyDDezqApjjesRSa+r/dJCUOj2kajhngA3cEY=; b=U1bLegysO3V+UCL2Q54RveB3Zmszqfc0p7d8TnVIoFVUi56Vpez2mRTa+v2j+P5y3u FDZpSlP3cwxlPCGK69D0zHt6FXMbXB1PQp15Df8Uy4GhQcv60ccRun3Bp37q7O88QV+O 3MxWO2/INsFhAMJe4D8xLEKIOzhZAmAR0mw4ytUgrYosb8RVbtKvE0e/DF1J2ssMvIwf 40V2n4VkFTNKNdrCZvykHqZYbQtNBGJQhT4cZTTp9lWLV2doNl0ICHk7qtrEClPnZBHu QiTFR9WdpGOuF48Heck1Wa+tbhR3oRHPMxZcsachgwtZrW6s+zprqb415HNH9Rs4tXgN RrrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=zyNvPVLyDDezqApjjesRSa+r/dJCUOj2kajhngA3cEY=; b=o4OkWl7K1edzKIcekukO45TOeyYVa1FPRG4CaLMD1YjctatcoBDyQ/VjjyAEuz3W5z OSktUljtHHhtt+HqzMf+kO3JBopgL/oTOdg0lXXbJcy5qLHNtXLBFkv/uVbkrF/hhYx4 87EvW++W7FeRk0W3gBLbv2hDEmut2+I5fc4TZcXjlGS6jRi9r8FH3dT8UMB6xKEUaevW bNUZ6m783mMmiQbfjXPJLAQ54fXw20ebCcs14hn118+dB/86Bo85CEAf/3okhU5vE9Ol gKfHfs0RHeKEwr0I6eeLdfbzaFeElB7VVdrn98RNNb1igollPTJq0NRrOJyZuu1O0H4P lHOQ== X-Gm-Message-State: ACgBeo0oNoeopWSJBbdUitk+txfzd9R4CNcu21B5viLmr+vV8bz0zAZj MAEvg2NJ0H+elzMafe/iHA0= X-Received: by 2002:a17:903:2015:b0:16e:db59:f65d with SMTP id s21-20020a170903201500b0016edb59f65dmr15152394pla.106.1659885565459; Sun, 07 Aug 2022 08:19:25 -0700 (PDT) Received: from localhost.localdomain ([113.88.93.147]) by smtp.gmail.com with ESMTPSA id t188-20020a6281c5000000b0052acb753b8bsm6692577pfd.158.2022.08.07.08.19.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Aug 2022 08:19:24 -0700 (PDT) From: Puyou Lu Cc: Puyou Lu , Petr Mladek , Andrew Morton , Luis Chamberlain , Juri Lelli , Xiaoming Ni , Rasmus Villemoes , Frederic Weisbecker , Laurent Dufour , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] watchdog: don't enable watchdog if user disabled it Date: Sun, 7 Aug 2022 23:18:44 +0800 Message-Id: <20220807151845.18597-1-puyou.lu@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Take a check of watchdog_enabled before reconfigure/enable watchdog. Signed-off-by: Puyou Lu --- kernel/watchdog.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index bed1fe7ecaea..791765c9bece 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -454,6 +454,9 @@ static void watchdog_enable(unsigned int cpu) WARN_ON_ONCE(cpu != smp_processor_id()); + if (!watchdog_enabled) + return; + init_completion(done); complete(done); @@ -546,6 +549,10 @@ static void __lockup_detector_reconfigure(void) set_sample_period(); lockup_detector_update_enable(); + + if (!watchdog_enabled) + return; + if (watchdog_enabled & SOFT_WATCHDOG_ENABLED) softlockup_start_all(); @@ -591,6 +598,10 @@ static void __lockup_detector_reconfigure(void) cpus_read_lock(); watchdog_nmi_stop(); lockup_detector_update_enable(); + + if (!watchdog_enabled) + return; + watchdog_nmi_start(); cpus_read_unlock(); } -- 2.17.1