From patchwork Tue May 26 14:58:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 218530 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42B7EC433E0 for ; Tue, 26 May 2020 14:58:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F4E92068D for ; Tue, 26 May 2020 14:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590505137; bh=UlWxHR2+JjYrbrsIo9RFWetNsJ8HeI3W97glk4AJMH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=N+rIGJ6nP/vYMu1OekXglnpzPvSet0VdM33HoLvgf+aO9qhHiIu1uk9zkpAMQg3IG gnMoPVs0KyEietztVAu0qXgZzTu78MfYLVh0klnLwAq4BHmgA2/JrdDE/hnAHNwvEJ nEEa55GUIQUrIdyDJ7FTA8saAwA29io5QRxi69lo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730056AbgEZO62 (ORCPT ); Tue, 26 May 2020 10:58:28 -0400 Received: from mail-pj1-f65.google.com ([209.85.216.65]:39115 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730005AbgEZO6X (ORCPT ); Tue, 26 May 2020 10:58:23 -0400 Received: by mail-pj1-f65.google.com with SMTP id n15so1444922pjt.4; Tue, 26 May 2020 07:58:23 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=3I2sdug0etgqRHUdoxPJvhoiBePAC70+vSrOonIbSmY=; b=gnPM68K4OMYi8H80K+LxCMjIukqQIxtfjbU4+DN/qzmtkc6B1iiWxGeBGLg8foQls+ OMty6AUbfvcGbwARJunK/BXC7fpTBwiyuemqaXK6eMBEtaYzvpxukTWsAiE4irVaGurC AwwXWgNf2jT/T3tLyg/jRS6FHPWhJ7GzTLwJRqKeSsqhZMRGkU1wy//Yr4a/OBP9z/8T uamyz2no9bGF77LL3JwNY9jVkK3PsmIhFudyXSXiPaqg4XXXrzZbX8v+rW8mliNRVQOa v4VzgH2khUpZQoxs05U8n/EEtXgCm6ma0OA6yCmAloE9ZtukaQhOQlW9ivzs61TFCsAr EWOg== X-Gm-Message-State: AOAM533GGA9HbgMJAiWcDZv8mCpSw4ce+WCINBdLElApSOMSc8+MkRfS xlpGRpK7qLhkkrGpEiyYxP59ETshl1gLig== X-Google-Smtp-Source: ABdhPJyjRrdsWMoCxqbfI7BL+YTvTkoryEu9WdlGL6BL8aPe2MsI0L6OK3sqfARxDBSdcSpYKPtcKg== X-Received: by 2002:a17:90a:7bcb:: with SMTP id d11mr26606068pjl.209.1590505101907; Tue, 26 May 2020 07:58:21 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id t2sm16362pgh.89.2020.05.26.07.58.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 07:58:19 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 9DD6C40E7B; Tue, 26 May 2020 14:58:17 +0000 (UTC) From: Luis Chamberlain To: jeyu@kernel.org, davem@davemloft.net, kuba@kernel.org Cc: michael.chan@broadcom.com, dchickles@marvell.com, sburla@marvell.com, fmanlunas@marvell.com, aelior@marvell.com, GR-everest-linux-l2@marvell.com, kvalo@codeaurora.org, johannes@sipsolutions.net, akpm@linux-foundation.org, arnd@arndb.de, rostedt@goodmis.org, mingo@redhat.com, aquini@redhat.com, cai@lca.pw, dyoung@redhat.com, bhe@redhat.com, peterz@infradead.org, tglx@linutronix.de, gpiccoli@canonical.com, pmladek@suse.com, tiwai@suse.de, schlad@suse.de, andriy.shevchenko@linux.intel.com, derosier@gmail.com, keescook@chromium.org, daniel.vetter@ffwll.ch, will@kernel.org, mchehab+samsung@kernel.org, vkoul@kernel.org, mchehab+huawei@kernel.org, robh@kernel.org, mhiramat@kernel.org, sfr@canb.auug.org.au, linux@dominikbrodowski.net, glider@google.com, paulmck@kernel.org, elver@google.com, bauerman@linux.ibm.com, yamada.masahiro@socionext.com, samitolvanen@google.com, yzaikin@google.com, dvyukov@google.com, rdunlap@infradead.org, corbet@lwn.net, dianders@chromium.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Luis Chamberlain Subject: [PATCH v3 1/8] kernel.h: move taint and system state flags to uapi Date: Tue, 26 May 2020 14:58:08 +0000 Message-Id: <20200526145815.6415-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200526145815.6415-1-mcgrof@kernel.org> References: <20200526145815.6415-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The taint and system state flags will be used in a subsequent patch exposing these to userspace, so move them to uapi. We keep the TAINT_FLAGS_COUNT outside of uapi, as this value can change per release. Signed-off-by: Luis Chamberlain --- include/linux/kernel.h | 34 +--------------------------------- include/uapi/linux/kernel.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 82d91547d122..337634363d00 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -569,40 +569,8 @@ extern unsigned long get_taint(void); extern int root_mountflags; extern bool early_boot_irqs_disabled; +extern enum system_states system_state; -/* - * Values used for system_state. Ordering of the states must not be changed - * as code checks for <, <=, >, >= STATE. - */ -extern enum system_states { - SYSTEM_BOOTING, - SYSTEM_SCHEDULING, - SYSTEM_RUNNING, - SYSTEM_HALT, - SYSTEM_POWER_OFF, - SYSTEM_RESTART, - SYSTEM_SUSPEND, -} system_state; - -/* This cannot be an enum because some may be used in assembly source. */ -#define TAINT_PROPRIETARY_MODULE 0 -#define TAINT_FORCED_MODULE 1 -#define TAINT_CPU_OUT_OF_SPEC 2 -#define TAINT_FORCED_RMMOD 3 -#define TAINT_MACHINE_CHECK 4 -#define TAINT_BAD_PAGE 5 -#define TAINT_USER 6 -#define TAINT_DIE 7 -#define TAINT_OVERRIDDEN_ACPI_TABLE 8 -#define TAINT_WARN 9 -#define TAINT_CRAP 10 -#define TAINT_FIRMWARE_WORKAROUND 11 -#define TAINT_OOT_MODULE 12 -#define TAINT_UNSIGNED_MODULE 13 -#define TAINT_SOFTLOCKUP 14 -#define TAINT_LIVEPATCH 15 -#define TAINT_AUX 16 -#define TAINT_RANDSTRUCT 17 #define TAINT_FLAGS_COUNT 18 #define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1) diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h index 0ff8f7477847..4bbd4093eb64 100644 --- a/include/uapi/linux/kernel.h +++ b/include/uapi/linux/kernel.h @@ -12,4 +12,39 @@ #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) +/* + * Values used for system_state. Ordering of the states must not be changed + * as code checks for <, <=, >, >= STATE. + */ +enum system_states { + SYSTEM_BOOTING, + SYSTEM_SCHEDULING, + SYSTEM_RUNNING, + SYSTEM_HALT, + SYSTEM_POWER_OFF, + SYSTEM_RESTART, + SYSTEM_SUSPEND, +}; + +/* This cannot be an enum because some may be used in assembly source. */ +#define TAINT_PROPRIETARY_MODULE 0 +#define TAINT_FORCED_MODULE 1 +#define TAINT_CPU_OUT_OF_SPEC 2 +#define TAINT_FORCED_RMMOD 3 +#define TAINT_MACHINE_CHECK 4 +#define TAINT_BAD_PAGE 5 +#define TAINT_USER 6 +#define TAINT_DIE 7 +#define TAINT_OVERRIDDEN_ACPI_TABLE 8 +#define TAINT_WARN 9 +#define TAINT_CRAP 10 +#define TAINT_FIRMWARE_WORKAROUND 11 +#define TAINT_OOT_MODULE 12 +#define TAINT_UNSIGNED_MODULE 13 +#define TAINT_SOFTLOCKUP 14 +#define TAINT_LIVEPATCH 15 +#define TAINT_AUX 16 +#define TAINT_RANDSTRUCT 17 +/* be sure to update TAINT_FLAGS_COUNT when extending this */ + #endif /* _UAPI_LINUX_KERNEL_H */ From patchwork Tue May 26 14:58:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 218532 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF8BFC433DF for ; Tue, 26 May 2020 14:58:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 812F42068D for ; Tue, 26 May 2020 14:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590505111; bh=OcCdR7LKLgC914RG8kQDQ2gMex21XC0MywA8RY7F+cE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KCZkzdPilApOQ/n0A5wgo2PRkz4dvKvxMTBOJfMcPsQYb/mCr0hPhRJ54R5TQjMka 1zuuwYYNpofrGqxTIQbBoVm7AcYOFvib/3rHBxa8WpVO59jDz3+8cSW6I4wjl6i4aq ab6Zn8v2e/O0fo866WRMmFAKPAEakuP0lJ7t5nH4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731374AbgEZO6a (ORCPT ); Tue, 26 May 2020 10:58:30 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46592 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730281AbgEZO60 (ORCPT ); Tue, 26 May 2020 10:58:26 -0400 Received: by mail-pf1-f193.google.com with SMTP id 131so1906858pfv.13; Tue, 26 May 2020 07:58:25 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=EvSxJvzu8CuJNVtnMN+6EPtAduMBjuHw07i/r14VRgA=; b=Is2tpGym8gzbx0crDhBSjU2sp3DGafM9CeR1DqYxWmWhneuziQa0UR9PVE2aBQMKL0 md14tfuZT+jDe5VMt6OoH09VltZ5GqMgjvZ4A6NJNg3UYR4I1O6JbpE2dwLm7ZoiqlrT e4YzWuTItW82cjZgDQh0NeGLOk4oRRThf0g4YW/KkoGkTqW/iGTnND0bx4mpokAHx0Me XOwiMZosPpfnuV4NB+UKkHdQxw28WcNSvGHSjQBqTalzYs0slE4naa/XJ8WVbEaqPvsM QyBwmKnJpDAzkDla1RMEI0b97VGHUOhfP2Xu5O6JKVRZTGLyVdAd/8D0F4G7jxncqKPQ Vqxg== X-Gm-Message-State: AOAM533Pbykkqz1uTEfgnIcDYv71oiswuVW3PEYazRp7lv79TxO4/459 oQzrqhS2QHLwkRs0wtDVqHnvzwnTJEZiGg== X-Google-Smtp-Source: ABdhPJxnO0fX0HJIoxald0Wt4I5kJb9sYmEvLY5dFdfg1I0//8tMTs+SRIAt5tW4ZCLckmZj7qQyMg== X-Received: by 2002:a63:f442:: with SMTP id p2mr1439345pgk.234.1590505104559; Tue, 26 May 2020 07:58:24 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id m18sm77891pjl.14.2020.05.26.07.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 07:58:22 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 2FDE941D00; Tue, 26 May 2020 14:58:18 +0000 (UTC) From: Luis Chamberlain To: jeyu@kernel.org, davem@davemloft.net, kuba@kernel.org Cc: michael.chan@broadcom.com, dchickles@marvell.com, sburla@marvell.com, fmanlunas@marvell.com, aelior@marvell.com, GR-everest-linux-l2@marvell.com, kvalo@codeaurora.org, johannes@sipsolutions.net, akpm@linux-foundation.org, arnd@arndb.de, rostedt@goodmis.org, mingo@redhat.com, aquini@redhat.com, cai@lca.pw, dyoung@redhat.com, bhe@redhat.com, peterz@infradead.org, tglx@linutronix.de, gpiccoli@canonical.com, pmladek@suse.com, tiwai@suse.de, schlad@suse.de, andriy.shevchenko@linux.intel.com, derosier@gmail.com, keescook@chromium.org, daniel.vetter@ffwll.ch, will@kernel.org, mchehab+samsung@kernel.org, vkoul@kernel.org, mchehab+huawei@kernel.org, robh@kernel.org, mhiramat@kernel.org, sfr@canb.auug.org.au, linux@dominikbrodowski.net, glider@google.com, paulmck@kernel.org, elver@google.com, bauerman@linux.ibm.com, yamada.masahiro@socionext.com, samitolvanen@google.com, yzaikin@google.com, dvyukov@google.com, rdunlap@infradead.org, corbet@lwn.net, dianders@chromium.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Luis Chamberlain Subject: [PATCH v3 3/8] taint: add firmware crash taint support Date: Tue, 26 May 2020 14:58:10 +0000 Message-Id: <20200526145815.6415-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200526145815.6415-1-mcgrof@kernel.org> References: <20200526145815.6415-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Device drivers firmware can crash, and *sometimes*, this can leave your system in a state which makes the device or subsystem completely useless. In the worst of cases not even removing the module and adding it back again will correct your situation and you are left with no other option but to do a full system reboot. Some drivers have work arounds for these situations, and sometimes they can recover the device / functionality but not all device drivers have these arrangements and in the worst cases requiring a full reboot is completely hidden from the user experience, leaving them dumbfounded with what has happened. Detecting this by inspecting /proc/sys/kernel/tainted instead of scraping some magical words from the kernel log, which is driver specific, is much easier. So instead provide a helper which lets drivers annotate this. Once this happens, scrapers can easily look for modules taint flags for a firmware crash. This will taint both the kernel and respective calling module. The new helper taint_firmware_crashed() uses LOCKDEP_STILL_OK as this fact should in no way shape or form affect lockdep. This taint is device driver specific. While extending the declaration of add_taint_module(), just make the flag unsigned int clear. Signed-off-by: Luis Chamberlain --- Documentation/admin-guide/tainted-kernels.rst | 6 ++++++ include/linux/kernel.h | 2 +- include/linux/module.h | 13 +++++++++++++ include/trace/events/module.h | 3 ++- include/uapi/linux/kernel.h | 1 + kernel/module.c | 13 +++++++++---- kernel/panic.c | 1 + tools/debugging/kernel-chktaint | 7 +++++++ 8 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Documentation/admin-guide/tainted-kernels.rst b/Documentation/admin-guide/tainted-kernels.rst index 71e9184a9079..92530f1d60ae 100644 --- a/Documentation/admin-guide/tainted-kernels.rst +++ b/Documentation/admin-guide/tainted-kernels.rst @@ -100,6 +100,7 @@ Bit Log Number Reason that got the kernel tainted 15 _/K 32768 kernel has been live patched 16 _/X 65536 auxiliary taint, defined for and used by distros 17 _/T 131072 kernel was built with the struct randomization plugin + 18 _/Q 262144 driver firmware crash annotation === === ====== ======================================================== Note: The character ``_`` is representing a blank in this table to make reading @@ -162,3 +163,8 @@ More detailed explanation for tainting produce extremely unusual kernel structure layouts (even performance pathological ones), which is important to know when debugging. Set at build time. + + 18) ``Q`` used by device drivers to annotate that the device driver's firmware + has crashed and the device's operation has been severely affected. The + device may be left in a crippled state, requiring full driver removal / + addition, system reboot, or it is unclear how long recovery will take. diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 337634363d00..a1974907c320 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -571,7 +571,7 @@ extern int root_mountflags; extern bool early_boot_irqs_disabled; extern enum system_states system_state; -#define TAINT_FLAGS_COUNT 18 +#define TAINT_FLAGS_COUNT 19 #define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1) struct taint_flag { diff --git a/include/linux/module.h b/include/linux/module.h index 2e6670860d27..b3e143d2993e 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -705,6 +705,14 @@ static inline bool is_livepatch_module(struct module *mod) bool is_module_sig_enforced(void); void set_module_sig_enforced(void); +void add_taint_module(struct module *mod, unsigned int flag, + enum lockdep_ok lockdep_ok); + +static inline void taint_firmware_crashed(void) +{ + add_taint_module(THIS_MODULE, TAINT_FIRMWARE_CRASH, LOCKDEP_STILL_OK); +} + #else /* !CONFIG_MODULES... */ static inline struct module *__module_address(unsigned long addr) @@ -852,6 +860,11 @@ void *dereference_module_function_descriptor(struct module *mod, void *ptr) return ptr; } +static inline void taint_firmware_crashed(void) +{ + add_taint(TAINT_FIRMWARE_CRASH, LOCKDEP_STILL_OK); +} + #endif /* CONFIG_MODULES */ #ifdef CONFIG_SYSFS diff --git a/include/trace/events/module.h b/include/trace/events/module.h index 097485c73c01..b749ea25affd 100644 --- a/include/trace/events/module.h +++ b/include/trace/events/module.h @@ -26,7 +26,8 @@ struct module; { (1UL << TAINT_OOT_MODULE), "O" }, \ { (1UL << TAINT_FORCED_MODULE), "F" }, \ { (1UL << TAINT_CRAP), "C" }, \ - { (1UL << TAINT_UNSIGNED_MODULE), "E" }) + { (1UL << TAINT_UNSIGNED_MODULE), "E" }, \ + { (1UL << TAINT_FIRMWARE_CRASH), "Q" }) TRACE_EVENT(module_load, diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h index 4bbd4093eb64..1e364659afca 100644 --- a/include/uapi/linux/kernel.h +++ b/include/uapi/linux/kernel.h @@ -45,6 +45,7 @@ enum system_states { #define TAINT_LIVEPATCH 15 #define TAINT_AUX 16 #define TAINT_RANDSTRUCT 17 +#define TAINT_FIRMWARE_CRASH 18 /* be sure to update TAINT_FLAGS_COUNT when extending this */ #endif /* _UAPI_LINUX_KERNEL_H */ diff --git a/kernel/module.c b/kernel/module.c index 9b85d58441a2..538def226332 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -326,13 +326,18 @@ static inline int strong_try_module_get(struct module *mod) return -ENOENT; } -static inline void add_taint_module(struct module *mod, unsigned flag, - enum lockdep_ok lockdep_ok) +void add_taint_module(struct module *mod, unsigned int flag, + enum lockdep_ok lockdep_ok) { add_taint(flag, lockdep_ok); - set_bit(flag, &mod->taints); - panic_uevent_taint(flag, mod); + + /* Skip this if the module is built-in */ + if (mod) { + set_bit(flag, &mod->taints); + panic_uevent_taint(flag, mod); + } } +EXPORT_SYMBOL_GPL(add_taint_module); /* * A thread that wants to hold a reference to a module only while it diff --git a/kernel/panic.c b/kernel/panic.c index 48e9e2efa5bb..cb1c5619e983 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -387,6 +387,7 @@ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = { [ TAINT_LIVEPATCH ] = { 'K', ' ', true }, [ TAINT_AUX ] = { 'X', ' ', true }, [ TAINT_RANDSTRUCT ] = { 'T', ' ', true }, + [ TAINT_FIRMWARE_CRASH ] = { 'Q', ' ', true }, }; /** diff --git a/tools/debugging/kernel-chktaint b/tools/debugging/kernel-chktaint index 2240cb56e6e5..c397c6aabea7 100755 --- a/tools/debugging/kernel-chktaint +++ b/tools/debugging/kernel-chktaint @@ -194,6 +194,13 @@ else addout "T" echo " * kernel was built with the struct randomization plugin (#17)" fi +T=`expr $T / 2` +if [ `expr $T % 2` -eq 0 ]; then + addout " " +else + addout "Q" + echo " * a device driver's firmware has crashed (#18)" +fi echo "For a more detailed explanation of the various taint flags see" echo " Documentation/admin-guide/tainted-kernels.rst in the the Linux kernel sources" From patchwork Tue May 26 14:58:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 218529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2722C433DF for ; Tue, 26 May 2020 14:59:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B16D82068D for ; Tue, 26 May 2020 14:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590505145; bh=dZeLXoUBQtKDHLLwUZOY5erPD//Mcj+l4J+EmoZeztE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OkFnLb+N0quy3GLQetg02CEYdP68FIqFb6ZQvzDCkrOWlMq1aEB1k5n2L/94kMesk /arf586/FkjCokDA1LBTN3WRTpcUC7X8Pe99A9ASoWPy19PffXClUUD5qQjSlsvVLH Wb1YMsMwZVnP5kal9WkGbGA7HAR+X089+oZpUD/o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731515AbgEZO7D (ORCPT ); Tue, 26 May 2020 10:59:03 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35705 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730279AbgEZO60 (ORCPT ); Tue, 26 May 2020 10:58:26 -0400 Received: by mail-pf1-f194.google.com with SMTP id n18so10287302pfa.2; Tue, 26 May 2020 07:58:25 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=UXRYeaDc02XdMrQZXPWL4bjUJlIpwN0dvTWzE8/MMVk=; b=ebUzDq04TLB6YRPKA5vxkAHPSzIbrz0qtegTHzbwLilDT/7T+ZHLXyuh/AQik3zkHj r4BFLWOy9nOaRGeSqivwfrE4CnwXe9ptyECl2YYoMc1vnIv6gU+yMyrGch+le8X0zAWf kCtg2o2OnaFUXFllg4ZxUP5nrniwaQcuNN+eUmKk0axYHuTSlTvWsuGYL5EgDyUrg3Hp BHbLmuZTsmMdD1ln2BCUQnvw+h+7VZBgh59Dxrr/1JcWqOzwA75g1qcqb1/ZeBrzRm+P XDReQvuT9CklWbuG8fDuPPiorqqzP90Uhl5zKVS20YbaNMghnM1EAel0aRv62AFJzKJb OX5A== X-Gm-Message-State: AOAM5312GB5WZwDvA5cXxGJ8uOEZgYDtEvzKFwSxrFHuLgtmazc6+624 IWZA9JwxfLiWZ1lvEmfpL46k83DvMEpJYw== X-Google-Smtp-Source: ABdhPJxBAlF1xJ1w59CSnXxL2XBmkLpEHhZLXaYmbdgLSEehHHgbirJog0XFXMNI5RxzlfyWBEXMqQ== X-Received: by 2002:a63:cf03:: with SMTP id j3mr1447611pgg.24.1590505104761; Tue, 26 May 2020 07:58:24 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id d2sm26656pgp.56.2020.05.26.07.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 07:58:22 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 6982C41D12; Tue, 26 May 2020 14:58:18 +0000 (UTC) From: Luis Chamberlain To: jeyu@kernel.org, davem@davemloft.net, kuba@kernel.org Cc: michael.chan@broadcom.com, dchickles@marvell.com, sburla@marvell.com, fmanlunas@marvell.com, aelior@marvell.com, GR-everest-linux-l2@marvell.com, kvalo@codeaurora.org, johannes@sipsolutions.net, akpm@linux-foundation.org, arnd@arndb.de, rostedt@goodmis.org, mingo@redhat.com, aquini@redhat.com, cai@lca.pw, dyoung@redhat.com, bhe@redhat.com, peterz@infradead.org, tglx@linutronix.de, gpiccoli@canonical.com, pmladek@suse.com, tiwai@suse.de, schlad@suse.de, andriy.shevchenko@linux.intel.com, derosier@gmail.com, keescook@chromium.org, daniel.vetter@ffwll.ch, will@kernel.org, mchehab+samsung@kernel.org, vkoul@kernel.org, mchehab+huawei@kernel.org, robh@kernel.org, mhiramat@kernel.org, sfr@canb.auug.org.au, linux@dominikbrodowski.net, glider@google.com, paulmck@kernel.org, elver@google.com, bauerman@linux.ibm.com, yamada.masahiro@socionext.com, samitolvanen@google.com, yzaikin@google.com, dvyukov@google.com, rdunlap@infradead.org, corbet@lwn.net, dianders@chromium.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Luis Chamberlain Subject: [PATCH v3 4/8] panic: make taint data type clearer Date: Tue, 26 May 2020 14:58:11 +0000 Message-Id: <20200526145815.6415-5-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200526145815.6415-1-mcgrof@kernel.org> References: <20200526145815.6415-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Let us be clearer about the the data type for the taint flag. Signed-off-by: Luis Chamberlain --- include/asm-generic/bug.h | 4 ++-- include/linux/kernel.h | 4 ++-- kernel/panic.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index c94e33ae3e7b..87dbe57301f4 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -80,7 +80,7 @@ struct bug_entry { */ #ifndef __WARN_FLAGS extern __printf(4, 5) -void warn_slowpath_fmt(const char *file, const int line, unsigned taint, +void warn_slowpath_fmt(const char *file, const int line, unsigned int taint, const char *fmt, ...); #define __WARN() __WARN_printf(TAINT_WARN, NULL) #define __WARN_printf(taint, arg...) do { \ @@ -110,7 +110,7 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...); struct warn_args; struct pt_regs; -void __warn(const char *file, int line, void *caller, unsigned taint, +void __warn(const char *file, int line, void *caller, unsigned int taint, struct pt_regs *regs, struct warn_args *args); #ifndef WARN_ON diff --git a/include/linux/kernel.h b/include/linux/kernel.h index a1974907c320..d154844eb9cd 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -563,8 +563,8 @@ enum lockdep_ok { LOCKDEP_STILL_OK, LOCKDEP_NOW_UNRELIABLE }; -extern void add_taint(unsigned flag, enum lockdep_ok); -extern int test_taint(unsigned flag); +extern void add_taint(unsigned int flag, enum lockdep_ok); +extern int test_taint(unsigned int flag); extern unsigned long get_taint(void); extern int root_mountflags; diff --git a/kernel/panic.c b/kernel/panic.c index cb1c5619e983..3cfe84318ecf 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -421,7 +421,7 @@ const char *print_tainted(void) return buf; } -int test_taint(unsigned flag) +int test_taint(unsigned int flag) { return test_bit(flag, &tainted_mask); } @@ -440,7 +440,7 @@ unsigned long get_taint(void) * If something bad has gone wrong, you'll want @lockdebug_ok = false, but for * some notewortht-but-not-corrupting cases, it can be set to true. */ -void add_taint(unsigned flag, enum lockdep_ok lockdep_ok) +void add_taint(unsigned int flag, enum lockdep_ok lockdep_ok) { if (lockdep_ok == LOCKDEP_NOW_UNRELIABLE && __debug_locks_off()) { pr_warn("Disabling lock debugging due to kernel taint\n"); @@ -579,7 +579,7 @@ struct warn_args { va_list args; }; -void __warn(const char *file, int line, void *caller, unsigned taint, +void __warn(const char *file, int line, void *caller, unsigned int taint, struct pt_regs *regs, struct warn_args *args) { disable_trace_on_warning(); @@ -622,7 +622,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint, } #ifndef __WARN_FLAGS -void warn_slowpath_fmt(const char *file, int line, unsigned taint, +void warn_slowpath_fmt(const char *file, int line, unsigned int taint, const char *fmt, ...) { struct warn_args args; From patchwork Tue May 26 14:58:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 218531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAFFEC433E1 for ; Tue, 26 May 2020 14:58:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5A0E2068D for ; Tue, 26 May 2020 14:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590505124; bh=z4g8BXqkxKpN8OSDwsb3VvEAcHlgSEkYYBGnThWscbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bbWvcYAmhMYOgKOrs0BfKgs+S9xsDHFKS+shBZz2J8/uFWfzyvf95BIqZRHqYg7o3 naXcoef0wmeKMGggw6uvG0l1h+VlutysdAvs20p0kZsr0DVN9gPN1SwEIWHK/uGuO2 Z+LkMQc+SHcvhwewDHMSYi1/ldqG7hbjSoYSHaOA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731474AbgEZO6n (ORCPT ); Tue, 26 May 2020 10:58:43 -0400 Received: from mail-pj1-f68.google.com ([209.85.216.68]:36647 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731353AbgEZO63 (ORCPT ); Tue, 26 May 2020 10:58:29 -0400 Received: by mail-pj1-f68.google.com with SMTP id q24so1447500pjd.1; Tue, 26 May 2020 07:58:28 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=llTH2n++tTVLBhGsV5Icw97tnABVgUx2YdNChWoYrTA=; b=A2xhpnQUC2hi8e/mORVqh5I+pLYzNsbb5VK0d/u6QKGDxV4p668ZwF9PQ267n69q/b loX1NPHcqQSLki7AvTypHz52LfeP8aeYPb4M7KqfSlQ4uLF5CvD9cbeLWXuljTBbStnB CMZrCi6O76w1zos9qnMB5E8e26OIIEEBQkw1hh34qVdM8ul4O1o9yH5ScX7VWPQSzkv8 q6jIMJAFd7+84hX+Q3rhDQT5VpmyWYIAMo1NaP1X52kBnAx5jBL3GDLGz9vXyHCowk0w Q5m/wZYodoFwQHdOboJc9d7PPTsUCwtptxvkkKQ86vLbonMIySEoiOR/Saew1y8BKFqx OOPA== X-Gm-Message-State: AOAM532zKE1gClFWYH/JIS1XzmNWE+nSXhbvl18K9qAiOnKH+vd9ruJI xAi5XMDmjmllN9tQzmBaTPkt/+TojwuyRA== X-Google-Smtp-Source: ABdhPJyLz50Sjirnf6zkmVAF4v4gho1TNrewe05nIrzVVuTcQr6Kt75n4njhYwpQzdS375ICVt/pXA== X-Received: by 2002:a17:902:9043:: with SMTP id w3mr1387143plz.250.1590505107012; Tue, 26 May 2020 07:58:27 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id s15sm40988pgv.5.2020.05.26.07.58.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 07:58:25 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 9028741DCA; Tue, 26 May 2020 14:58:18 +0000 (UTC) From: Luis Chamberlain To: jeyu@kernel.org, davem@davemloft.net, kuba@kernel.org Cc: michael.chan@broadcom.com, dchickles@marvell.com, sburla@marvell.com, fmanlunas@marvell.com, aelior@marvell.com, GR-everest-linux-l2@marvell.com, kvalo@codeaurora.org, johannes@sipsolutions.net, akpm@linux-foundation.org, arnd@arndb.de, rostedt@goodmis.org, mingo@redhat.com, aquini@redhat.com, cai@lca.pw, dyoung@redhat.com, bhe@redhat.com, peterz@infradead.org, tglx@linutronix.de, gpiccoli@canonical.com, pmladek@suse.com, tiwai@suse.de, schlad@suse.de, andriy.shevchenko@linux.intel.com, derosier@gmail.com, keescook@chromium.org, daniel.vetter@ffwll.ch, will@kernel.org, mchehab+samsung@kernel.org, vkoul@kernel.org, mchehab+huawei@kernel.org, robh@kernel.org, mhiramat@kernel.org, sfr@canb.auug.org.au, linux@dominikbrodowski.net, glider@google.com, paulmck@kernel.org, elver@google.com, bauerman@linux.ibm.com, yamada.masahiro@socionext.com, samitolvanen@google.com, yzaikin@google.com, dvyukov@google.com, rdunlap@infradead.org, corbet@lwn.net, dianders@chromium.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Luis Chamberlain , linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH v3 5/8] ath10k: use new taint_firmware_crashed() Date: Tue, 26 May 2020 14:58:12 +0000 Message-Id: <20200526145815.6415-6-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200526145815.6415-1-mcgrof@kernel.org> References: <20200526145815.6415-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This makes use of the new taint_firmware_crashed() to help annotate when firmware for device drivers crash. When firmware crashes devices can sometimes become unresponsive, and recovery sometimes requires a driver unload / reload and in the worst cases a reboot. Using a taint flag allows us to annotate when this happens clearly. I have run into this situation with this driver with the latest firmware as of today, May 21, 2020 using v5.6.0, leaving me at a state at which my only option is to reboot. Driver removal and addition does not fix the situation. This is reported on kernel.org bugzilla korg#207851 [0]. But this isn't the first firmware crash reported, others have been filed before and none of these bugs have yet been addressed [1] [2] [3]. Including my own I see these firmware crash reports: * korg#207851 [0] * korg#197013 [1] * korg#201237 [2] * korg#195987 [3] [0] https://bugzilla.kernel.org/show_bug.cgi?id=207851 [1] https://bugzilla.kernel.org/show_bug.cgi?id=197013 [2] https://bugzilla.kernel.org/show_bug.cgi?id=201237 [3] https://bugzilla.kernel.org/show_bug.cgi?id=195987 Cc: linux-wireless@vger.kernel.org Cc: ath10k@lists.infradead.org Cc: Kalle Valo Acked-by: Rafael Aquini Signed-off-by: Luis Chamberlain --- drivers/net/wireless/ath/ath10k/pci.c | 2 ++ drivers/net/wireless/ath/ath10k/sdio.c | 2 ++ drivers/net/wireless/ath/ath10k/snoc.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 1d941d53fdc9..818c3acc2468 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -1767,6 +1767,7 @@ static void ath10k_pci_fw_dump_work(struct work_struct *work) scnprintf(guid, sizeof(guid), "n/a"); ath10k_err(ar, "firmware crashed! (guid %s)\n", guid); + taint_firmware_crashed(); ath10k_print_driver_info(ar); ath10k_pci_dump_registers(ar, crash_data); ath10k_ce_dump_registers(ar, crash_data); @@ -2837,6 +2838,7 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar, if (ret) { if (ath10k_pci_has_fw_crashed(ar)) { ath10k_warn(ar, "firmware crashed during chip reset\n"); + taint_firmware_crashed(); ath10k_pci_fw_crashed_clear(ar); ath10k_pci_fw_crashed_dump(ar); } diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index e2aff2254a40..8b2fc0b89be4 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -794,6 +794,7 @@ static int ath10k_sdio_mbox_proc_dbg_intr(struct ath10k *ar) /* TODO: Add firmware crash handling */ ath10k_warn(ar, "firmware crashed\n"); + taint_firmware_crashed(); /* read counter to clear the interrupt, the debug error interrupt is * counter 0. @@ -915,6 +916,7 @@ static int ath10k_sdio_mbox_proc_cpu_intr(struct ath10k *ar) if (cpu_int_status & MBOX_CPU_STATUS_ENABLE_ASSERT_MASK) { ath10k_err(ar, "firmware crashed!\n"); queue_work(ar->workqueue, &ar->restart_work); + taint_firmware_crashed(); } return ret; } diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 354d49b1cd45..071ee7607a4c 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -1451,6 +1451,7 @@ void ath10k_snoc_fw_crashed_dump(struct ath10k *ar) scnprintf(guid, sizeof(guid), "n/a"); ath10k_err(ar, "firmware crashed! (guid %s)\n", guid); + taint_firmware_crashed(); ath10k_print_driver_info(ar); ath10k_msa_dump_memory(ar, crash_data); mutex_unlock(&ar->dump_mutex); From patchwork Tue May 26 14:58:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 218524 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BBC9C433E1 for ; Tue, 26 May 2020 15:07:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59B392070A for ; Tue, 26 May 2020 15:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590505666; bh=rh/ZwuBqEQdTP5hmpFrECM/X5iKXZZT4RSLrxOAfj5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=e2sPEw+maeTcUcaM57ixBF7UZ6dIBdLtkxDAQYBD43/VfShM7fdDv02vTQQSSrSe9 mZTfO0H9iNPg1zE7dVtLK3pYT74el67PNeSP+EJByh0Pz2oGhbr9zww/w22k2ZnwOx aeRaZ0p59Xd1kITQkvHiSe9SXT1h8Pn0zjPNk3kk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729641AbgEZPHn (ORCPT ); Tue, 26 May 2020 11:07:43 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43897 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728166AbgEZPHn (ORCPT ); Tue, 26 May 2020 11:07:43 -0400 Received: by mail-pg1-f195.google.com with SMTP id 185so1979276pgb.10; Tue, 26 May 2020 08:07:42 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=L6RbYv5B1MYyKpilgE+iTClDmvIVUX2RuuOQOJ/aMVQ=; b=WNsW+JqxQqm1qgxF7HiiTvL2d/DCKjcYs294L0UiPjee0afDrntI3Dv7MkN3DB76Du mNXg/263fBRfosNnylqs89JZoQraoQPxshz2dELM0PkQKQ9+7weFdHVsWVfhs9hn4lVA txQyd6nhTuucLSYbP6J/HKM54X/VArZPLuQBEDrYsbjxQQo3teaKkXwEl8bFh8Pp5XEz SXJFJgsS3CCQU57kzkwFnMeqZyURJJYDQh0y39OViYK0iEK8zerZnUqa+Ax1gmUE+lv4 REXXBKowtySHX40Bxnw4TEh/9IFy2n9fxy7Y9iVn8U1wQehKRaOzcbA4Kq2rKH+Gr7Zo qtGg== X-Gm-Message-State: AOAM531ubOra4Ak3AP8d0Sf28+v1lbmilc6fvK83qiSUC5dF2LSGtB/i uWRNR+cjooxSQOmEcfIebiwG8KwnupR1zw== X-Google-Smtp-Source: ABdhPJwU5ShAKbAvJXQtY62vZ1/Gh7rdLSj1+p4Kod680hhz3y98c6Kz9js7ZW4bm3wIfIjpQ2UATQ== X-Received: by 2002:aa7:880f:: with SMTP id c15mr22560560pfo.94.1590505662105; Tue, 26 May 2020 08:07:42 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id k18sm15699602pfg.217.2020.05.26.08.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 08:07:40 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 0547C4230A; Tue, 26 May 2020 14:58:19 +0000 (UTC) From: Luis Chamberlain To: jeyu@kernel.org, davem@davemloft.net, kuba@kernel.org Cc: michael.chan@broadcom.com, dchickles@marvell.com, sburla@marvell.com, fmanlunas@marvell.com, aelior@marvell.com, GR-everest-linux-l2@marvell.com, kvalo@codeaurora.org, johannes@sipsolutions.net, akpm@linux-foundation.org, arnd@arndb.de, rostedt@goodmis.org, mingo@redhat.com, aquini@redhat.com, cai@lca.pw, dyoung@redhat.com, bhe@redhat.com, peterz@infradead.org, tglx@linutronix.de, gpiccoli@canonical.com, pmladek@suse.com, tiwai@suse.de, schlad@suse.de, andriy.shevchenko@linux.intel.com, derosier@gmail.com, keescook@chromium.org, daniel.vetter@ffwll.ch, will@kernel.org, mchehab+samsung@kernel.org, vkoul@kernel.org, mchehab+huawei@kernel.org, robh@kernel.org, mhiramat@kernel.org, sfr@canb.auug.org.au, linux@dominikbrodowski.net, glider@google.com, paulmck@kernel.org, elver@google.com, bauerman@linux.ibm.com, yamada.masahiro@socionext.com, samitolvanen@google.com, yzaikin@google.com, dvyukov@google.com, rdunlap@infradead.org, corbet@lwn.net, dianders@chromium.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Luis Chamberlain , Igor Russkikh Subject: [PATCH v3 8/8] qed: use new taint_firmware_crashed() Date: Tue, 26 May 2020 14:58:15 +0000 Message-Id: <20200526145815.6415-9-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200526145815.6415-1-mcgrof@kernel.org> References: <20200526145815.6415-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This makes use of the new taint_firmware_crashed() to help annotate when firmware for device drivers crash. When firmware crashes devices can sometimes become unresponsive, and recovery sometimes requires a driver unload / reload and in the worst cases a reboot. Using a taint flag allows us to annotate when this happens clearly. Cc: Ariel Elior Cc: GR-everest-linux-l2@marvell.com Reviewed-by: Igor Russkikh Acked-by: Rafael Aquini Signed-off-by: Luis Chamberlain --- drivers/net/ethernet/qlogic/qed/qed_mcp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c index 9624616806e7..dd4357b0b5d1 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c +++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c @@ -566,6 +566,7 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, DP_NOTICE(p_hwfn, "The MFW failed to respond to command 0x%08x [param 0x%08x].\n", p_mb_params->cmd, p_mb_params->param); + taint_firmware_crashed(); qed_mcp_print_cpu_info(p_hwfn, p_ptt); spin_lock_bh(&p_hwfn->mcp_info->cmd_lock);