From patchwork Mon Dec 28 12:49:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 352643 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp9748615jai; Mon, 28 Dec 2020 05:31:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJy06BobqBzQEE7RnKh+eugt8xhXAm2mKUSyyrqz1NAToEQs9Py+zPi9ngODrVBVD13YT/y6 X-Received: by 2002:aa7:c3c2:: with SMTP id l2mr41461223edr.15.1609162302889; Mon, 28 Dec 2020 05:31:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609162302; cv=none; d=google.com; s=arc-20160816; b=n+D5lPY5d69yFO8sN7jxe5Mg3dGeuN+cmMFxKEx+D9J7+8F2CwQvB9rrznd7UJRGmi LuhNLixzIfC/sbpSMpRB5PsORCPJkSS8zyHX5TD2hBnCaHjWSV16jROf2LxZxN7gDOBe FjKZ3QTBiFmyjcL8uFcQ05mNuqY8+hSHXbbTr8HV3oe+KJd8sOkPuKbjfkZ6yzJHIKW7 RZbZy0vfpESbhEdoKYyACMAKUeNfY8SZxX64GVnRXIkK2m8IpsmxzqLnSMD9paCLNLPE 90YbPBTfTBNorQLXCXtIxfKR0V7PEBHz0pWl8EJZ4gueDxTcPVzs64+Ppf3O70AS0wcr 9ExA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8leudDzkmP9dygQ2J+kYpDuJy6sWUqkxO7gbz8h4kOw=; b=z1OuyhqRORSICktilQqE4S6hJ3CiAX2IMO3DCz5QlubGHMkdg4lK/RLmi1WvIC5PJV LkqO9o01gYCI9M1teJwE7A/4/DacFnh/6UD2Yoa1zVd1/8yAPoSdYPvWQby0Etv/zpQd 04qg6UnQSgJZxvU5StqTv9nE3Oys4WyiwtqfE+QOeBgTVReQxJv29SbkDZiGYlQdM7UW cMXC+cU+IHfJsefBOGNrMmMFPX0oUGXuDuYh3J0W0Mci0x0ypiEd+rkRDIhOnDFF5Fle aK2W183+O3HPSpiiV+ouURxBzA8upv1fcD8Az/zRCyB9Rk2EBZOQpMAXOjbvRp8cUn5Y ZtTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xhaU0hZQ; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si5417620edd.351.2020.12.28.05.31.42; Mon, 28 Dec 2020 05:31:42 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xhaU0hZQ; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390906AbgL1Nbk (ORCPT + 14 others); Mon, 28 Dec 2020 08:31:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:59282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390700AbgL1NbR (ORCPT ); Mon, 28 Dec 2020 08:31:17 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8C826207FF; Mon, 28 Dec 2020 13:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609162261; bh=QSGODTnlgU389f9orKrL1mY5vD+RHSlY6cCUFj3NOCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xhaU0hZQiy7BB1APthuqlbuWu0ZmjWOAELq2H/FpAhXignrHgwrjZ83EtLhhB2EHx fYk6YQTwnYkq7wv1Rl8oWeRDqRWz6VTgt9sXCsZTL5palCZ1Aoll0eHU9vmBaiibC+ ST/1bwkkCt8jG2axsgTgsFP6HB1dDhGOXV+P1nZA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 4.19 242/346] watchdog: qcom: Avoid context switch in restart handler Date: Mon, 28 Dec 2020 13:49:21 +0100 Message-Id: <20201228124931.469051386@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124919.745526410@linuxfoundation.org> References: <20201228124919.745526410@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Manivannan Sadhasivam [ Upstream commit 7948fab26bcc468aa2a76462f441291b5fb0d5c7 ] The use of msleep() in the restart handler will cause scheduler to induce a context switch which is not desirable. This generates below warning on SDX55 when WDT is the only available restart source: [ 39.800188] reboot: Restarting system [ 39.804115] ------------[ cut here ]------------ [ 39.807855] WARNING: CPU: 0 PID: 678 at kernel/rcu/tree_plugin.h:297 rcu_note_context_switch+0x190/0x764 [ 39.812538] Modules linked in: [ 39.821954] CPU: 0 PID: 678 Comm: reboot Not tainted 5.10.0-rc1-00063-g33a9990d1d66-dirty #47 [ 39.824854] Hardware name: Generic DT based system [ 39.833470] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 39.838154] [] (show_stack) from [] (dump_stack+0x8c/0xa0) [ 39.846049] [] (dump_stack) from [] (__warn+0xd8/0xf0) [ 39.853058] [] (__warn) from [] (warn_slowpath_fmt+0x64/0xc8) [ 39.859925] [] (warn_slowpath_fmt) from [] (rcu_note_context_switch+0x190/0x764) [ 39.867503] [] (rcu_note_context_switch) from [] (__schedule+0x84/0x640) [ 39.876685] [] (__schedule) from [] (schedule+0x58/0x10c) [ 39.885095] [] (schedule) from [] (schedule_timeout+0x1e8/0x3d4) [ 39.892135] [] (schedule_timeout) from [] (msleep+0x2c/0x38) [ 39.899947] [] (msleep) from [] (qcom_wdt_restart+0xc4/0xcc) [ 39.907319] [] (qcom_wdt_restart) from [] (watchdog_restart_notifier+0x18/0x28) [ 39.914715] [] (watchdog_restart_notifier) from [] (atomic_notifier_call_chain+0x60/0x84) [ 39.923487] [] (atomic_notifier_call_chain) from [] (machine_restart+0x78/0x7c) [ 39.933551] [] (machine_restart) from [] (__do_sys_reboot+0xdc/0x1e0) [ 39.942397] [] (__do_sys_reboot) from [] (ret_fast_syscall+0x0/0x54) [ 39.950721] Exception stack(0xc3e0bfa8 to 0xc3e0bff0) [ 39.958855] bfa0: 0001221c bed2fe24 fee1dead 28121969 01234567 00000000 [ 39.963832] bfc0: 0001221c bed2fe24 00000003 00000058 000225e0 00000000 00000000 00000000 [ 39.971985] bfe0: b6e62560 bed2fc84 00010fd8 b6e62580 [ 39.980124] ---[ end trace 3f578288bad866e4 ]--- Hence, replace msleep() with mdelay() to fix this issue. Fixes: 05e487d905ab ("watchdog: qcom: register a restart notifier") Signed-off-by: Manivannan Sadhasivam Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20201207060005.21293-1-manivannan.sadhasivam@linaro.org Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/qcom-wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.27.0 diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c index 780971318810d..1a0005a8fadb2 100644 --- a/drivers/watchdog/qcom-wdt.c +++ b/drivers/watchdog/qcom-wdt.c @@ -121,7 +121,7 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action, */ wmb(); - msleep(150); + mdelay(150); return 0; }