From patchwork Wed Oct 4 23:27:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9985879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 76BAD602B8 for ; Wed, 4 Oct 2017 23:28:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 687D828BF1 for ; Wed, 4 Oct 2017 23:28:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C42828C12; Wed, 4 Oct 2017 23:28:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF86C28BF1 for ; Wed, 4 Oct 2017 23:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751412AbdJDX2S (ORCPT ); Wed, 4 Oct 2017 19:28:18 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:52371 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751398AbdJDX2C (ORCPT ); Wed, 4 Oct 2017 19:28:02 -0400 Received: by mail-pf0-f178.google.com with SMTP id a1so3809427pfj.9 for ; Wed, 04 Oct 2017 16:28:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=I87dJl/I2CuR5hFEIcIA0dZ+C9wt1pFM8YrtELgvp7E=; b=Lz4Kj0bn6fA8Gnx39z/iaY/RqEIFmF+0pXFWCnulGykv9GQGNa1FQlYYjQSBT+d6Aq NCjFaUyhQzizgu9Ax5pkyK8psDiOgf4E3rTLAmQbCuCZMEV4OwOre20UZALVVBi2v8SZ AWkwP8evIHa/jh10xvTx5CrjZIGYPYiiQ7VL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=I87dJl/I2CuR5hFEIcIA0dZ+C9wt1pFM8YrtELgvp7E=; b=I7G+pH8oVbs/1OImaDvSiaU27tbaqIEmAjQNzKJ9v6l/smadNcXUyuwtHaznRt0a/p t5XReeCtwVSw5hDsaLljGbYZVlzrA9dJ21MaeocnUtfvk2RanloSoj8VkTUIih8rRbjn c+xgLjptv+BBQ58mfBd8GYoMlibNn9qdUkKV/aDatqQUk0d7uMF+ItcOUDw3wJ1N80RO zya3OkSbh2z+G4TZKp4UiM4MR15i7rFGYvfHdU2VzWy9ynF6jh/HI4GHAoUKBmQRckIT UIYLkCZSejbAHuwW8E/v26jW2dZA7E/dtVzyCupfQhcPuvS/hYdn1ireY4KMX0uMf1Tk ZhqA== X-Gm-Message-State: AMCzsaUMetKHKljpKvmUsjWPwFHyg4Cn8S2D5GSj2sSCQiYMTCoO0t49 yKRkuEEy18neOOOm/5p0dndADg== X-Google-Smtp-Source: AOwi7QA4pvomanxlvBbXMkk+lPMTawSsP0EjioBMJr/evCGGraGx7IGak48dutEZKbtQmHc/Lv75uA== X-Received: by 10.98.74.23 with SMTP id x23mr2645228pfa.205.1507159681226; Wed, 04 Oct 2017 16:28:01 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id w188sm26979903pfb.67.2017.10.04.16.27.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 16:27:57 -0700 (PDT) From: Kees Cook To: Thomas Gleixner Cc: Kees Cook , Martin Schwidefsky , Heiko Carstens , Tejun Heo , Lai Jiangshan , linux-s390@vger.kernel.org, Andrew Morton , Arnd Bergmann , Benjamin Herrenschmidt , Chris Metcalf , Geert Uytterhoeven , Greg Kroah-Hartman , Guenter Roeck , Harish Patil , "James E.J. Bottomley" , John Stultz , Julian Wiedmann , Kalle Valo , Len Brown , Manish Chopra , Mark Gross , "Martin K. Petersen" , Michael Ellerman , Michael Reed , netdev@vger.kernel.org, Oleg Nesterov , Paul Mackerras , Pavel Machek , Petr Mladek , "Rafael J. Wysocki" , Ralf Baechle , Sebastian Reichel , Stefan Richter , Stephen Boyd , Sudip Mukherjee , Ursula Braun , Viresh Kumar , Wim Van Sebroeck , linux1394-devel@lists.sourceforge.net, linux-mips@linux-mips.org, linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-scsi@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/13] timer: Remove users of TIMER_DEFERRED_INITIALIZER Date: Wed, 4 Oct 2017 16:27:00 -0700 Message-Id: <1507159627-127660-7-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507159627-127660-1-git-send-email-keescook@chromium.org> References: <1507159627-127660-1-git-send-email-keescook@chromium.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This removes uses of TIMER_DEFERRED_INITIALIZER and chooses a location to call timer_setup() from before add_timer() or mod_timer() is called. Adjusts callbacks to use from_timer() as needed. Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: Tejun Heo Cc: Lai Jiangshan Cc: linux-s390@vger.kernel.org Signed-off-by: Kees Cook --- arch/s390/kernel/lgr.c | 6 +++--- arch/s390/kernel/topology.c | 6 +++--- kernel/workqueue.c | 8 +++----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c index ae7dff110054..bf9622f0e6b1 100644 --- a/arch/s390/kernel/lgr.c +++ b/arch/s390/kernel/lgr.c @@ -153,14 +153,13 @@ static void lgr_timer_set(void); /* * LGR timer callback */ -static void lgr_timer_fn(unsigned long ignored) +static void lgr_timer_fn(struct timer_list *unused) { lgr_info_log(); lgr_timer_set(); } -static struct timer_list lgr_timer = - TIMER_DEFERRED_INITIALIZER(lgr_timer_fn, 0, 0); +static struct timer_list lgr_timer; /* * Setup next LGR timer @@ -181,6 +180,7 @@ static int __init lgr_init(void) debug_register_view(lgr_dbf, &debug_hex_ascii_view); lgr_info_get(&lgr_info_last); debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last)); + timer_setup(&lgr_timer, lgr_timer_fn, TIMER_DEFERRABLE); lgr_timer_set(); return 0; } diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index ed0bdd220e1a..d7ece9888c29 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c @@ -320,15 +320,14 @@ static void topology_flush_work(void) flush_work(&topology_work); } -static void topology_timer_fn(unsigned long ignored) +static void topology_timer_fn(struct timer_list *unused) { if (ptf(PTF_CHECK)) topology_schedule_update(); set_topology_timer(); } -static struct timer_list topology_timer = - TIMER_DEFERRED_INITIALIZER(topology_timer_fn, 0, 0); +static struct timer_list topology_timer; static atomic_t topology_poll = ATOMIC_INIT(0); @@ -597,6 +596,7 @@ static struct ctl_table topology_dir_table[] = { static int __init topology_init(void) { + timer_setup(&topology_timer, topology_timer_fn, TIMER_DEFERRABLE); if (MACHINE_HAS_TOPOLOGY) set_topology_timer(); else diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 64d0edf428f8..a5361fc6215d 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5390,11 +5390,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq) { } */ #ifdef CONFIG_WQ_WATCHDOG -static void wq_watchdog_timer_fn(unsigned long data); - static unsigned long wq_watchdog_thresh = 30; -static struct timer_list wq_watchdog_timer = - TIMER_DEFERRED_INITIALIZER(wq_watchdog_timer_fn, 0, 0); +static struct timer_list wq_watchdog_timer; static unsigned long wq_watchdog_touched = INITIAL_JIFFIES; static DEFINE_PER_CPU(unsigned long, wq_watchdog_touched_cpu) = INITIAL_JIFFIES; @@ -5408,7 +5405,7 @@ static void wq_watchdog_reset_touched(void) per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies; } -static void wq_watchdog_timer_fn(unsigned long data) +static void wq_watchdog_timer_fn(struct timer_list *unused) { unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ; bool lockup_detected = false; @@ -5510,6 +5507,7 @@ module_param_cb(watchdog_thresh, &wq_watchdog_thresh_ops, &wq_watchdog_thresh, static void wq_watchdog_init(void) { + timer_setup(&wq_watchdog_timer, wq_watchdog_timer_fn, TIMER_DEFERRABLE); wq_watchdog_set_thresh(wq_watchdog_thresh); }